VreVre commited on
Commit
83c9d17
·
verified ·
1 Parent(s): 6f32839

Chess Challenge submission by VreVre

Browse files
Files changed (7) hide show
  1. README.md +26 -0
  2. config.json +20 -0
  3. model.safetensors +3 -0
  4. special_tokens_map.json +6 -0
  5. tokenizer.py +513 -0
  6. tokenizer_config.json +50 -0
  7. vocab.json +142 -0
README.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ tags:
4
+ - chess
5
+ - llm-course
6
+ - chess-challenge
7
+ license: mit
8
+ ---
9
+
10
+ # chess_vre_2
11
+
12
+ Chess model submitted to the LLM Course Chess Challenge.
13
+
14
+ ## Submission Info
15
+
16
+ - **Submitted by**: [VreVre](https://huggingface.co/VreVre)
17
+ - **Parameters**: 951,240
18
+ - **Organization**: LLM-course
19
+
20
+ ## Model Details
21
+
22
+ - **Architecture**: Chess Transformer (GPT-style)
23
+ - **Vocab size**: 141
24
+ - **Embedding dim**: 120
25
+ - **Layers**: 6
26
+ - **Heads**: 4
config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ChessForCausalLM"
4
+ ],
5
+ "bos_token_id": 1,
6
+ "dropout": 0.1,
7
+ "dtype": "float32",
8
+ "eos_token_id": 2,
9
+ "layer_norm_epsilon": 1e-05,
10
+ "model_type": "chess_transformer",
11
+ "n_ctx": 512,
12
+ "n_embd": 120,
13
+ "n_head": 4,
14
+ "n_inner": 360,
15
+ "n_layer": 6,
16
+ "pad_token_id": 0,
17
+ "tie_weights": true,
18
+ "transformers_version": "4.57.6",
19
+ "vocab_size": 141
20
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d10c4be25770a4d0962e66813bab9c62b77480bdda920c4f697a8a0ec6b2639
3
+ size 3811400
special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "[BOS]",
3
+ "eos_token": "[EOS]",
4
+ "pad_token": "[PAD]",
5
+ "unk_token": "[UNK]"
6
+ }
tokenizer.py ADDED
@@ -0,0 +1,513 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Custom Chess Tokenizer for the Chess Challenge.
3
+
4
+ This tokenizer treats each move as a single token using the extended UCI notation
5
+ from the Lichess dataset (e.g., WPe2e4, BNg8f6).
6
+
7
+ The dataset format uses:
8
+ - W/B prefix for White/Black
9
+ - Piece letter: P=Pawn, N=Knight, B=Bishop, R=Rook, Q=Queen, K=King
10
+ - Source and destination squares (e.g., e2e4)
11
+ - Special suffixes: (x)=capture, (+)=check, (+*)=checkmate, (o)/(O)=castling
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import os
18
+ from pathlib import Path
19
+ from typing import Dict, List, Optional
20
+
21
+ from transformers import PreTrainedTokenizer
22
+
23
+ import re
24
+
25
+ class ChessTokenizer(PreTrainedTokenizer):
26
+ """
27
+ A custom tokenizer for chess moves using extended UCI notation.
28
+
29
+ This tokenizer maps each possible chess move to a unique token ID.
30
+ The vocabulary is built from the training dataset to ensure all moves
31
+ encountered during training have a corresponding token.
32
+
33
+ Example:
34
+ >>> tokenizer = ChessTokenizer()
35
+ >>> tokenizer.encode("WPe2e4 BPe7e5")
36
+ [1, 42, 87, 2] # [BOS, e2e4, e7e5, EOS]
37
+ """
38
+
39
+ model_input_names = ["input_ids", "attention_mask"]
40
+ vocab_files_names = {"vocab_file": "vocab.json"}
41
+
42
+ # Special tokens
43
+ PAD_TOKEN = "[PAD]"
44
+ BOS_TOKEN = "[BOS]"
45
+ EOS_TOKEN = "[EOS]"
46
+ UNK_TOKEN = "[UNK]"
47
+ EOM_TOKEN = "EOM" # End of Move token
48
+
49
+ MOVE_REGEX = re.compile(
50
+ r"""
51
+ (?P<color>[WB])
52
+ (?P<piece>[PNBRQK])
53
+ (?P<from>[a-h][1-8])
54
+ (?P<capture>x)?
55
+ (?P<to>[a-h][1-8])
56
+ (?P<promotion>[QRBN])?
57
+ (?P<check>[+#])?
58
+ """,
59
+ re.VERBOSE,
60
+ )
61
+ def __init__(
62
+ self,
63
+ vocab_file: Optional[str] = None,
64
+ vocab: Optional[Dict[str, int]] = None,
65
+ **kwargs,
66
+ ):
67
+ """
68
+ Initialize the chess tokenizer.
69
+
70
+ Args:
71
+ vocab_file: Path to a JSON file containing the vocabulary mapping.
72
+ vocab: Dictionary mapping tokens to IDs (alternative to vocab_file).
73
+ **kwargs: Additional arguments passed to PreTrainedTokenizer.
74
+ """
75
+ # Initialize special tokens
76
+ self._pad_token = self.PAD_TOKEN
77
+ self._bos_token = self.BOS_TOKEN
78
+ self._eos_token = self.EOS_TOKEN
79
+ self._unk_token = self.UNK_TOKEN
80
+
81
+
82
+ # Remove any duplicate special-token entries passed through kwargs
83
+ # to avoid "multiple values for keyword" errors when loading from disk.
84
+ kwargs.pop("pad_token", None)
85
+ kwargs.pop("bos_token", None)
86
+ kwargs.pop("eos_token", None)
87
+ kwargs.pop("unk_token", None)
88
+
89
+ # Load or create vocabulary
90
+ if vocab is not None:
91
+ self._vocab = vocab
92
+ elif vocab_file is not None and os.path.exists(vocab_file):
93
+ with open(vocab_file, "r", encoding="utf-8") as f:
94
+ self._vocab = json.load(f)
95
+ else:
96
+ # Create a minimal vocabulary with just special tokens
97
+ # The full vocabulary should be built from the dataset
98
+ self._vocab = self._create_default_vocab()
99
+
100
+ # Create reverse mapping
101
+ self._ids_to_tokens = {v: k for k, v in self._vocab.items()}
102
+
103
+ # Call parent init AFTER setting up vocab
104
+ super().__init__(
105
+ pad_token=self._pad_token,
106
+ bos_token=self._bos_token,
107
+ eos_token=self._eos_token,
108
+ unk_token=self._unk_token,
109
+ **kwargs,
110
+ )
111
+
112
+ def _create_default_vocab(self) -> Dict[str, int]:
113
+ """
114
+ Create a minimal default vocabulary with just special tokens.
115
+
116
+ For the full vocabulary, use `build_vocab_from_dataset()`.
117
+ This minimal vocab is just a placeholder - you should build from data.
118
+ """
119
+ special_tokens = [self.PAD_TOKEN, self.BOS_TOKEN, self.EOS_TOKEN, self.UNK_TOKEN]
120
+ vocab = {token: idx for idx, token in enumerate(special_tokens)}
121
+ return vocab
122
+
123
+ @classmethod
124
+ def build_vocab_from_iterator(
125
+ cls,
126
+ iterator,
127
+ min_frequency: int = 1,
128
+ ) -> "ChessTokenizer":
129
+ """
130
+ Build a tokenizer vocabulary from an iterator of game strings.
131
+
132
+ Args:
133
+ iterator: An iterator yielding game strings (space-separated moves).
134
+ min_frequency: Minimum frequency for a token to be included.
135
+
136
+ Returns:
137
+ A ChessTokenizer with the built vocabulary.
138
+ """
139
+ from collections import Counter
140
+
141
+ token_counts = Counter()
142
+
143
+ for game in iterator:
144
+ moves = game.strip().split()
145
+ token_counts.update(moves)
146
+
147
+ # Filter by frequency
148
+ tokens = [
149
+ token for token, count in token_counts.items()
150
+ if count >= min_frequency
151
+ ]
152
+
153
+ # Sort for reproducibility
154
+ tokens = sorted(tokens)
155
+
156
+ # Build vocabulary
157
+ special_tokens = [cls.PAD_TOKEN, cls.BOS_TOKEN, cls.EOS_TOKEN, cls.UNK_TOKEN]
158
+ vocab = {token: idx for idx, token in enumerate(special_tokens + tokens)}
159
+
160
+ return cls(vocab=vocab)
161
+
162
+
163
+ @classmethod
164
+ def build_vocab_from_iterator_bis(
165
+ cls,
166
+ iterator,
167
+ min_frequency: int = 1,
168
+ ) -> "ChessTokenizer":
169
+ from collections import Counter
170
+ import re
171
+
172
+ MOVE_REGEX = re.compile(
173
+ r"""
174
+ (?P<color>[WB])
175
+ (?P<piece>[PNBRQK])
176
+ (?P<from>[a-h][1-8])
177
+ (?P<capture>x)?
178
+ (?P<to>[a-h][1-8])
179
+ (?P<promotion>[QRBN])?
180
+ (?P<check>[+#])?
181
+ """,
182
+ re.VERBOSE,
183
+ )
184
+
185
+ token_counts = Counter()
186
+
187
+ for game in iterator:
188
+ moves = game.strip().split()
189
+
190
+ for move in moves:
191
+ # --- Castling ---
192
+ if move in ("WKe1g1", "BKe8g8"):
193
+ token_counts.update(["W", "K", "CASTLE_K_EOM"])
194
+ continue
195
+
196
+ if move in ("WKe1c1", "BKe8c8"):
197
+ token_counts.update(["W", "K", "CASTLE_Q_EOM"])
198
+ continue
199
+
200
+ m = MOVE_REGEX.fullmatch(move)
201
+ if not m:
202
+ token_counts.update([cls.UNK_TOKEN])
203
+ continue
204
+
205
+ # Color + piece
206
+ token_counts.update([
207
+ m["color"],
208
+ m["piece"],
209
+ f"FROM_{m['from']}",
210
+ ])
211
+
212
+ if m["capture"]:
213
+ token_counts.update(["CAP"])
214
+
215
+ # --- TO = FIN DE COUP ---
216
+ to_tok = f"TO_{m['to']}"
217
+
218
+ if m["promotion"]:
219
+ to_tok += f"_PROM_{m['promotion']}"
220
+
221
+ if m["check"] == "+":
222
+ to_tok += "_CHECK"
223
+ elif m["check"] == "#":
224
+ to_tok += "_MATE"
225
+
226
+ to_tok += "_EOM"
227
+
228
+ token_counts.update([to_tok])
229
+
230
+ tokens = [tok for tok, c in token_counts.items() if c >= min_frequency]
231
+ tokens = tokens + ["EOM"]
232
+ tokens = sorted(tokens)
233
+
234
+ special_tokens = [
235
+ cls.PAD_TOKEN,
236
+ cls.BOS_TOKEN,
237
+ cls.EOS_TOKEN,
238
+ cls.UNK_TOKEN,
239
+ ]
240
+
241
+ vocab = {tok: i for i, tok in enumerate(special_tokens + tokens)}
242
+ return cls(vocab=vocab)
243
+
244
+ @classmethod
245
+ def build_vocab_from_dataset(
246
+ cls,
247
+ dataset_name: str = "dlouapre/lichess_2025-01_1M",
248
+ split: str = "train",
249
+ column: str = "text",
250
+ min_frequency: int = 500,
251
+ max_samples: Optional[int] = 100000,
252
+ ) -> "ChessTokenizer":
253
+ """
254
+ Build a tokenizer vocabulary from a Hugging Face dataset.
255
+
256
+ Args:
257
+ dataset_name: Name of the dataset on Hugging Face Hub.
258
+ split: Dataset split to use.
259
+ column: Column containing the game strings.
260
+ min_frequency: Minimum frequency for a token to be included (default: 500).
261
+ max_samples: Maximum number of samples to process (default: 100k).
262
+
263
+ Returns:
264
+ A ChessTokenizer with the built vocabulary.
265
+ """
266
+ from datasets import load_dataset
267
+
268
+ dataset = load_dataset(dataset_name, split=split)
269
+
270
+ if max_samples is not None:
271
+ dataset = dataset.select(range(min(max_samples, len(dataset))))
272
+
273
+ def game_iterator():
274
+ for example in dataset:
275
+ yield example[column]
276
+
277
+ return cls.build_vocab_from_iterator_bis(game_iterator(), min_frequency=min_frequency)
278
+
279
+ @property
280
+ def vocab_size(self) -> int:
281
+ """Return the size of the vocabulary."""
282
+ return max(self._vocab.values()) + 1
283
+
284
+ def get_vocab(self) -> Dict[str, int]:
285
+ """Return the vocabulary as a dictionary."""
286
+ return dict(self._vocab)
287
+
288
+ def _tokenize_move(self, text: str) -> List[str]:
289
+ tokens = []
290
+
291
+ for move in text.strip().split():
292
+ m = self.MOVE_REGEX.fullmatch(move)
293
+ if not m:
294
+ tokens.append(self.UNK_TOKEN)
295
+ continue
296
+
297
+ tokens.append(m["color"])
298
+ tokens.append(m["piece"])
299
+ tokens.append(f"FROM_{m['from']}")
300
+ tokens.append(f"TO_{m['to']}")
301
+
302
+ if m["capture"]:
303
+ tokens.append("CAP")
304
+ if m["promotion"]:
305
+ tokens.append(f"PROM_{m['promotion']}")
306
+ if m["check"] == "+":
307
+ tokens.append("CHECK")
308
+ elif m["check"] == "#":
309
+ tokens.append("MATE")
310
+
311
+ return tokens
312
+
313
+ def _tokenize(self, text: str) -> List[str]:
314
+ """
315
+ Convert a game string into subword tokens.
316
+ Example:
317
+ "WPe2e4 BNg8f6" ->
318
+ ["W","P","FROM_e2","TO_e4_EOM","B","N","FROM_g8","TO_f6_EOM"]
319
+ """
320
+ tokens: List[str] = []
321
+
322
+ MOVE_REGEX = re.compile(
323
+ r"""
324
+ (?P<color>[WB])
325
+ (?P<piece>[PNBRQK])
326
+ (?P<from>[a-h][1-8])
327
+ (?P<capture>x)?
328
+ (?P<to>[a-h][1-8])
329
+ (?P<promotion>[QRBN])?
330
+ (?P<check>[+#])?
331
+ """,
332
+ re.VERBOSE,
333
+ )
334
+
335
+ moves = text.split()
336
+
337
+ for move in moves:
338
+ # --- Castling ---
339
+ if move in ("WKe1g1", "BKe8g8"):
340
+ tokens.extend(["W", "K", "CASTLE_K_EOM", "EOM"])
341
+ continue
342
+
343
+ if move in ("WKe1c1", "BKe8c8"):
344
+ tokens.extend(["W", "K", "CASTLE_Q_EOM", "EOM"])
345
+ continue
346
+
347
+ m = MOVE_REGEX.fullmatch(move)
348
+ if not m:
349
+ tokens.append(self.UNK_TOKEN)
350
+ continue
351
+
352
+ # Color & piece
353
+ tokens.append(m["color"])
354
+ tokens.append(m["piece"])
355
+ tokens.append(f"FROM_{m['from']}")
356
+
357
+ if m["capture"]:
358
+ tokens.append("CAP")
359
+
360
+ # --- TO + FLAGS + EOM ---
361
+ to_tok = f"TO_{m['to']}"
362
+
363
+ if m["promotion"]:
364
+ to_tok += f"_PROM_{m['promotion']}"
365
+
366
+ if m["check"] == "+":
367
+ to_tok += "_CHECK"
368
+ elif m["check"] == "#":
369
+ to_tok += "_MATE"
370
+
371
+ to_tok += "_EOM"
372
+
373
+ tokens.append(to_tok)
374
+ if to_tok.endswith("_EOM"):
375
+ tokens.append("EOM")
376
+
377
+ return tokens
378
+
379
+
380
+ def _convert_token_to_id(self, token: str) -> int:
381
+ """Convert a token to its ID."""
382
+ return self._vocab.get(token, self._vocab.get(self.UNK_TOKEN, 0))
383
+
384
+ def _convert_id_to_token(self, index: int) -> str:
385
+ """Convert an ID to its token."""
386
+ return self._ids_to_tokens.get(index, self.UNK_TOKEN)
387
+
388
+ def convert_tokens_to_string(self, tokens: List[str]) -> str:
389
+ special = {
390
+ self.PAD_TOKEN,
391
+ self.BOS_TOKEN,
392
+ self.EOS_TOKEN,
393
+ self.UNK_TOKEN,
394
+ }
395
+
396
+ moves = []
397
+ current = []
398
+
399
+ for tok in tokens:
400
+ if tok in special:
401
+ continue
402
+
403
+ if tok == "EOM":
404
+ moves.append("".join(current) + " ")
405
+ current = []
406
+ continue
407
+
408
+ if tok == "W" or tok == "B":
409
+ current.append(tok)
410
+
411
+ elif tok in {"P","N","B","R","Q","K"}:
412
+ current.append(tok)
413
+
414
+ elif tok.startswith("FROM_"):
415
+ current.append(tok[5:]) # e2
416
+
417
+ elif tok == "CAP":
418
+ current.append("x")
419
+
420
+ elif tok.startswith("TO_"):
421
+ body = tok[3:]
422
+
423
+ # Split flags
424
+ parts = body.split("_")
425
+ square = parts[0]
426
+ current.append(square)
427
+
428
+ for p in parts[1:]:
429
+ if p == "PROM":
430
+ continue
431
+ elif p in {"Q","R","B","N"}:
432
+ current.append(p)
433
+ elif p == "CHECK":
434
+ current.append("+")
435
+ elif p == "MATE":
436
+ current.append("#")
437
+
438
+ elif tok.startswith("CASTLE"):
439
+ if tok == "CASTLE_K_EOM":
440
+ moves.append("O-O ")
441
+ elif tok == "CASTLE_Q_EOM":
442
+ moves.append("O-O-O ")
443
+ current = []
444
+
445
+
446
+ moves.append("".join(current))
447
+
448
+ return "".join(moves)
449
+
450
+
451
+
452
+ def save_vocabulary(
453
+ self,
454
+ save_directory: str,
455
+ filename_prefix: Optional[str] = None,
456
+ ) -> tuple:
457
+ """
458
+ Save the vocabulary to a JSON file.
459
+
460
+ Args:
461
+ save_directory: Directory to save the vocabulary.
462
+ filename_prefix: Optional prefix for the filename.
463
+
464
+ Returns:
465
+ Tuple containing the path to the saved vocabulary file.
466
+ """
467
+ if not os.path.isdir(save_directory):
468
+ os.makedirs(save_directory, exist_ok=True)
469
+
470
+ vocab_file = os.path.join(
471
+ save_directory,
472
+ (filename_prefix + "-" if filename_prefix else "") + "vocab.json",
473
+ )
474
+
475
+ with open(vocab_file, "w", encoding="utf-8") as f:
476
+ json.dump(self._vocab, f, ensure_ascii=False, indent=2)
477
+
478
+ return (vocab_file,)
479
+
480
+
481
+ def count_vocab_from_dataset(
482
+ dataset_name: str = "dlouapre/lichess_2025-01_1M",
483
+ split: str = "train",
484
+ column: str = "text",
485
+ max_samples: Optional[int] = 10000,
486
+ ) -> Dict[str, int]:
487
+ """
488
+ Count token frequencies in a dataset (useful for vocabulary analysis).
489
+
490
+ Args:
491
+ dataset_name: Name of the dataset on Hugging Face Hub.
492
+ split: Dataset split to use.
493
+ column: Column containing the game strings.
494
+ max_samples: Maximum number of samples to process.
495
+
496
+ Returns:
497
+ Dictionary mapping tokens to their frequencies.
498
+ """
499
+ from collections import Counter
500
+ from datasets import load_dataset
501
+
502
+ dataset = load_dataset(dataset_name, split=split)
503
+
504
+ if max_samples is not None:
505
+ dataset = dataset.select(range(min(max_samples, len(dataset))))
506
+
507
+ token_counts = Counter()
508
+
509
+ for example in dataset:
510
+ moves = example[column].strip().split()
511
+ token_counts.update(moves)
512
+
513
+ return dict(token_counts)
tokenizer_config.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "[BOS]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[EOS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "140": {
28
+ "content": "[UNK]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ }
35
+ },
36
+ "auto_map": {
37
+ "AutoTokenizer": [
38
+ "tokenizer.ChessTokenizer",
39
+ null
40
+ ]
41
+ },
42
+ "bos_token": "[BOS]",
43
+ "clean_up_tokenization_spaces": false,
44
+ "eos_token": "[EOS]",
45
+ "extra_special_tokens": {},
46
+ "model_max_length": 1000000000000000019884624838656,
47
+ "pad_token": "[PAD]",
48
+ "tokenizer_class": "ChessTokenizer",
49
+ "unk_token": "[UNK]"
50
+ }
vocab.json ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "[PAD]": 0,
3
+ "[BOS]": 1,
4
+ "[EOS]": 2,
5
+ "[UNK]": 140,
6
+ "B": 4,
7
+ "EOM": 5,
8
+ "FROM_a1": 6,
9
+ "FROM_a2": 7,
10
+ "FROM_a3": 8,
11
+ "FROM_a4": 9,
12
+ "FROM_a5": 10,
13
+ "FROM_a6": 11,
14
+ "FROM_a7": 12,
15
+ "FROM_a8": 13,
16
+ "FROM_b1": 14,
17
+ "FROM_b2": 15,
18
+ "FROM_b3": 16,
19
+ "FROM_b4": 17,
20
+ "FROM_b5": 18,
21
+ "FROM_b6": 19,
22
+ "FROM_b7": 20,
23
+ "FROM_b8": 21,
24
+ "FROM_c1": 22,
25
+ "FROM_c2": 23,
26
+ "FROM_c3": 24,
27
+ "FROM_c4": 25,
28
+ "FROM_c5": 26,
29
+ "FROM_c6": 27,
30
+ "FROM_c7": 28,
31
+ "FROM_c8": 29,
32
+ "FROM_d1": 30,
33
+ "FROM_d2": 31,
34
+ "FROM_d3": 32,
35
+ "FROM_d4": 33,
36
+ "FROM_d5": 34,
37
+ "FROM_d6": 35,
38
+ "FROM_d7": 36,
39
+ "FROM_d8": 37,
40
+ "FROM_e1": 38,
41
+ "FROM_e2": 39,
42
+ "FROM_e3": 40,
43
+ "FROM_e4": 41,
44
+ "FROM_e5": 42,
45
+ "FROM_e6": 43,
46
+ "FROM_e7": 44,
47
+ "FROM_e8": 45,
48
+ "FROM_f1": 46,
49
+ "FROM_f2": 47,
50
+ "FROM_f3": 48,
51
+ "FROM_f4": 49,
52
+ "FROM_f5": 50,
53
+ "FROM_f6": 51,
54
+ "FROM_f7": 52,
55
+ "FROM_f8": 53,
56
+ "FROM_g1": 54,
57
+ "FROM_g2": 55,
58
+ "FROM_g3": 56,
59
+ "FROM_g4": 57,
60
+ "FROM_g5": 58,
61
+ "FROM_g6": 59,
62
+ "FROM_g7": 60,
63
+ "FROM_g8": 61,
64
+ "FROM_h1": 62,
65
+ "FROM_h2": 63,
66
+ "FROM_h3": 64,
67
+ "FROM_h4": 65,
68
+ "FROM_h5": 66,
69
+ "FROM_h6": 67,
70
+ "FROM_h7": 68,
71
+ "FROM_h8": 69,
72
+ "K": 70,
73
+ "N": 71,
74
+ "P": 72,
75
+ "Q": 73,
76
+ "R": 74,
77
+ "TO_a1_EOM": 75,
78
+ "TO_a2_EOM": 76,
79
+ "TO_a3_EOM": 77,
80
+ "TO_a4_EOM": 78,
81
+ "TO_a5_EOM": 79,
82
+ "TO_a6_EOM": 80,
83
+ "TO_a7_EOM": 81,
84
+ "TO_a8_EOM": 82,
85
+ "TO_b1_EOM": 83,
86
+ "TO_b2_EOM": 84,
87
+ "TO_b3_EOM": 85,
88
+ "TO_b4_EOM": 86,
89
+ "TO_b5_EOM": 87,
90
+ "TO_b6_EOM": 88,
91
+ "TO_b7_EOM": 89,
92
+ "TO_b8_EOM": 90,
93
+ "TO_c1_EOM": 91,
94
+ "TO_c2_EOM": 92,
95
+ "TO_c3_EOM": 93,
96
+ "TO_c4_EOM": 94,
97
+ "TO_c5_EOM": 95,
98
+ "TO_c6_EOM": 96,
99
+ "TO_c7_EOM": 97,
100
+ "TO_c8_EOM": 98,
101
+ "TO_d1_EOM": 99,
102
+ "TO_d2_EOM": 100,
103
+ "TO_d3_EOM": 101,
104
+ "TO_d4_EOM": 102,
105
+ "TO_d5_EOM": 103,
106
+ "TO_d6_EOM": 104,
107
+ "TO_d7_EOM": 105,
108
+ "TO_d8_EOM": 106,
109
+ "TO_e1_EOM": 107,
110
+ "TO_e2_EOM": 108,
111
+ "TO_e3_EOM": 109,
112
+ "TO_e4_EOM": 110,
113
+ "TO_e5_EOM": 111,
114
+ "TO_e6_EOM": 112,
115
+ "TO_e7_EOM": 113,
116
+ "TO_e8_EOM": 114,
117
+ "TO_f1_EOM": 115,
118
+ "TO_f2_EOM": 116,
119
+ "TO_f3_EOM": 117,
120
+ "TO_f4_EOM": 118,
121
+ "TO_f5_EOM": 119,
122
+ "TO_f6_EOM": 120,
123
+ "TO_f7_EOM": 121,
124
+ "TO_f8_EOM": 122,
125
+ "TO_g1_EOM": 123,
126
+ "TO_g2_EOM": 124,
127
+ "TO_g3_EOM": 125,
128
+ "TO_g4_EOM": 126,
129
+ "TO_g5_EOM": 127,
130
+ "TO_g6_EOM": 128,
131
+ "TO_g7_EOM": 129,
132
+ "TO_g8_EOM": 130,
133
+ "TO_h1_EOM": 131,
134
+ "TO_h2_EOM": 132,
135
+ "TO_h3_EOM": 133,
136
+ "TO_h4_EOM": 134,
137
+ "TO_h5_EOM": 135,
138
+ "TO_h6_EOM": 136,
139
+ "TO_h7_EOM": 137,
140
+ "TO_h8_EOM": 138,
141
+ "W": 139
142
+ }