Upload BT4 Chess model
Browse files- README.md +57 -0
- config.json +14 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- chess
|
| 5 |
+
- reinforcement-learning
|
| 6 |
+
- game-ai
|
| 7 |
+
- pytorch
|
| 8 |
+
library_name: transformers
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# BT4 Chess Model
|
| 12 |
+
|
| 13 |
+
This is a BT4 (Board Transformer 4) model for chess move prediction and position evaluation.
|
| 14 |
+
|
| 15 |
+
## Model Description
|
| 16 |
+
|
| 17 |
+
The BT4 model is a transformer-based architecture designed for chess gameplay. It can:
|
| 18 |
+
- Predict the next best move given a chess position (FEN)
|
| 19 |
+
- Evaluate chess positions
|
| 20 |
+
- Generate move probabilities
|
| 21 |
+
|
| 22 |
+
## Usage
|
| 23 |
+
|
| 24 |
+
```python
|
| 25 |
+
from HFChessRL import BT4Model, BT4Config
|
| 26 |
+
import torch
|
| 27 |
+
|
| 28 |
+
# Load the model
|
| 29 |
+
model = BT4Model.from_pretrained("Maxlegrec/ChessBot")
|
| 30 |
+
|
| 31 |
+
# Example usage
|
| 32 |
+
fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
|
| 33 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 34 |
+
model = model.to(device)
|
| 35 |
+
|
| 36 |
+
# Get the best move
|
| 37 |
+
move = model.get_move_from_fen_no_thinking(fen, T=0.1, device=device)
|
| 38 |
+
print(f"Predicted move: {move}")
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
## Model Architecture
|
| 42 |
+
|
| 43 |
+
- **Transformer layers**: 10
|
| 44 |
+
- **Hidden size**: 512
|
| 45 |
+
- **Feed-forward size**: 736
|
| 46 |
+
- **Attention heads**: 8
|
| 47 |
+
- **Vocabulary size**: 1929 (chess moves)
|
| 48 |
+
|
| 49 |
+
## Training Data
|
| 50 |
+
|
| 51 |
+
This model was trained on chess game data to learn optimal move selection and position evaluation.
|
| 52 |
+
|
| 53 |
+
## Limitations
|
| 54 |
+
|
| 55 |
+
- The model works best with standard chess positions
|
| 56 |
+
- Performance may vary with unusual or rare positions
|
| 57 |
+
- Requires GPU for optimal inference speed
|
config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"BT4Model"
|
| 4 |
+
],
|
| 5 |
+
"d_ff": 736,
|
| 6 |
+
"d_model": 512,
|
| 7 |
+
"max_position_embeddings": 64,
|
| 8 |
+
"model_type": "bt4",
|
| 9 |
+
"num_heads": 8,
|
| 10 |
+
"num_layers": 10,
|
| 11 |
+
"torch_dtype": "float32",
|
| 12 |
+
"transformers_version": "4.53.1",
|
| 13 |
+
"vocab_size": 1929
|
| 14 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2bde7187dc7db04da9762fe80fe1926454c45f5711e386786f34de55fa4d218e
|
| 3 |
+
size 122277600
|