mauricett commited on
Commit
d28e7c4
1 Parent(s): 1f359f5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +11 -7
README.md CHANGED
@@ -16,11 +16,12 @@ Requirements:
16
  ```
17
  pip install zstandard python-chess datasets
18
  ```
 
19
 
20
  # Quick Guide
21
  In the following, I explain the data format and how to use 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). The dataset requires `trust_remote_code=True` to execute the [custom data loading script](https://huggingface.co/datasets/mauricett/lichess_sf/blob/main/lichess_sf.py), which is necessary to decompress the files.
25
  See [HuggingFace's documentation](https://huggingface.co/docs/datasets/main/en/load_hub#remote-code) if you're unsure.
26
  ```py
@@ -48,21 +49,23 @@ A single sample from the dataset contains one complete chess game as a dictionar
48
  <br>
49
 
50
  Everything but Elos is stored as strings.
 
51
 
52
- ### 3. Shuffle and preprocess
53
  Use `datasets.shuffle()` to properly shuffle the dataset. Use `datasets.map()` to transform the data to the format you require. This will process individual samples in parallel if you're using multiprocessing (e.g. with PyTorch dataloader).
54
 
55
 
56
  ```py
57
  # Shuffle and apply your own preprocessing.
58
  dataset = dataset.shuffle(seed=42)
59
- dataset = dataset.map(preprocess, fn_kwargs={'useful_fn': useful_fn})
60
  ```
61
 
62
- For a quick working example, you can try to use the following functions:
63
  ```py
64
- def useful_fn(example):
65
- return example
 
66
 
67
  def preprocess(example, useful_fn):
68
  # Get number of moves made in the game.
@@ -79,4 +82,5 @@ def preprocess(example, useful_fn):
79
  example['moves'] = useful_fn(move)
80
  example['scores'] = useful_fn(score)
81
  return example
82
- ```
 
 
16
  ```
17
  pip install zstandard python-chess datasets
18
  ```
19
+ <br>
20
 
21
  # Quick Guide
22
  In the following, I explain the data format and how to use the dataset. At the end, you find a complete example script.
23
 
24
+ ### 1. Loading The Dataset
25
  You can stream the data without storing it locally (~100 GB currently). The dataset requires `trust_remote_code=True` to execute the [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
 
49
  <br>
50
 
51
  Everything but Elos is stored as strings.
52
+ <br>
53
 
54
+ ### 3. Shuffle And Preprocess
55
  Use `datasets.shuffle()` to properly shuffle the dataset. Use `datasets.map()` to transform the data to the format you require. This will process individual samples in parallel if you're using multiprocessing (e.g. with PyTorch dataloader).
56
 
57
 
58
  ```py
59
  # Shuffle and apply your own preprocessing.
60
  dataset = dataset.shuffle(seed=42)
61
+ dataset = dataset.map(preprocess, fn_kwargs={'tokenizer': tokenizer})
62
  ```
63
 
64
+ For a quick working example, you can try to use the following:
65
  ```py
66
+ class Tokenizer:
67
+ def __call__(self, example):
68
+ return example
69
 
70
  def preprocess(example, useful_fn):
71
  # Get number of moves made in the game.
 
82
  example['moves'] = useful_fn(move)
83
  example['scores'] = useful_fn(score)
84
  return example
85
+ ```
86
+ <br>