converted to parquet
Browse files- data/{lichess_game_data.txt → lichess_data.parquet} +2 -2
- extra/chess_game_data.txt +0 -3
- extra/fix.ipynb +54 -0
- extra/test_dataset.ipynb +0 -682
data/{lichess_game_data.txt → lichess_data.parquet}
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:760d01d1f01afd4f2208783c8d16612a668bf8ba7cbb594d71dc1d1a0a8fc126
|
3 |
+
size 1402139955
|
extra/chess_game_data.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:b1f596fca8a3177bc5832e7a0f1e78fd14c3a924c53c3a15f4944a5d7ad869d1
|
3 |
-
size 168853001
|
|
|
|
|
|
|
|
extra/fix.ipynb
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [],
|
8 |
+
"source": [
|
9 |
+
"import pandas as pd\n",
|
10 |
+
"import json\n",
|
11 |
+
"import jsonlines\n"
|
12 |
+
]
|
13 |
+
},
|
14 |
+
{
|
15 |
+
"cell_type": "code",
|
16 |
+
"execution_count": null,
|
17 |
+
"metadata": {},
|
18 |
+
"outputs": [],
|
19 |
+
"source": [
|
20 |
+
"\n",
|
21 |
+
"with jsonlines.open('lichess_data.jsonl', 'a') as writer:\n",
|
22 |
+
" with open(\"lichess_game_data.txt\", 'r') as readf:\n",
|
23 |
+
" line = readf.readline()\n",
|
24 |
+
" count = 0\n",
|
25 |
+
" while line:\n",
|
26 |
+
" data_line = {'id': count, 'pgn': line}\n",
|
27 |
+
" writer.write(data_line)\n",
|
28 |
+
" line = readf.readline()\n",
|
29 |
+
" count += 1"
|
30 |
+
]
|
31 |
+
}
|
32 |
+
],
|
33 |
+
"metadata": {
|
34 |
+
"kernelspec": {
|
35 |
+
"display_name": "chess",
|
36 |
+
"language": "python",
|
37 |
+
"name": "python3"
|
38 |
+
},
|
39 |
+
"language_info": {
|
40 |
+
"codemirror_mode": {
|
41 |
+
"name": "ipython",
|
42 |
+
"version": 3
|
43 |
+
},
|
44 |
+
"file_extension": ".py",
|
45 |
+
"mimetype": "text/x-python",
|
46 |
+
"name": "python",
|
47 |
+
"nbconvert_exporter": "python",
|
48 |
+
"pygments_lexer": "ipython3",
|
49 |
+
"version": "3.11.5"
|
50 |
+
}
|
51 |
+
},
|
52 |
+
"nbformat": 4,
|
53 |
+
"nbformat_minor": 2
|
54 |
+
}
|
extra/test_dataset.ipynb
DELETED
@@ -1,682 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "code",
|
5 |
-
"execution_count": 1,
|
6 |
-
"metadata": {},
|
7 |
-
"outputs": [
|
8 |
-
{
|
9 |
-
"name": "stderr",
|
10 |
-
"output_type": "stream",
|
11 |
-
"text": [
|
12 |
-
"s:\\packages\\envs\\chess\\Lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
13 |
-
" from .autonotebook import tqdm as notebook_tqdm\n"
|
14 |
-
]
|
15 |
-
}
|
16 |
-
],
|
17 |
-
"source": [
|
18 |
-
"from datasets import load_dataset\n",
|
19 |
-
"import tokenize\n",
|
20 |
-
"from tokenizers import SentencePieceBPETokenizer, pre_tokenizers, ByteLevelBPETokenizer, normalizers\n",
|
21 |
-
"from transformers import AutoTokenizer"
|
22 |
-
]
|
23 |
-
},
|
24 |
-
{
|
25 |
-
"cell_type": "code",
|
26 |
-
"execution_count": 132,
|
27 |
-
"metadata": {},
|
28 |
-
"outputs": [
|
29 |
-
{
|
30 |
-
"name": "stderr",
|
31 |
-
"output_type": "stream",
|
32 |
-
"text": [
|
33 |
-
"Downloading data files: 100%|██████████| 1/1 [00:00<?, ?it/s]\n",
|
34 |
-
"Extracting data files: 100%|██████████| 1/1 [00:00<00:00, 111.41it/s]\n",
|
35 |
-
"Generating train split: 4343360 examples [00:24, 178753.60 examples/s]\n"
|
36 |
-
]
|
37 |
-
}
|
38 |
-
],
|
39 |
-
"source": [
|
40 |
-
"datasets = load_dataset(\"text\", data_files={\"train\": \"lichess_game_data.txt\"})"
|
41 |
-
]
|
42 |
-
},
|
43 |
-
{
|
44 |
-
"cell_type": "code",
|
45 |
-
"execution_count": 133,
|
46 |
-
"metadata": {},
|
47 |
-
"outputs": [],
|
48 |
-
"source": [
|
49 |
-
"def get_training_corpus():\n",
|
50 |
-
" dataset = datasets[\"train\"]\n",
|
51 |
-
" for start_idx in range(0, len(dataset), 1000):\n",
|
52 |
-
" samples = dataset[start_idx : start_idx + 1000]\n",
|
53 |
-
" yield samples['text']"
|
54 |
-
]
|
55 |
-
},
|
56 |
-
{
|
57 |
-
"cell_type": "code",
|
58 |
-
"execution_count": 134,
|
59 |
-
"metadata": {},
|
60 |
-
"outputs": [],
|
61 |
-
"source": [
|
62 |
-
"tokenizer = SentencePieceBPETokenizer()"
|
63 |
-
]
|
64 |
-
},
|
65 |
-
{
|
66 |
-
"cell_type": "code",
|
67 |
-
"execution_count": 135,
|
68 |
-
"metadata": {},
|
69 |
-
"outputs": [],
|
70 |
-
"source": [
|
71 |
-
"tokenizer.normalizer = normalizers.Sequence([normalizers.Replace(\".\", \"\"), normalizers.Replace(\"1-0\", \"\"), normalizers.Replace(\"0-1\", \"\"), normalizers.Replace(\"1/2-1/2\", \"\")])"
|
72 |
-
]
|
73 |
-
},
|
74 |
-
{
|
75 |
-
"cell_type": "code",
|
76 |
-
"execution_count": 136,
|
77 |
-
"metadata": {},
|
78 |
-
"outputs": [],
|
79 |
-
"source": [
|
80 |
-
"tokenizer.pre_tokenizer = pre_tokenizers.Split(\" \", 'removed')"
|
81 |
-
]
|
82 |
-
},
|
83 |
-
{
|
84 |
-
"cell_type": "code",
|
85 |
-
"execution_count": 137,
|
86 |
-
"metadata": {},
|
87 |
-
"outputs": [],
|
88 |
-
"source": [
|
89 |
-
"tokenizer.train_from_iterator(get_training_corpus(), vocab_size=10000000, min_frequency=0, show_progress=True, special_tokens=[\"<s>\", \"<pad>\", \"</s>\", \"<unk>\", \"<cls>\", \"<sep>\", \"<mask>\"])"
|
90 |
-
]
|
91 |
-
},
|
92 |
-
{
|
93 |
-
"cell_type": "code",
|
94 |
-
"execution_count": 138,
|
95 |
-
"metadata": {},
|
96 |
-
"outputs": [],
|
97 |
-
"source": [
|
98 |
-
"test_str = '1. e4 e5 2. Nf3 Nc6 3. d4 exd4 4. Nxd4 Nf6 5. Nxc6 bxc6 6. Bd3 d5 7. exd5 cxd5 8. O-O Be7 9. c4 O-O 10. cxd5 Bb7 11. Nc3 Nxd5 12. Bd2 Nb4 13. Be4 Bxe4 14. Nxe4 c5 15. Bc3 Qxd1 16. Rfxd1 Rad8 17. a3 Nd5 18. Ba5 Nb6 19. Nc3 Bf6 20. Rac1 Bxc3 21. Bxc3 Rxd1+ 22. Rxd1 f6 23. Kf1 Kf7 24. Rc1 Rd8 25. Ke2 Ke6 26. Bd2 c4 27. Be3 Rb8 28. Rc2 Rb7 29. h3 Kd5 30. Rd2+ Ke6 31. Rd4 a5 32. g3 Nd5 33. Bc1 Nb6 34. h4 g6 35. Bd2 Nd5 36. Bc1 Nb6 37. Bd2 Nd5 38. Rxc4 Rxb2 39. Ke1 Nb6 40. Re4+ Kd5 41. Re7 Rb1+ 42. Ke2 Nc4 43. Bc3 f5 44. Rd7+ Ke6 45. Rxh7 Rb3 46. Bd4 Rxa3 47. Rc7 Ra2+ 48. Kf3 Kd5 49. Rd7+ Kc6 50. Rg7 Kd5 51. Rd7+ Kc6 52. Rg7 Kd5 53. Rd7+ 1/2-1/2'"
|
99 |
-
]
|
100 |
-
},
|
101 |
-
{
|
102 |
-
"cell_type": "code",
|
103 |
-
"execution_count": 139,
|
104 |
-
"metadata": {},
|
105 |
-
"outputs": [
|
106 |
-
{
|
107 |
-
"data": {
|
108 |
-
"text/plain": [
|
109 |
-
"[('1', (0, 1)),\n",
|
110 |
-
" ('e4', (2, 4)),\n",
|
111 |
-
" ('e5', (5, 7)),\n",
|
112 |
-
" ('2', (8, 9)),\n",
|
113 |
-
" ('Nf3', (10, 13)),\n",
|
114 |
-
" ('Nc6', (14, 17)),\n",
|
115 |
-
" ('3', (18, 19)),\n",
|
116 |
-
" ('d4', (20, 22)),\n",
|
117 |
-
" ('exd4', (23, 27)),\n",
|
118 |
-
" ('4', (28, 29)),\n",
|
119 |
-
" ('Nxd4', (30, 34)),\n",
|
120 |
-
" ('Nf6', (35, 38)),\n",
|
121 |
-
" ('5', (39, 40)),\n",
|
122 |
-
" ('Nxc6', (41, 45)),\n",
|
123 |
-
" ('bxc6', (46, 50)),\n",
|
124 |
-
" ('6', (51, 52)),\n",
|
125 |
-
" ('Bd3', (53, 56)),\n",
|
126 |
-
" ('d5', (57, 59)),\n",
|
127 |
-
" ('7', (60, 61)),\n",
|
128 |
-
" ('exd5', (62, 66)),\n",
|
129 |
-
" ('cxd5', (67, 71)),\n",
|
130 |
-
" ('8', (72, 73)),\n",
|
131 |
-
" ('O-O', (74, 77)),\n",
|
132 |
-
" ('Be7', (78, 81)),\n",
|
133 |
-
" ('9', (82, 83)),\n",
|
134 |
-
" ('c4', (84, 86)),\n",
|
135 |
-
" ('O-O', (87, 90)),\n",
|
136 |
-
" ('10', (91, 93)),\n",
|
137 |
-
" ('cxd5', (94, 98)),\n",
|
138 |
-
" ('Bb7', (99, 102)),\n",
|
139 |
-
" ('11', (103, 105)),\n",
|
140 |
-
" ('Nc3', (106, 109)),\n",
|
141 |
-
" ('Nxd5', (110, 114)),\n",
|
142 |
-
" ('12', (115, 117)),\n",
|
143 |
-
" ('Bd2', (118, 121)),\n",
|
144 |
-
" ('Nb4', (122, 125)),\n",
|
145 |
-
" ('13', (126, 128)),\n",
|
146 |
-
" ('Be4', (129, 132)),\n",
|
147 |
-
" ('Bxe4', (133, 137)),\n",
|
148 |
-
" ('14', (138, 140)),\n",
|
149 |
-
" ('Nxe4', (141, 145)),\n",
|
150 |
-
" ('c5', (146, 148)),\n",
|
151 |
-
" ('15', (149, 151)),\n",
|
152 |
-
" ('Bc3', (152, 155)),\n",
|
153 |
-
" ('Qxd1', (156, 160)),\n",
|
154 |
-
" ('16', (161, 163)),\n",
|
155 |
-
" ('Rfxd1', (164, 169)),\n",
|
156 |
-
" ('Rad8', (170, 174)),\n",
|
157 |
-
" ('17', (175, 177)),\n",
|
158 |
-
" ('a3', (178, 180)),\n",
|
159 |
-
" ('Nd5', (181, 184)),\n",
|
160 |
-
" ('18', (185, 187)),\n",
|
161 |
-
" ('Ba5', (188, 191)),\n",
|
162 |
-
" ('Nb6', (192, 195)),\n",
|
163 |
-
" ('19', (196, 198)),\n",
|
164 |
-
" ('Nc3', (199, 202)),\n",
|
165 |
-
" ('Bf6', (203, 206)),\n",
|
166 |
-
" ('20', (207, 209)),\n",
|
167 |
-
" ('Rac1', (210, 214)),\n",
|
168 |
-
" ('Bxc3', (215, 219)),\n",
|
169 |
-
" ('21', (220, 222)),\n",
|
170 |
-
" ('Bxc3', (223, 227)),\n",
|
171 |
-
" ('Rxd1+', (228, 233)),\n",
|
172 |
-
" ('22', (234, 236)),\n",
|
173 |
-
" ('Rxd1', (237, 241)),\n",
|
174 |
-
" ('f6', (242, 244)),\n",
|
175 |
-
" ('23', (245, 247)),\n",
|
176 |
-
" ('Kf1', (248, 251)),\n",
|
177 |
-
" ('Kf7', (252, 255)),\n",
|
178 |
-
" ('24', (256, 258)),\n",
|
179 |
-
" ('Rc1', (259, 262)),\n",
|
180 |
-
" ('Rd8', (263, 266)),\n",
|
181 |
-
" ('25', (267, 269)),\n",
|
182 |
-
" ('Ke2', (270, 273)),\n",
|
183 |
-
" ('Ke6', (274, 277)),\n",
|
184 |
-
" ('26', (278, 280)),\n",
|
185 |
-
" ('Bd2', (281, 284)),\n",
|
186 |
-
" ('c4', (285, 287)),\n",
|
187 |
-
" ('27', (288, 290)),\n",
|
188 |
-
" ('Be3', (291, 294)),\n",
|
189 |
-
" ('Rb8', (295, 298)),\n",
|
190 |
-
" ('28', (299, 301)),\n",
|
191 |
-
" ('Rc2', (302, 305)),\n",
|
192 |
-
" ('Rb7', (306, 309)),\n",
|
193 |
-
" ('29', (310, 312)),\n",
|
194 |
-
" ('h3', (313, 315)),\n",
|
195 |
-
" ('Kd5', (316, 319)),\n",
|
196 |
-
" ('30', (320, 322)),\n",
|
197 |
-
" ('Rd2+', (323, 327)),\n",
|
198 |
-
" ('Ke6', (328, 331)),\n",
|
199 |
-
" ('31', (332, 334)),\n",
|
200 |
-
" ('Rd4', (335, 338)),\n",
|
201 |
-
" ('a5', (339, 341)),\n",
|
202 |
-
" ('32', (342, 344)),\n",
|
203 |
-
" ('g3', (345, 347)),\n",
|
204 |
-
" ('Nd5', (348, 351)),\n",
|
205 |
-
" ('33', (352, 354)),\n",
|
206 |
-
" ('Bc1', (355, 358)),\n",
|
207 |
-
" ('Nb6', (359, 362)),\n",
|
208 |
-
" ('34', (363, 365)),\n",
|
209 |
-
" ('h4', (366, 368)),\n",
|
210 |
-
" ('g6', (369, 371)),\n",
|
211 |
-
" ('35', (372, 374)),\n",
|
212 |
-
" ('Bd2', (375, 378)),\n",
|
213 |
-
" ('Nd5', (379, 382)),\n",
|
214 |
-
" ('36', (383, 385)),\n",
|
215 |
-
" ('Bc1', (386, 389)),\n",
|
216 |
-
" ('Nb6', (390, 393)),\n",
|
217 |
-
" ('37', (394, 396)),\n",
|
218 |
-
" ('Bd2', (397, 400)),\n",
|
219 |
-
" ('Nd5', (401, 404)),\n",
|
220 |
-
" ('38', (405, 407)),\n",
|
221 |
-
" ('Rxc4', (408, 412)),\n",
|
222 |
-
" ('Rxb2', (413, 417)),\n",
|
223 |
-
" ('39', (418, 420)),\n",
|
224 |
-
" ('Ke1', (421, 424)),\n",
|
225 |
-
" ('Nb6', (425, 428)),\n",
|
226 |
-
" ('40', (429, 431)),\n",
|
227 |
-
" ('Re4+', (432, 436)),\n",
|
228 |
-
" ('Kd5', (437, 440)),\n",
|
229 |
-
" ('41', (441, 443)),\n",
|
230 |
-
" ('Re7', (444, 447)),\n",
|
231 |
-
" ('Rb1+', (448, 452)),\n",
|
232 |
-
" ('42', (453, 455)),\n",
|
233 |
-
" ('Ke2', (456, 459)),\n",
|
234 |
-
" ('Nc4', (460, 463)),\n",
|
235 |
-
" ('43', (464, 466)),\n",
|
236 |
-
" ('Bc3', (467, 470)),\n",
|
237 |
-
" ('f5', (471, 473)),\n",
|
238 |
-
" ('44', (474, 476)),\n",
|
239 |
-
" ('Rd7+', (477, 481)),\n",
|
240 |
-
" ('Ke6', (482, 485)),\n",
|
241 |
-
" ('45', (486, 488)),\n",
|
242 |
-
" ('Rxh7', (489, 493)),\n",
|
243 |
-
" ('Rb3', (494, 497)),\n",
|
244 |
-
" ('46', (498, 500)),\n",
|
245 |
-
" ('Bd4', (501, 504)),\n",
|
246 |
-
" ('Rxa3', (505, 509)),\n",
|
247 |
-
" ('47', (510, 512)),\n",
|
248 |
-
" ('Rc7', (513, 516)),\n",
|
249 |
-
" ('Ra2+', (517, 521)),\n",
|
250 |
-
" ('48', (522, 524)),\n",
|
251 |
-
" ('Kf3', (525, 528)),\n",
|
252 |
-
" ('Kd5', (529, 532)),\n",
|
253 |
-
" ('49', (533, 535)),\n",
|
254 |
-
" ('Rd7+', (536, 540)),\n",
|
255 |
-
" ('Kc6', (541, 544)),\n",
|
256 |
-
" ('50', (545, 547)),\n",
|
257 |
-
" ('Rg7', (548, 551)),\n",
|
258 |
-
" ('Kd5', (552, 555)),\n",
|
259 |
-
" ('51', (556, 558)),\n",
|
260 |
-
" ('Rd7+', (559, 563)),\n",
|
261 |
-
" ('Kc6', (564, 567)),\n",
|
262 |
-
" ('52', (568, 570)),\n",
|
263 |
-
" ('Rg7', (571, 574)),\n",
|
264 |
-
" ('Kd5', (575, 578)),\n",
|
265 |
-
" ('53', (579, 581)),\n",
|
266 |
-
" ('Rd7+', (582, 586))]"
|
267 |
-
]
|
268 |
-
},
|
269 |
-
"execution_count": 139,
|
270 |
-
"metadata": {},
|
271 |
-
"output_type": "execute_result"
|
272 |
-
}
|
273 |
-
],
|
274 |
-
"source": [
|
275 |
-
"tokenizer.pre_tokenizer.pre_tokenize_str(tokenizer.normalizer.normalize_str(test_str))"
|
276 |
-
]
|
277 |
-
},
|
278 |
-
{
|
279 |
-
"cell_type": "code",
|
280 |
-
"execution_count": 140,
|
281 |
-
"metadata": {},
|
282 |
-
"outputs": [
|
283 |
-
{
|
284 |
-
"data": {
|
285 |
-
"text/plain": [
|
286 |
-
"['1',\n",
|
287 |
-
" 'e4',\n",
|
288 |
-
" 'e5',\n",
|
289 |
-
" '2',\n",
|
290 |
-
" 'Nf3',\n",
|
291 |
-
" 'Nc6',\n",
|
292 |
-
" '3',\n",
|
293 |
-
" 'd4',\n",
|
294 |
-
" 'exd4',\n",
|
295 |
-
" '4',\n",
|
296 |
-
" 'Nxd4',\n",
|
297 |
-
" 'Nf6',\n",
|
298 |
-
" '5',\n",
|
299 |
-
" 'Nxc6',\n",
|
300 |
-
" 'bxc6',\n",
|
301 |
-
" '6',\n",
|
302 |
-
" 'Bd3',\n",
|
303 |
-
" 'd5',\n",
|
304 |
-
" '7',\n",
|
305 |
-
" 'exd5',\n",
|
306 |
-
" 'cxd5',\n",
|
307 |
-
" '8',\n",
|
308 |
-
" 'O-O',\n",
|
309 |
-
" 'Be7',\n",
|
310 |
-
" '9',\n",
|
311 |
-
" 'c4',\n",
|
312 |
-
" 'O-O',\n",
|
313 |
-
" '10',\n",
|
314 |
-
" 'cxd5',\n",
|
315 |
-
" 'Bb7',\n",
|
316 |
-
" '11',\n",
|
317 |
-
" 'Nc3',\n",
|
318 |
-
" 'Nxd5',\n",
|
319 |
-
" '12',\n",
|
320 |
-
" 'Bd2',\n",
|
321 |
-
" 'Nb4',\n",
|
322 |
-
" '13',\n",
|
323 |
-
" 'Be4',\n",
|
324 |
-
" 'Bxe4',\n",
|
325 |
-
" '14',\n",
|
326 |
-
" 'Nxe4',\n",
|
327 |
-
" 'c5',\n",
|
328 |
-
" '15',\n",
|
329 |
-
" 'Bc3',\n",
|
330 |
-
" 'Qxd1',\n",
|
331 |
-
" '16',\n",
|
332 |
-
" 'Rfxd1',\n",
|
333 |
-
" 'Rad8',\n",
|
334 |
-
" '17',\n",
|
335 |
-
" 'a3',\n",
|
336 |
-
" 'Nd5',\n",
|
337 |
-
" '18',\n",
|
338 |
-
" 'Ba5',\n",
|
339 |
-
" 'Nb6',\n",
|
340 |
-
" '19',\n",
|
341 |
-
" 'Nc3',\n",
|
342 |
-
" 'Bf6',\n",
|
343 |
-
" '20',\n",
|
344 |
-
" 'Rac1',\n",
|
345 |
-
" 'Bxc3',\n",
|
346 |
-
" '21',\n",
|
347 |
-
" 'Bxc3',\n",
|
348 |
-
" 'Rxd1+',\n",
|
349 |
-
" '22',\n",
|
350 |
-
" 'Rxd1',\n",
|
351 |
-
" 'f6',\n",
|
352 |
-
" '23',\n",
|
353 |
-
" 'Kf1',\n",
|
354 |
-
" 'Kf7',\n",
|
355 |
-
" '24',\n",
|
356 |
-
" 'Rc1',\n",
|
357 |
-
" 'Rd8',\n",
|
358 |
-
" '25',\n",
|
359 |
-
" 'Ke2',\n",
|
360 |
-
" 'Ke6',\n",
|
361 |
-
" '26',\n",
|
362 |
-
" 'Bd2',\n",
|
363 |
-
" 'c4',\n",
|
364 |
-
" '27',\n",
|
365 |
-
" 'Be3',\n",
|
366 |
-
" 'Rb8',\n",
|
367 |
-
" '28',\n",
|
368 |
-
" 'Rc2',\n",
|
369 |
-
" 'Rb7',\n",
|
370 |
-
" '29',\n",
|
371 |
-
" 'h3',\n",
|
372 |
-
" 'Kd5',\n",
|
373 |
-
" '30',\n",
|
374 |
-
" 'Rd2+',\n",
|
375 |
-
" 'Ke6',\n",
|
376 |
-
" '31',\n",
|
377 |
-
" 'Rd4',\n",
|
378 |
-
" 'a5',\n",
|
379 |
-
" '32',\n",
|
380 |
-
" 'g3',\n",
|
381 |
-
" 'Nd5',\n",
|
382 |
-
" '33',\n",
|
383 |
-
" 'Bc1',\n",
|
384 |
-
" 'Nb6',\n",
|
385 |
-
" '34',\n",
|
386 |
-
" 'h4',\n",
|
387 |
-
" 'g6',\n",
|
388 |
-
" '35',\n",
|
389 |
-
" 'Bd2',\n",
|
390 |
-
" 'Nd5',\n",
|
391 |
-
" '36',\n",
|
392 |
-
" 'Bc1',\n",
|
393 |
-
" 'Nb6',\n",
|
394 |
-
" '37',\n",
|
395 |
-
" 'Bd2',\n",
|
396 |
-
" 'Nd5',\n",
|
397 |
-
" '38',\n",
|
398 |
-
" 'Rxc4',\n",
|
399 |
-
" 'Rxb2',\n",
|
400 |
-
" '39',\n",
|
401 |
-
" 'Ke1',\n",
|
402 |
-
" 'Nb6',\n",
|
403 |
-
" '40',\n",
|
404 |
-
" 'Re4+',\n",
|
405 |
-
" 'Kd5',\n",
|
406 |
-
" '41',\n",
|
407 |
-
" 'Re7',\n",
|
408 |
-
" 'Rb1+',\n",
|
409 |
-
" '42',\n",
|
410 |
-
" 'Ke2',\n",
|
411 |
-
" 'Nc4',\n",
|
412 |
-
" '43',\n",
|
413 |
-
" 'Bc3',\n",
|
414 |
-
" 'f5',\n",
|
415 |
-
" '44',\n",
|
416 |
-
" 'Rd7+',\n",
|
417 |
-
" 'Ke6',\n",
|
418 |
-
" '45',\n",
|
419 |
-
" 'Rxh7',\n",
|
420 |
-
" 'Rb3',\n",
|
421 |
-
" '46',\n",
|
422 |
-
" 'Bd4',\n",
|
423 |
-
" 'Rxa3',\n",
|
424 |
-
" '47',\n",
|
425 |
-
" 'Rc7',\n",
|
426 |
-
" 'Ra2+',\n",
|
427 |
-
" '48',\n",
|
428 |
-
" 'Kf3',\n",
|
429 |
-
" 'Kd5',\n",
|
430 |
-
" '49',\n",
|
431 |
-
" 'Rd7+',\n",
|
432 |
-
" 'Kc6',\n",
|
433 |
-
" '50',\n",
|
434 |
-
" 'Rg7',\n",
|
435 |
-
" 'Kd5',\n",
|
436 |
-
" '51',\n",
|
437 |
-
" 'Rd7+',\n",
|
438 |
-
" 'Kc6',\n",
|
439 |
-
" '52',\n",
|
440 |
-
" 'Rg7',\n",
|
441 |
-
" 'Kd5',\n",
|
442 |
-
" '53',\n",
|
443 |
-
" 'Rd7+']"
|
444 |
-
]
|
445 |
-
},
|
446 |
-
"execution_count": 140,
|
447 |
-
"metadata": {},
|
448 |
-
"output_type": "execute_result"
|
449 |
-
}
|
450 |
-
],
|
451 |
-
"source": [
|
452 |
-
"tokenizer.encode(test_str).tokens"
|
453 |
-
]
|
454 |
-
},
|
455 |
-
{
|
456 |
-
"cell_type": "code",
|
457 |
-
"execution_count": 142,
|
458 |
-
"metadata": {},
|
459 |
-
"outputs": [
|
460 |
-
{
|
461 |
-
"data": {
|
462 |
-
"text/plain": [
|
463 |
-
"[11,\n",
|
464 |
-
" 48,\n",
|
465 |
-
" 53,\n",
|
466 |
-
" 12,\n",
|
467 |
-
" 79,\n",
|
468 |
-
" 116,\n",
|
469 |
-
" 13,\n",
|
470 |
-
" 45,\n",
|
471 |
-
" 307,\n",
|
472 |
-
" 14,\n",
|
473 |
-
" 193,\n",
|
474 |
-
" 74,\n",
|
475 |
-
" 15,\n",
|
476 |
-
" 434,\n",
|
477 |
-
" 391,\n",
|
478 |
-
" 16,\n",
|
479 |
-
" 154,\n",
|
480 |
-
" 46,\n",
|
481 |
-
" 17,\n",
|
482 |
-
" 190,\n",
|
483 |
-
" 199,\n",
|
484 |
-
" 18,\n",
|
485 |
-
" 51,\n",
|
486 |
-
" 150,\n",
|
487 |
-
" 19,\n",
|
488 |
-
" 65,\n",
|
489 |
-
" 51,\n",
|
490 |
-
" 71,\n",
|
491 |
-
" 199,\n",
|
492 |
-
" 229,\n",
|
493 |
-
" 76,\n",
|
494 |
-
" 102,\n",
|
495 |
-
" 244,\n",
|
496 |
-
" 78,\n",
|
497 |
-
" 253,\n",
|
498 |
-
" 405,\n",
|
499 |
-
" 80,\n",
|
500 |
-
" 342,\n",
|
501 |
-
" 345,\n",
|
502 |
-
" 82,\n",
|
503 |
-
" 228,\n",
|
504 |
-
" 63,\n",
|
505 |
-
" 83,\n",
|
506 |
-
" 400,\n",
|
507 |
-
" 832,\n",
|
508 |
-
" 84,\n",
|
509 |
-
" 1660,\n",
|
510 |
-
" 432,\n",
|
511 |
-
" 86,\n",
|
512 |
-
" 117,\n",
|
513 |
-
" 176,\n",
|
514 |
-
" 88,\n",
|
515 |
-
" 692,\n",
|
516 |
-
" 319,\n",
|
517 |
-
" 90,\n",
|
518 |
-
" 102,\n",
|
519 |
-
" 322,\n",
|
520 |
-
" 91,\n",
|
521 |
-
" 459,\n",
|
522 |
-
" 386,\n",
|
523 |
-
" 92,\n",
|
524 |
-
" 386,\n",
|
525 |
-
" 791,\n",
|
526 |
-
" 95,\n",
|
527 |
-
" 519,\n",
|
528 |
-
" 177,\n",
|
529 |
-
" 96,\n",
|
530 |
-
" 273,\n",
|
531 |
-
" 201,\n",
|
532 |
-
" 98,\n",
|
533 |
-
" 222,\n",
|
534 |
-
" 214,\n",
|
535 |
-
" 103,\n",
|
536 |
-
" 239,\n",
|
537 |
-
" 246,\n",
|
538 |
-
" 105,\n",
|
539 |
-
" 253,\n",
|
540 |
-
" 65,\n",
|
541 |
-
" 110,\n",
|
542 |
-
" 155,\n",
|
543 |
-
" 241,\n",
|
544 |
-
" 113,\n",
|
545 |
-
" 346,\n",
|
546 |
-
" 421,\n",
|
547 |
-
" 114,\n",
|
548 |
-
" 107,\n",
|
549 |
-
" 324,\n",
|
550 |
-
" 115,\n",
|
551 |
-
" 808,\n",
|
552 |
-
" 246,\n",
|
553 |
-
" 118,\n",
|
554 |
-
" 414,\n",
|
555 |
-
" 77,\n",
|
556 |
-
" 121,\n",
|
557 |
-
" 112,\n",
|
558 |
-
" 176,\n",
|
559 |
-
" 122,\n",
|
560 |
-
" 572,\n",
|
561 |
-
" 319,\n",
|
562 |
-
" 125,\n",
|
563 |
-
" 73,\n",
|
564 |
-
" 100,\n",
|
565 |
-
" 126,\n",
|
566 |
-
" 253,\n",
|
567 |
-
" 176,\n",
|
568 |
-
" 128,\n",
|
569 |
-
" 572,\n",
|
570 |
-
" 319,\n",
|
571 |
-
" 131,\n",
|
572 |
-
" 253,\n",
|
573 |
-
" 176,\n",
|
574 |
-
" 136,\n",
|
575 |
-
" 553,\n",
|
576 |
-
" 578,\n",
|
577 |
-
" 139,\n",
|
578 |
-
" 487,\n",
|
579 |
-
" 319,\n",
|
580 |
-
" 143,\n",
|
581 |
-
" 1064,\n",
|
582 |
-
" 324,\n",
|
583 |
-
" 145,\n",
|
584 |
-
" 373,\n",
|
585 |
-
" 854,\n",
|
586 |
-
" 149,\n",
|
587 |
-
" 239,\n",
|
588 |
-
" 254,\n",
|
589 |
-
" 153,\n",
|
590 |
-
" 400,\n",
|
591 |
-
" 140,\n",
|
592 |
-
" 156,\n",
|
593 |
-
" 785,\n",
|
594 |
-
" 246,\n",
|
595 |
-
" 160,\n",
|
596 |
-
" 820,\n",
|
597 |
-
" 475,\n",
|
598 |
-
" 165,\n",
|
599 |
-
" 305,\n",
|
600 |
-
" 708,\n",
|
601 |
-
" 169,\n",
|
602 |
-
" 326,\n",
|
603 |
-
" 801,\n",
|
604 |
-
" 179,\n",
|
605 |
-
" 225,\n",
|
606 |
-
" 324,\n",
|
607 |
-
" 186,\n",
|
608 |
-
" 785,\n",
|
609 |
-
" 350,\n",
|
610 |
-
" 194,\n",
|
611 |
-
" 595,\n",
|
612 |
-
" 324,\n",
|
613 |
-
" 200,\n",
|
614 |
-
" 785,\n",
|
615 |
-
" 350,\n",
|
616 |
-
" 210,\n",
|
617 |
-
" 595,\n",
|
618 |
-
" 324,\n",
|
619 |
-
" 224,\n",
|
620 |
-
" 785]"
|
621 |
-
]
|
622 |
-
},
|
623 |
-
"execution_count": 142,
|
624 |
-
"metadata": {},
|
625 |
-
"output_type": "execute_result"
|
626 |
-
}
|
627 |
-
],
|
628 |
-
"source": [
|
629 |
-
"tokenizer.encode(test_str)"
|
630 |
-
]
|
631 |
-
},
|
632 |
-
{
|
633 |
-
"cell_type": "code",
|
634 |
-
"execution_count": 143,
|
635 |
-
"metadata": {},
|
636 |
-
"outputs": [
|
637 |
-
{
|
638 |
-
"data": {
|
639 |
-
"text/plain": [
|
640 |
-
"13677"
|
641 |
-
]
|
642 |
-
},
|
643 |
-
"execution_count": 143,
|
644 |
-
"metadata": {},
|
645 |
-
"output_type": "execute_result"
|
646 |
-
}
|
647 |
-
],
|
648 |
-
"source": [
|
649 |
-
"tokenizer.get_vocab_size()"
|
650 |
-
]
|
651 |
-
},
|
652 |
-
{
|
653 |
-
"cell_type": "code",
|
654 |
-
"execution_count": null,
|
655 |
-
"metadata": {},
|
656 |
-
"outputs": [],
|
657 |
-
"source": []
|
658 |
-
}
|
659 |
-
],
|
660 |
-
"metadata": {
|
661 |
-
"kernelspec": {
|
662 |
-
"display_name": "chess",
|
663 |
-
"language": "python",
|
664 |
-
"name": "python3"
|
665 |
-
},
|
666 |
-
"language_info": {
|
667 |
-
"codemirror_mode": {
|
668 |
-
"name": "ipython",
|
669 |
-
"version": 3
|
670 |
-
},
|
671 |
-
"file_extension": ".py",
|
672 |
-
"mimetype": "text/x-python",
|
673 |
-
"name": "python",
|
674 |
-
"nbconvert_exporter": "python",
|
675 |
-
"pygments_lexer": "ipython3",
|
676 |
-
"version": "3.11.5"
|
677 |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