mauricett commited on
Commit
4050552
·
verified ·
1 Parent(s): fe5d85e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +41 -0
README.md CHANGED
@@ -13,6 +13,47 @@ This dataset is a condensed version of the Lichess database.
13
  It only includes games for which Stockfish evaluations were available, and it does not include game headers.
14
  The resulting files are much smaller and faster to parse.
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  # Data Format
17
  Every position of every game either has a Stockfish evaluation or an outcome condition that is either checkmate, stalemate or insufficient material.
18
  All other outcome conditions have been excluded from the data.
 
13
  It only includes games for which Stockfish evaluations were available, and it does not include game headers.
14
  The resulting files are much smaller and faster to parse.
15
 
16
+ # Quick guide
17
+ Hello there! Using this dataset should be straightforward, but let me give you a quick tour.
18
+
19
+ ### Usage
20
+ To use the dataset, apply `datasets.shuffle()` and your own transformations (e.g. tokenizer) using `datasets.map()`. The latter will process individual samples in parallel if you're using multiprocessing (e.g. with PyTorch dataloader).
21
+
22
+
23
+ ```py
24
+ # Load dataset.
25
+ dataset = load_dataset(path="../FishData/lichess_sf_test.py",
26
+ split="train",
27
+ streaming=True,
28
+ trust_remote_code=True)
29
+
30
+ # Shuffle and apply your own preprocessing.
31
+ dataset = dataset.shuffle(seed=42)
32
+ dataset = dataset.map(preprocess, fn_kwargs={'useful_fn': useful_fn})
33
+ ```
34
+
35
+ For a quick working example, you can try to use the following functions:
36
+ ```py
37
+ def preprocess(example, useful_fn):
38
+ # Get number of moves made in the game.
39
+ max_ply = len(example['moves'])
40
+ pick_random_move = random.randint(0, max_ply)
41
+
42
+ # Get the FEN, move and score for our random choice.
43
+ fen = example['fens'][pick_random_move]
44
+ move = example['moves'][pick_random_move]
45
+ score = example['scores'][pick_random_move]
46
+
47
+ # Transform data into the format of your choice.
48
+ example['fens'] = useful_fn(fen)
49
+ example['moves'] = useful_fn(move)
50
+ example['scores'] = useful_fn(score)
51
+ return example
52
+
53
+ def useful_fn(example):
54
+ return example
55
+ ```
56
+
57
  # Data Format
58
  Every position of every game either has a Stockfish evaluation or an outcome condition that is either checkmate, stalemate or insufficient material.
59
  All other outcome conditions have been excluded from the data.