Update README.md
Browse files
README.md
CHANGED
|
@@ -10,7 +10,8 @@ library_name: transformers
|
|
| 10 |
|
| 11 |
# ChessBot Chess Model
|
| 12 |
|
| 13 |
-
This is a ChessBot model for chess move prediction and position evaluation.
|
|
|
|
| 14 |
|
| 15 |
## Model Description
|
| 16 |
|
|
@@ -32,17 +33,20 @@ model = model.to(device)
|
|
| 32 |
# Example usage
|
| 33 |
fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
|
| 34 |
|
| 35 |
-
#
|
| 36 |
move = model.get_move_from_fen_no_thinking(fen, T=0.1, device=device)
|
| 37 |
print(f"Policy-based move: {move}")
|
|
|
|
| 38 |
|
| 39 |
# Get the best move using value analysis
|
| 40 |
value_move = model.get_best_move_value(fen, T=0, device=device)
|
| 41 |
print(f"Value-based move: {value_move}")
|
|
|
|
| 42 |
|
| 43 |
# Get position evaluation
|
| 44 |
position_value = model.get_position_value(fen, device=device)
|
| 45 |
print(f"Position value [black_win, draw, white_win]: {position_value}")
|
|
|
|
| 46 |
|
| 47 |
# Get move probabilities
|
| 48 |
probs = model.get_move_from_fen_no_thinking(fen, T=1, device=device, return_probs=True)
|
|
@@ -50,6 +54,12 @@ top_moves = sorted(probs.items(), key=lambda x: x[1], reverse=True)[:5]
|
|
| 50 |
print("Top 5 moves:")
|
| 51 |
for move, prob in top_moves:
|
| 52 |
print(f" {move}: {prob:.4f}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
```
|
| 54 |
|
| 55 |
## Requirements
|
|
@@ -61,6 +71,8 @@ for move, prob in top_moves:
|
|
| 61 |
|
| 62 |
## Model Architecture
|
| 63 |
|
|
|
|
|
|
|
| 64 |
- **Transformer layers**: 10
|
| 65 |
- **Hidden size**: 512
|
| 66 |
- **Feed-forward size**: 736
|
|
@@ -69,7 +81,7 @@ for move, prob in top_moves:
|
|
| 69 |
|
| 70 |
## Training Data
|
| 71 |
|
| 72 |
-
This model was trained on
|
| 73 |
|
| 74 |
## Limitations
|
| 75 |
|
|
|
|
| 10 |
|
| 11 |
# ChessBot Chess Model
|
| 12 |
|
| 13 |
+
This is a ChessBot model for chess move prediction and position evaluation. This model is way worse than stockfish. It is better than most humans however.
|
| 14 |
+
For stronger play, reducing temperature T (lower is stronger) is suggested.
|
| 15 |
|
| 16 |
## Model Description
|
| 17 |
|
|
|
|
| 33 |
# Example usage
|
| 34 |
fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
|
| 35 |
|
| 36 |
+
# Sample move from policy
|
| 37 |
move = model.get_move_from_fen_no_thinking(fen, T=0.1, device=device)
|
| 38 |
print(f"Policy-based move: {move}")
|
| 39 |
+
#e2e4
|
| 40 |
|
| 41 |
# Get the best move using value analysis
|
| 42 |
value_move = model.get_best_move_value(fen, T=0, device=device)
|
| 43 |
print(f"Value-based move: {value_move}")
|
| 44 |
+
#e2e4
|
| 45 |
|
| 46 |
# Get position evaluation
|
| 47 |
position_value = model.get_position_value(fen, device=device)
|
| 48 |
print(f"Position value [black_win, draw, white_win]: {position_value}")
|
| 49 |
+
#[0.2318, 0.4618, 0.3064]
|
| 50 |
|
| 51 |
# Get move probabilities
|
| 52 |
probs = model.get_move_from_fen_no_thinking(fen, T=1, device=device, return_probs=True)
|
|
|
|
| 54 |
print("Top 5 moves:")
|
| 55 |
for move, prob in top_moves:
|
| 56 |
print(f" {move}: {prob:.4f}")
|
| 57 |
+
#Top 5 moves:
|
| 58 |
+
# e2e4: 0.9285
|
| 59 |
+
# d2d4: 0.0712
|
| 60 |
+
# g1f3: 0.0001
|
| 61 |
+
# e2e3: 0.0000
|
| 62 |
+
# c2c3: 0.0000
|
| 63 |
```
|
| 64 |
|
| 65 |
## Requirements
|
|
|
|
| 71 |
|
| 72 |
## Model Architecture
|
| 73 |
|
| 74 |
+
The architecture is strongly inspired from the LCzero project. Although written in pytorch.
|
| 75 |
+
|
| 76 |
- **Transformer layers**: 10
|
| 77 |
- **Hidden size**: 512
|
| 78 |
- **Feed-forward size**: 736
|
|
|
|
| 81 |
|
| 82 |
## Training Data
|
| 83 |
|
| 84 |
+
This model was trained on training data from the LCzero project. It consists of around 750M chess positions. I will publish the training dataset very soon.
|
| 85 |
|
| 86 |
## Limitations
|
| 87 |
|