Downloads · 30 days
12
50% of all-time downloads
rzhang-7/chesshacks-model
chesshacks-model is a reinforcement learning model from rzhang-7. Use it for the reinforcement learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
A neural network-based chess engine that uses a policy network to predict the best moves.
Downloads · 30 days
12
50% of all-time downloads
All-time downloads
24
Public
Repo size
23.4 MB
Likes
0
Public
Click a slice to open those files.
.bin23.4 MB · 100%
From the Hugging Face model README
A neural network-based chess engine that uses a policy network to predict the best moves.
input_channels: 12
num_res_blocks: 8
filters: 128
policy_channels: 32
num_move_classes: 4672
dropout: 0.1
activation: relu
import torch
from huggingface_hub import hf_hub_download
from training.models import PolicyNetwork
from training.utils import encode_board
# Load model
model_path = hf_hub_download("rzhang-7/chesshacks-model", "pytorch_model.bin")
model = PolicyNetwork.from_config(config)
model.load(model_path)
model.eval()
# Get move predictions for a position
board_tensor = encode_board(board)
with torch.no_grad():
logits = model(board_tensor.unsqueeze(0))
# Convert to legal moves
move_probs = filter_policy_to_legal(logits[0].numpy(), board)
Evaluate with:
python training/scripts/evaluate.py --model-path path/to/model.pt --data-dir training/data
MIT
If you use this model, please cite:
@model{chess_policy_net,
title={Chess Policy Network},
author={Chess Hacks},
year={2024},
url={https://huggingface.co/rzhang-7/chesshacks-model}
}