stockfish-debug / README.md
Xmaster6y's picture
Update README.md
fc09e0c verified
---
license: mit
source_datasets:
- BlueSunflower/chess_games_base
configs:
- config_name: default
data_files:
- split: train
path: "train.jsonl"
- split: test
path: "test.jsonl"
dataset_info:
features:
- name: fen
dtype: string
- name: move
dtype: string
- name: result
dtype: string
---
# Dataset Card for stockfish-debug
See my [blog post](https://yp-edu.github.io/projects/training-gpt2-on-stockfish-games) for additional details.
## Columns
The datase contain the following columns:
- **fen:** The FEN string of the board.
- **move:** The move that was played.
- **result:** The result of the game (with `"-"` for unfinished games).
## Data details
Pre-processing of the Stockfish games provided by [BlueSunflower/chess_games_base](https://huggingface.co/datasets/BlueSunflower/chess_games_base).
Code used:
```python
import jsonlines
import chess
import tqdm
def preprocess_games(in_path, out_path):
with jsonlines.open(in_path) as reader:
with jsonlines.open(out_path, "w") as writer:
for obj in tqdm.tqdm(reader):
state_action = []
parsed_moves = [m for m in obj["moves"].split() if not m.endswith(".")]
board = chess.Board()
for m in parsed_moves:
fen = board.fen()
move = board.push_san(m)
state_action.append({"fen": fen, "move":move.uci()})
outcome = board.outcome()
if outcome is None:
result = "-"
else:
result = outcome.result()
writer.write_all([
{**sa, "result":result} for sa in state_action
])
```
## Use the Dataset
Using basic `dataset` code:
```python
from datasets import load_dataset
dataset = load_dataset("yp-edu/stockfish-debug")
```