Update README.md
Browse files
README.md
CHANGED
@@ -5,15 +5,6 @@ tags:
|
|
5 |
- stockfish
|
6 |
pretty_name: Lichess Games With Stockfish Analysis
|
7 |
---
|
8 |
-
# Welcome
|
9 |
-
Hello, everyone!
|
10 |
-
<br>
|
11 |
-
I will give you a quick overview of the data format and a guide on how to use the dataset.
|
12 |
-
I always appreciate feedback and discussions. You can speak out [here](https://huggingface.co/datasets/mauricett/lichess_sf/discussions).
|
13 |
-
And now, enjoy...
|
14 |
-
<br>
|
15 |
-
<br>
|
16 |
-
|
17 |
# Condensed Lichess Database
|
18 |
This dataset is a condensed version of the Lichess database.
|
19 |
It only includes games for which Stockfish evaluations were available.
|
@@ -21,37 +12,55 @@ Currently, the dataset contains the entire year 2023, which consists of >100M ga
|
|
21 |
Games are stored in a format that is much faster to process than the original PGN data.
|
22 |
<br>
|
23 |
<br>
|
24 |
-
|
25 |
-
# Requirements
|
26 |
```
|
27 |
pip install zstandard python-chess
|
28 |
```
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
# Quick Quide
|
34 |
-
Using this dataset should be straightforward, but let me give you a quick tour. At the end, you find a complete example script.
|
35 |
|
36 |
### 1. Loading the dataset
|
37 |
-
|
38 |
Note, `trust_remote_code=True` is needed to execute my [custom data loading script](https://huggingface.co/datasets/mauricett/lichess_sf/blob/main/lichess_sf.py), which is necessary to decompress the files.
|
39 |
See [HuggingFace's documentation](https://huggingface.co/docs/datasets/main/en/load_hub#remote-code) if you're unsure.
|
40 |
```py
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
```
|
47 |
<br>
|
48 |
|
49 |
-
|
50 |
-
After loading the dataset, you can
|
51 |
```py
|
52 |
example = next(iter(dataset))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
```
|
54 |
-
A single sample from the dataset contains an entire chess game as a dictionary. The dictionary has the k
|
55 |
|
56 |
|
57 |
### Usage
|
|
|
5 |
- stockfish
|
6 |
pretty_name: Lichess Games With Stockfish Analysis
|
7 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
# Condensed Lichess Database
|
9 |
This dataset is a condensed version of the Lichess database.
|
10 |
It only includes games for which Stockfish evaluations were available.
|
|
|
12 |
Games are stored in a format that is much faster to process than the original PGN data.
|
13 |
<br>
|
14 |
<br>
|
15 |
+
Requirements:
|
|
|
16 |
```
|
17 |
pip install zstandard python-chess
|
18 |
```
|
19 |
|
20 |
+
# Quick Guide
|
21 |
+
In the following I help you understand the data format aswell as using the dataset. At the end, you find a complete example script.
|
|
|
|
|
|
|
22 |
|
23 |
### 1. Loading the dataset
|
24 |
+
You can stream the data without storing it locally (~100 GB currently).
|
25 |
Note, `trust_remote_code=True` is needed to execute my [custom data loading script](https://huggingface.co/datasets/mauricett/lichess_sf/blob/main/lichess_sf.py), which is necessary to decompress the files.
|
26 |
See [HuggingFace's documentation](https://huggingface.co/docs/datasets/main/en/load_hub#remote-code) if you're unsure.
|
27 |
```py
|
28 |
+
# Load dataset.
|
29 |
+
dataset = load_dataset(path="mauricett/lichess_sf",
|
30 |
+
split="train",
|
31 |
+
streaming=True,
|
32 |
+
trust_remote_code=True)
|
33 |
```
|
34 |
<br>
|
35 |
|
36 |
+
### 2. Data Format
|
37 |
+
After loading the dataset, you can check how the samples look like:
|
38 |
```py
|
39 |
example = next(iter(dataset))
|
40 |
+
print(example)
|
41 |
+
```
|
42 |
+
|
43 |
+
A single sample from the dataset contains one complete chess game as a dictionary. The dictionary keys are as follows:
|
44 |
+
|
45 |
+
1. `example['fens']` --- A list of FENs in a slightly stripped format, missing the half-move clock aswell as the fullmove clock (see [definitions on wiki](https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation#Definition))
|
46 |
+
2. `example['moves'] --- A list of moves in [UCI format](https://en.wikipedia.org/wiki/Universal_Chess_Interface). `example['moves'][42]` is the move that led to position `example['fens'][42]`, etc.
|
47 |
+
3. `example['scores'] --- A list of Stockfish evaluations in units of centipawns, stored as strings. If the game ended in a checkmate, stalemate or draw by insufficient material, the last elements of the list is 'C' (checkmate), 'I' (insufficient material) or 'S' (stalemate).
|
48 |
+
4. `example['WhiteElo'], example['BlackElo']` --- Player's Elos.
|
49 |
+
<br>
|
50 |
+
|
51 |
+
The dictionary contains 1) player's Elos, 2) all game positions as FENs, 3) all moves, 4) all Stockfish evaluations and/or the outcome condition.
|
52 |
+
The FENs are slightly stripped. I removed the half-move clock aswell as the fullmove number. See the [definition of FEN](https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation#Definition).
|
53 |
+
```py
|
54 |
+
fens = example['fens']
|
55 |
+
moves = example['moves']
|
56 |
+
scores = example['scores']
|
57 |
+
white_elo = example['WhiteElo']
|
58 |
+
black_elo = example['BlackElo']
|
59 |
+
```
|
60 |
+
Every sample drawn from the dataset will have a different number of FENs, moves and scores, but within a single sample we have
|
61 |
+
```py
|
62 |
+
len(fens) == len(moves) == len(scores) # True
|
63 |
```
|
|
|
64 |
|
65 |
|
66 |
### Usage
|