avewright commited on
Commit
d4a3c06
·
verified ·
1 Parent(s): 3a9a2ba

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +50 -0
README.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - chess
5
+ - transformer
6
+ - policy-value
7
+ datasets:
8
+ - avewright/chess-positions-lichess-sf
9
+ ---
10
+
11
+ # ChessTransformer200M
12
+
13
+ A 204M parameter chess-native transformer trained on Stockfish-labeled positions.
14
+
15
+ ## Architecture
16
+ - **Encoder**: FusedBoardEncoder (256d) — learned piece-color + square + context embeddings
17
+ - **Backbone**: 16-layer Transformer (1024d, 16 heads, FFN 4096, GELU, norm_first)
18
+ - **Policy Head**: SpatialPolicyHead (from×to square features, 512d)
19
+ - **Value Head**: WDL (win/draw/loss) classification
20
+
21
+ ## Training
22
+ - **Dataset**: avewright/chess-positions-lichess-sf (10.2M positions seen out of 48M available)
23
+ - **Steps**: 10,000 optimizer steps (effective batch 1024)
24
+ - **Final Policy Loss**: ~2.5 (estimated from loss curve)
25
+ - **Top-1 Accuracy**: 18.4% (on 5K eval positions vs Stockfish best moves)
26
+ - **GPU**: NVIDIA A40 46GB, FP16 + torch.compile
27
+ - **Training time**: ~6 hours to step 10,000
28
+
29
+ ## Usage
30
+
31
+ ```python
32
+ import torch
33
+ from play import ChessTransformer200M, load_model, encode_board, get_model_move
34
+ import chess
35
+
36
+ model = load_model("best_model.pt", torch.device("cpu"))
37
+ board = chess.Board()
38
+ move, info = get_model_move(model, board, torch.device("cpu"))
39
+ print(f"Best move: {move.uci()}, Top 5: {info['top_moves']}")
40
+ ```
41
+
42
+ ## Files
43
+ - `best_model.pt` — Model weights only (816 MB)
44
+ - `training_log.json` — Loss curve data
45
+ - `config.json` — Architecture config
46
+
47
+ ## Known Issues
48
+ - Training hit FP16 NaN at step ~13,800. Best checkpoint is step 10,000.
49
+ - Model is only ~21% through 1 epoch of the 48M subset dataset.
50
+ - Opens with 1.d4 as White. Plays reasonable chess but still early in training.