mauricett commited on
Commit
abb4956
·
verified ·
1 Parent(s): 607d444

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -8
README.md CHANGED
@@ -73,12 +73,16 @@ def score_fn(score):
73
  def preprocess(example, tokenizer, score_fn):
74
  # Get number of moves made in the game.
75
  max_ply = len(example['moves'])
76
- pick_random_move = random.randint(0, max_ply-1)
77
 
78
  # Get the FEN, move and score for our random choice.
79
  fen = example['fens'][pick_random_move]
80
- move = example['moves'][pick_random_move]
81
- score = example['scores'][pick_random_move]
 
 
 
 
82
 
83
  # Transform data into the format of your choice.
84
  example['fens'] = tokenizer(fen)
@@ -132,8 +136,12 @@ def preprocess(example, tokenizer, score_fn):
132
 
133
  # Get the FEN, move and score for our random choice.
134
  fen = example['fens'][pick_random_move]
135
- move = example['moves'][pick_random_move]
136
- score = example['scores'][pick_random_move]
 
 
 
 
137
 
138
  # Transform data into the format of your choice.
139
  example['fens'] = tokenizer(fen)
@@ -159,12 +167,9 @@ dataset = dataset.map(preprocess, fn_kwargs={'tokenizer': tokenizer,
159
  # PyTorch dataloader
160
  dataloader = DataLoader(dataset, batch_size=1, num_workers=1)
161
 
162
-
163
  n = 0
164
  for batch in dataloader:
165
-
166
  # do stuff
167
-
168
  print(batch)
169
  break
170
 
 
73
  def preprocess(example, tokenizer, score_fn):
74
  # Get number of moves made in the game.
75
  max_ply = len(example['moves'])
76
+ pick_random_move = random.randint(0, max_ply-2)
77
 
78
  # Get the FEN, move and score for our random choice.
79
  fen = example['fens'][pick_random_move]
80
+
81
+ # We add +1 to the index to select the next candidate move.
82
+ # Same with the score, which is the evaluation of this move.
83
+ # Please read the section about the data format clearly!
84
+ move = example['moves'][pick_random_move + 1]
85
+ score = example['scores'][pick_random_move + 1]
86
 
87
  # Transform data into the format of your choice.
88
  example['fens'] = tokenizer(fen)
 
136
 
137
  # Get the FEN, move and score for our random choice.
138
  fen = example['fens'][pick_random_move]
139
+
140
+ # We add +1 to the index to select the next candidate move.
141
+ # Same with the score, which is the evaluation of this move.
142
+ # Please read the section about the data format clearly!
143
+ move = example['moves'][pick_random_move + 1]
144
+ score = example['scores'][pick_random_move + 1]
145
 
146
  # Transform data into the format of your choice.
147
  example['fens'] = tokenizer(fen)
 
167
  # PyTorch dataloader
168
  dataloader = DataLoader(dataset, batch_size=1, num_workers=1)
169
 
 
170
  n = 0
171
  for batch in dataloader:
 
172
  # do stuff
 
173
  print(batch)
174
  break
175