mauricett commited on
Commit
d86e86c
·
verified ·
1 Parent(s): 4b2a6f3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -44
README.md CHANGED
@@ -34,12 +34,6 @@ dataset = load_dataset(path="mauricett/lichess_sf",
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 halfmove clock and fullmove number (see [definitions on wiki](https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation#Definition)). The starting positions have been excluded (no player made a move yet).
@@ -98,39 +92,6 @@ dataset = dataset.shuffle(seed=42)
98
  dataset = dataset.map(preprocess, fn_kwargs={'tokenizer': tokenizer,
99
  'score_fn': score_fn})
100
  ```
101
-
102
- In this example, we're passing two additional arguments to the preprocess function in dataset.map(). You can use the following mock examples for inspiration:
103
- ```py
104
- # A mock tokenizer and functions for demonstration.
105
- class Tokenizer:
106
- def __init__(self):
107
- pass
108
- def __call__(self, example):
109
- return example
110
-
111
-
112
- # Transform Stockfish score and terminal outcomes.
113
- def score_fn(score):
114
- return score
115
-
116
- def preprocess(example, tokenizer, score_fn):
117
- # Get number of moves made in the game.
118
- max_ply = len(example['moves'])
119
- pick_random_move = random.randint(0, max_ply-1)
120
-
121
- # Get the FEN, move and score for our random choice.
122
- fen = example['fens'][pick_random_move]
123
- move = example['moves'][pick_random_move]
124
- score = example['scores'][pick_random_move]
125
-
126
- # Transform data into the format of your choice.
127
- example['fens'] = tokenizer(fen)
128
- example['moves'] = tokenizer(move)
129
- example['scores'] = score_fn(score)
130
- return example
131
-
132
- tokenizer = Tokenizer()
133
- ```
134
  <br>
135
  <br>
136
  <br>
@@ -188,7 +149,7 @@ dataset = dataset.map(preprocess, fn_kwargs={'tokenizer': tokenizer,
188
  'score_fn': score_fn})
189
 
190
  # PyTorch dataloader
191
- dataloader = DataLoader(dataset, batch_size=256, num_workers=4)
192
 
193
 
194
  n = 0
@@ -196,8 +157,6 @@ for batch in dataloader:
196
 
197
  # do stuff
198
 
199
- n += 1
200
- print(n)
201
- if n == 50:
202
- break
203
  ```
 
34
  <br>
35
 
36
  ### 2. Data Format
 
 
 
 
 
 
37
  A single sample from the dataset contains one complete chess game as a dictionary. The dictionary keys are as follows:
38
 
39
  1. `example['fens']` --- A list of FENs in a slightly stripped format, missing the halfmove clock and fullmove number (see [definitions on wiki](https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation#Definition)). The starting positions have been excluded (no player made a move yet).
 
92
  dataset = dataset.map(preprocess, fn_kwargs={'tokenizer': tokenizer,
93
  'score_fn': score_fn})
94
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  <br>
96
  <br>
97
  <br>
 
149
  'score_fn': score_fn})
150
 
151
  # PyTorch dataloader
152
+ dataloader = DataLoader(dataset, batch_size=1, num_workers=1)
153
 
154
 
155
  n = 0
 
157
 
158
  # do stuff
159
 
160
+ print(batch)
161
+ break
 
 
162
  ```