Update selfchess.py
Browse files- selfchess.py +6 -3
selfchess.py
CHANGED
|
@@ -204,9 +204,12 @@ def main():
|
|
| 204 |
print(f"Saving backup model to {CONFIG['backup_model_path']}")
|
| 205 |
torch.save(model.state_dict(), CONFIG["backup_model_path"])
|
| 206 |
with mp.Pool(processes=num_instances) as pool:
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
|
|
|
|
|
|
|
|
|
| 210 |
for batch in results:
|
| 211 |
data, c, mc = batch
|
| 212 |
print(f"Saving backup model to {CONFIG['backup_model_path']}")
|
|
|
|
| 204 |
print(f"Saving backup model to {CONFIG['backup_model_path']}")
|
| 205 |
torch.save(model.state_dict(), CONFIG["backup_model_path"])
|
| 206 |
with mp.Pool(processes=num_instances) as pool:
|
| 207 |
+
results_self = pool.starmap(game_gen, [(None,) for _ in range(num_games // 3)])
|
| 208 |
+
results_white = pool.starmap(game_gen, [(chess.WHITE,) for _ in range(num_games // 3)])
|
| 209 |
+
results_black = pool.starmap(game_gen, [(chess.BLACK,) for _ in range(num_games // 3)])
|
| 210 |
+
results = []
|
| 211 |
+
for s, w, b in zip(results_self, results_white, results_black):
|
| 212 |
+
results.extend([s, w, b])
|
| 213 |
for batch in results:
|
| 214 |
data, c, mc = batch
|
| 215 |
print(f"Saving backup model to {CONFIG['backup_model_path']}")
|