Downloads · 30 days
55
9% of all-time downloads
kaupane/ChessFormer-SL
ChessFormer-SL is a reinforcement learning model from kaupane. Use it for the reinforcement learning task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as mit.
ChessFormer-SL is a transformer-based chess model trained via supervised learning on Stockfish evaluations. This model explores training chess engines without Monte Carlo Tree Search (MCTS), using only neural networks.
Downloads · 30 days
55
9% of all-time downloads
All-time downloads
594
Public
Parameters
101M
3.6 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors403 MB · 100%
From the Hugging Face model README
ChessFormer-SL is a transformer-based chess model trained via supervised learning on Stockfish evaluations. This model explores training chess engines without Monte Carlo Tree Search (MCTS), using only neural networks.
ChessFormer uses a custom transformer architecture optimized for chess:
The model processes FEN strings and repetition counts, tokenizing them into 75-token sequences representing:
kaupane/lichess-2023-01-stockfish-annotated (depth18 split)pip install torch transformers huggingface_hub chess
# Download model.py from this repository
import torch
from model import ChessFormerModel
# Load model
model = ChessFormerModel.from_pretrained("kaupane/ChessFormer-SL")
model.eval()
# Analyze position
fens = ["rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1"]
repetitions = torch.tensor([1])
with torch.no_grad():
move_logits, position_value = model(fens, repetitions)
# Get best move (requires additional processing for legal moves)
print(f"Position value: {position_value.item():.3f}")
from engine import Engine, ChessformerConfig
import chess
# Create engine
config = ChessformerConfig(
chessformer=model,
temperature=0.5,
depth=2 # Enable search enhancement
)
engine = Engine(type="chessformer", chessformer_config=config)
# Play move
board = chess.Board()
move_uci, value = engine.move(board)
print(f"Suggested move: {move_uci}, Value: {value:.3f}")
This model is intended for:
Not recommended for: