Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- chess
|
| 4 |
+
- reinforcement-learning
|
| 5 |
+
- mcts
|
| 6 |
+
- game-playing
|
| 7 |
+
license: mit
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Checkmate Chess Engine
|
| 11 |
+
|
| 12 |
+
A neural network trained to play chess using MCTS (Monte Carlo Tree Search) guidance.
|
| 13 |
+
|
| 14 |
+
## Model Description
|
| 15 |
+
|
| 16 |
+
This model evaluates chess positions and suggests moves. It outputs:
|
| 17 |
+
- **Policy (P)**: Probability distribution over legal moves
|
| 18 |
+
- **Value (V)**: Position evaluation from -1 (losing) to +1 (winning)
|
| 19 |
+
|
| 20 |
+
## Architecture
|
| 21 |
+
|
| 22 |
+
- Input: 773-dimensional board encoding (pieces, turn, castling rights)
|
| 23 |
+
- Hidden layers: 3x512 with ReLU + BatchNorm + Dropout
|
| 24 |
+
- Output heads:
|
| 25 |
+
- Policy head: 4672-dim output (all possible moves)
|
| 26 |
+
- Value head: Single scalar (-1 to +1)
|
| 27 |
+
|
| 28 |
+
## Training Data Format
|
| 29 |
+
|
| 30 |
+
The model is trained on game positions with format:
|
| 31 |
+
```json
|
| 32 |
+
{"fen": "...", "move": "e2e4", "value": -1}
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## Usage
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
from inference import ChessModelInference
|
| 39 |
+
import chess
|
| 40 |
+
|
| 41 |
+
# Load model
|
| 42 |
+
model = ChessModelInference("checkmate_model.pt")
|
| 43 |
+
|
| 44 |
+
# Get predictions
|
| 45 |
+
board = chess.Board()
|
| 46 |
+
P, V = model.predict(board.fen(), board)
|
| 47 |
+
|
| 48 |
+
print(f"Position value: {V}")
|
| 49 |
+
print(f"Best moves: {sorted(P.items(), key=lambda x: x[1], reverse=True)[:3]}")
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## Integration with MCTS
|
| 53 |
+
|
| 54 |
+
This model is designed to work with MCTS for move selection. The policy priors guide
|
| 55 |
+
the search, while value estimates help evaluate unvisited positions.
|
| 56 |
+
|
| 57 |
+
## License
|
| 58 |
+
|
| 59 |
+
MIT License
|