jinshuoli commited on
Commit
73eb01c
·
verified ·
1 Parent(s): 415391e

Add dataset card (provenance, stats, format, load instructions)

Browse files
Files changed (1) hide show
  1. README.md +132 -0
README.md ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc0-1.0
3
+ language: en
4
+ pretty_name: ChessModel-XPU formal teacher dataset
5
+ tags:
6
+ - chess
7
+ - alphazero
8
+ - stockfish
9
+ - knowledge-distillation
10
+ - game
11
+ - reinforcement-learning
12
+ size_categories:
13
+ - 1M<n<10M
14
+ ---
15
+
16
+ # ChessModel-XPU formal teacher dataset
17
+
18
+ Stockfish-18-labeled chess positions used to train the
19
+ [`jinshuoli/chessmodel`](https://huggingface.co/jinshuoli/chessmodel) checkpoint,
20
+ part of the [ChessModel-XPU](https://github.com/JinShuo-Li/ChessModel) project.
21
+
22
+ It is a **custom-format** dataset of bit-packed board tensors plus sparse
23
+ Stockfish-derived policy / WDL targets. It is **not** loadable with
24
+ `datasets.load_dataset(...)`; use the project's `TeacherDataset` loader (see
25
+ below). Game-level train/validation split — adjacent positions from the same game
26
+ are never spread across splits.
27
+
28
+ ## Source and provenance
29
+
30
+ | | |
31
+ |---|---|
32
+ | Source games | [Lichess Elite database, December 2023](https://database.lichess.org/) (`lichess_elite_2023-12`), licensed **CC0 1.0** |
33
+ | Source SHA-256 | `a6a5a8253cf357d31b7b5c1895a63dfbf64cc93b4504398f748cb69a31c0eff0` |
34
+ | Teacher | Stockfish 18 — MultiPV 8, 10000 nodes/position, WDL enabled, temperature 0.15 |
35
+ | Split | Deterministic game-level 90 / 10 split, seed 7, minimum 16 plies per game |
36
+ | Prep script | [`scripts/prepare_formal_pgn.py`](https://github.com/JinShuo-Li/ChessModel/blob/main/scripts/prepare_formal_pgn.py) |
37
+
38
+ Preparation removed parse failures, non-standard start positions, games without a
39
+ decisive/draw result, short games (< 16 plies), and duplicate move sequences, then
40
+ made the deterministic game-level split.
41
+
42
+ ## Contents
43
+
44
+ The dataset mirrors the repository layout, so downloading it into a clone of the
45
+ project makes the workflow commands resolve unchanged:
46
+
47
+ | Path | Description |
48
+ |---|---|
49
+ | `data/formal_1m_train/shard-00000…00244.npz` | 245 training shards |
50
+ | `data/formal_50k_validation/shard-*.npz` | 13 validation shards |
51
+ | `datasets/formal_train.pgn` | Source training PGN (game-level split) |
52
+ | `datasets/formal_validation.pgn` | Source validation PGN (game-level split) |
53
+ | `datasets/formal_pgn_metadata.json` | Provenance metadata (source hash, counts, split params) |
54
+
55
+ Total ≈ 370 MB.
56
+
57
+ ## Statistics
58
+
59
+ From `datasets/formal_pgn_metadata.json`:
60
+
61
+ | | |
62
+ |---|---|
63
+ | Parsed games | 315,135 |
64
+ | Accepted games | 312,603 |
65
+ | Train / validation games | 281,003 / 31,600 |
66
+ | Train / validation positions | 2,971,862 / 334,836 |
67
+ | Validation percent | 10 |
68
+ | Seed | 7 |
69
+
70
+ ## Shard format
71
+
72
+ Each `.npz` shard is a project-defined record containing:
73
+
74
+ - Bit-packed board planes (`112 × 8 × 8`, canonically oriented to the side to move:
75
+ up to 8 history frames, castling rights, en-passant, side to move, halfmove and
76
+ fullmove clocks).
77
+ - Sparse policy target over the AlphaZero `8×8×73 = 4672` move encoding.
78
+ - Win/Draw/Loss target derived from Stockfish WDL.
79
+ - A shard format version, per-shard SHA-256 integrity check, Stockfish/node
80
+ metadata, and the FEN (for legal-move masking and audit).
81
+
82
+ `TeacherDataset` loads each shard's bit-packed boards and sparse targets once and
83
+ unpacks lazily, so the full million-position dataset stays out of resident memory.
84
+
85
+ ## How to load
86
+
87
+ Clone the repo and download the dataset into it, then use the project loader:
88
+
89
+ ```bash
90
+ git clone https://github.com/JinShuo-Li/ChessModel.git
91
+ cd ChessModel
92
+ hf download jinshuoli/chessmodel-data --repo-type dataset --local-dir .
93
+ ```
94
+
95
+ ```python
96
+ from torch.utils.data import DataLoader
97
+ from chess_ai.data.dataset import TeacherDataset
98
+
99
+ train = TeacherDataset("data/formal_1m_train") # 245 shards
100
+ val = TeacherDataset("data/formal_50k_validation") # 13 shards
101
+ loader = DataLoader(train, batch_size=512, shuffle=True)
102
+ ```
103
+
104
+ Verify integrity with the project's verifier:
105
+
106
+ ```bash
107
+ python scripts/verify_teacher_dataset.py --dataset data/formal_1m_train
108
+ python scripts/verify_teacher_dataset.py --dataset data/formal_50k_validation
109
+ ```
110
+
111
+ ## Intended use and limitations
112
+
113
+ - **Intended:** training / evaluating compact neural chess models via Stockfish
114
+ distillation, and reproducing the project's training pipeline.
115
+ - **Custom format:** not consumable by the HF dataset viewer or
116
+ `datasets.load_dataset()`; requires the project's loader.
117
+ - **Labels are Stockfish outputs:** policy/WDL targets reflect Stockfish 18 search
118
+ at the configured node budget, not human game outcomes (game results are used
119
+ only for splitting/filtering).
120
+
121
+ ## License and attribution
122
+
123
+ - Source game data: © Lichess, **CC0 1.0** (public domain).
124
+ - The loading code and preparation scripts are MIT-licensed in the
125
+ [source repository](https://github.com/JinShuo-Li/ChessModel).
126
+ - Stockfish is used solely as a teacher/labeling tool and is **not** distributed
127
+ here.
128
+
129
+ ## Related
130
+
131
+ - Trained checkpoint: [`jinshuoli/chessmodel`](https://huggingface.co/jinshuoli/chessmodel)
132
+ - Source code & documentation: [github.com/JinShuo-Li/ChessModel](https://github.com/JinShuo-Li/ChessModel)