readmeconfig
Browse files- ChessBot-Dataset.py +22 -2
ChessBot-Dataset.py
CHANGED
@@ -8,12 +8,31 @@ from datasets import (
|
|
8 |
Features,
|
9 |
Value,
|
10 |
Array2D,
|
|
|
|
|
11 |
)
|
12 |
from adversarial_gym.chess_env import ChessEnv
|
13 |
|
14 |
-
class ChessPGNDataset(GeneratorBasedBuilder):
|
15 |
-
VERSION = "0.0.1"
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
def _info(self):
|
18 |
return DatasetInfo(
|
19 |
description="Chess positions + moves + results, streamed from PGN shards",
|
@@ -50,6 +69,7 @@ class ChessPGNDataset(GeneratorBasedBuilder):
|
|
50 |
gen_kwargs={"shards": test_paths},
|
51 |
),
|
52 |
]
|
|
|
53 |
def _generate_examples(self, shards):
|
54 |
import chess.pgn
|
55 |
uid = 0
|
|
|
8 |
Features,
|
9 |
Value,
|
10 |
Array2D,
|
11 |
+
Version,
|
12 |
+
BuilderConfig
|
13 |
)
|
14 |
from adversarial_gym.chess_env import ChessEnv
|
15 |
|
|
|
|
|
16 |
|
17 |
+
class ChessPGNConfig(BuilderConfig):
|
18 |
+
def __init__(self, *, data_files, **kwargs):
|
19 |
+
super().__init__(**kwargs)
|
20 |
+
self.data_files = data_files
|
21 |
+
|
22 |
+
|
23 |
+
class ChessPGNDataset(GeneratorBasedBuilder):
|
24 |
+
BUILDER_CONFIGS = [
|
25 |
+
ChessPGNConfig(
|
26 |
+
name="default",
|
27 |
+
version=Version("0.0.1"),
|
28 |
+
description="Chess positions + moves + results, streamed from PGN shards",
|
29 |
+
data_files={
|
30 |
+
"train": "train/*.pgn",
|
31 |
+
"test": "test/*.pgn",
|
32 |
+
},
|
33 |
+
),
|
34 |
+
]
|
35 |
+
DEFAULT_CONFIG_NAME = "default"
|
36 |
def _info(self):
|
37 |
return DatasetInfo(
|
38 |
description="Chess positions + moves + results, streamed from PGN shards",
|
|
|
69 |
gen_kwargs={"shards": test_paths},
|
70 |
),
|
71 |
]
|
72 |
+
|
73 |
def _generate_examples(self, shards):
|
74 |
import chess.pgn
|
75 |
uid = 0
|