Chessora V1 Lite Ultra is a compact neural chess policy/value model distributed in the Safetensors format. The model is intended to be used with the matching Chess-Engine project; it is not a standalone chess application or a Transformers model.
chess-model4.safetensorsThe model proposes and scores moves. The Chess-Engine combines its policy with legal-move validation and search; the model alone is not a complete chess engine.
from huggingface_hub import hf_hub_download
checkpoint_path = hf_hub_download(
repo_id="aivora-ai/chessora-v1-lite-ultra",
filename="chess-model4.safetensors",
)
print(checkpoint_path)
Install the project dependencies (including safetensors) and download the checkpoint. Load the Safetensors weights directly as shown below:
import json
from pathlib import Path
import chess
import torch
from safetensors import safe_open
from chess_engine.engine import choose_move, get_device
from chess_engine.model import ChessNet
device = get_device("auto")
checkpoint_path = Path("chess-model4.safetensors")
with safe_open(str(checkpoint_path), framework="np") as checkpoint:
metadata = checkpoint.metadata() or {}
model_config = json.loads(metadata["model_config"])
state_dict = {
name: torch.from_numpy(checkpoint.get_tensor(name).copy())
for name in checkpoint.keys()
}
model = ChessNet(**model_config)
model.load_state_dict(state_dict)
model.to(device)
model.eval()
board = chess.Board()
move = choose_move(board, depth=3, model=model, device=device)
print(board.san(move))
This repository is marked as MIT-licensed. Check the accompanying project and dataset terms before redistributing a combined package or training data.