Update README.md
Browse files
README.md
CHANGED
@@ -71,18 +71,19 @@ def score_fn(score):
|
|
71 |
return score
|
72 |
|
73 |
def preprocess(example, tokenizer, score_fn):
|
74 |
-
# Get number of moves made in the game
|
75 |
-
max_ply = len(example['moves'])
|
76 |
-
|
|
|
77 |
|
78 |
-
# Get the FEN
|
79 |
-
fen = example['fens'][
|
80 |
|
81 |
# To get the move that leads to the *next* FEN, we have to add
|
82 |
# +1 to the index. Same with the score, which is the evaluation
|
83 |
# of that move. Please read the section about the data format clearly!
|
84 |
-
move = example['moves'][
|
85 |
-
score = example['scores'][
|
86 |
|
87 |
# Transform data into the format of your choice.
|
88 |
example['fens'] = tokenizer(fen)
|
@@ -130,18 +131,19 @@ def score_fn(score):
|
|
130 |
return score
|
131 |
|
132 |
def preprocess(example, tokenizer, score_fn):
|
133 |
-
# Get number of moves made in the game
|
134 |
-
max_ply = len(example['moves'])
|
135 |
-
|
|
|
136 |
|
137 |
-
# Get the FEN
|
138 |
-
fen = example['fens'][
|
139 |
|
140 |
# To get the move that leads to the *next* FEN, we have to add
|
141 |
# +1 to the index. Same with the score, which is the evaluation
|
142 |
# of that move. Please read the section about the data format clearly!
|
143 |
-
move = example['moves'][
|
144 |
-
score = example['scores'][
|
145 |
|
146 |
# Transform data into the format of your choice.
|
147 |
example['fens'] = tokenizer(fen)
|
|
|
71 |
return score
|
72 |
|
73 |
def preprocess(example, tokenizer, score_fn):
|
74 |
+
# Get number of moves made in the game...
|
75 |
+
max_ply = len(example['moves'])
|
76 |
+
# ...and pick a position at random.
|
77 |
+
random_position = random.randint(0, max_ply-2)
|
78 |
|
79 |
+
# Get the FEN of our random choice.
|
80 |
+
fen = example['fens'][random_position]
|
81 |
|
82 |
# To get the move that leads to the *next* FEN, we have to add
|
83 |
# +1 to the index. Same with the score, which is the evaluation
|
84 |
# of that move. Please read the section about the data format clearly!
|
85 |
+
move = example['moves'][random_position + 1]
|
86 |
+
score = example['scores'][random_position + 1]
|
87 |
|
88 |
# Transform data into the format of your choice.
|
89 |
example['fens'] = tokenizer(fen)
|
|
|
131 |
return score
|
132 |
|
133 |
def preprocess(example, tokenizer, score_fn):
|
134 |
+
# Get number of moves made in the game...
|
135 |
+
max_ply = len(example['moves'])
|
136 |
+
# ...and pick a position at random.
|
137 |
+
random_position = random.randint(0, max_ply-2)
|
138 |
|
139 |
+
# Get the FEN of our random choice.
|
140 |
+
fen = example['fens'][random_position]
|
141 |
|
142 |
# To get the move that leads to the *next* FEN, we have to add
|
143 |
# +1 to the index. Same with the score, which is the evaluation
|
144 |
# of that move. Please read the section about the data format clearly!
|
145 |
+
move = example['moves'][random_position + 1]
|
146 |
+
score = example['scores'][random_position + 1]
|
147 |
|
148 |
# Transform data into the format of your choice.
|
149 |
example['fens'] = tokenizer(fen)
|