soldni commited on
Commit
436b034
1 Parent(s): 1618cf7
Files changed (4) hide show
  1. .gitignore +71 -0
  2. match.ipynb +418 -0
  3. raw/JEOPARDY_QUESTIONS1.json.zst +3 -0
  4. raw/test.jsonl +0 -0
.gitignore ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # build artifacts
2
+
3
+ .eggs/
4
+ .mypy_cache
5
+ *.egg-info/
6
+ build/
7
+ dist/
8
+ pip-wheel-metadata/
9
+
10
+
11
+ # dev tools
12
+
13
+ .envrc
14
+ .python-version
15
+ .idea
16
+ .venv/
17
+ .vscode/
18
+ /*.iml
19
+
20
+ # jupyter notebooks
21
+
22
+ .ipynb_checkpoints
23
+
24
+
25
+ # miscellaneous
26
+
27
+ .cache/
28
+ doc/_build/
29
+ *.swp
30
+ .DS_Store
31
+
32
+
33
+ # python
34
+
35
+ *.pyc
36
+ *.pyo
37
+ __pycache__
38
+
39
+
40
+ # testing and continuous integration
41
+
42
+ .coverage
43
+ .pytest_cache/
44
+ .benchmarks
45
+
46
+ # documentation build artifacts
47
+
48
+ docs/build
49
+ site/
50
+
51
+ # runs
52
+ /runs/
53
+ /wandb/
54
+ /scratch/
55
+
56
+ # compiled rust extension
57
+ target/
58
+ *.so
59
+
60
+ # macOS metadata
61
+ .DS_Store
62
+
63
+ # ignoring test output
64
+ /tests/work/
65
+
66
+ # ignore vscode directory
67
+ .vscode
68
+
69
+ # ignore temporary directories
70
+ /tmp/
71
+ /temp/
match.ipynb ADDED
@@ -0,0 +1,418 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 12,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "Current working directory: /Users/lucas/Code/jeopardy\n"
13
+ ]
14
+ }
15
+ ],
16
+ "source": [
17
+ "import json\n",
18
+ "from string import punctuation, whitespace\n",
19
+ "import os\n",
20
+ "from copy import deepcopy\n",
21
+ "from hashlib import md5\n",
22
+ "import re\n",
23
+ "from functools import reduce\n",
24
+ "import datasets\n",
25
+ "import smart_open\n",
26
+ "\n",
27
+ "punctuation, whitespace = map(set, [punctuation, whitespace])\n",
28
+ "print(f\"Current working directory: {os.getcwd()}\")"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type": "code",
33
+ "execution_count": 13,
34
+ "metadata": {},
35
+ "outputs": [],
36
+ "source": [
37
+ "with smart_open.open(\"raw/test.jsonl\", \"r\") as f:\n",
38
+ " new_questions_raw = [json.loads(line) for line in f]\n",
39
+ " new_questions = {''.join([ch for ch in f\"{q['context']} {q['continuation']}\" if ch not in punctuation and ch not in whitespace]): q for q in new_questions_raw}\n",
40
+ "\n",
41
+ "with smart_open.open(\"raw/JEOPARDY_QUESTIONS1.json.zst\", \"r\") as f:\n",
42
+ " old_questions_raw = json.load(f)"
43
+ ]
44
+ },
45
+ {
46
+ "cell_type": "code",
47
+ "execution_count": 3,
48
+ "metadata": {},
49
+ "outputs": [],
50
+ "source": [
51
+ "double_quote, single_quote = '\"', \"'\"\n",
52
+ "\n",
53
+ "actually_to_fix = {\n",
54
+ " \"White alba\": \"White\",\n",
55
+ " \"The Netherlands Holland\": \"The Netherlands\",\n",
56
+ " \"Peter I Peter the Great\": \"Peter I\",\n",
57
+ " \"Russia or the Soviet Union\": \"Russia\",\n",
58
+ " \"Ramses the Great\": \"Ramses\",\n",
59
+ " \"a bar or a saloon\": \"a bar\",\n",
60
+ " \"West Virginia paid debt to Virginia\": \"West Virginia\",\n",
61
+ " \"Robert Fulton\": \"Fulton\",\n",
62
+ " \"CIA Central Intelligence Agency\": \"CIA\",\n",
63
+ " \"NATO North Atlantic Treaty Organisation\": \"NATO\",\n",
64
+ " \"NRA National Recovery Administration\": \"NRA\",\n",
65
+ " \"the ERA Equal Rights Amendment\": \"the ERA\",\n",
66
+ " \"Ford\\'s Theatre the Ford Theatre accepted\": \"Fords Theatre\",\n",
67
+ " \"NATO North Atlantic Treaty Organization\": \"NATO\",\n",
68
+ " \"Lyndon Johnson LBJ\": \"Lyndon Johnson\",\n",
69
+ " \"Lewis Carroll Charles L. Dodgson\": \"Lewis Carroll\",\n",
70
+ " \"Tropic of Cancer by Henry Miller\": \"Tropic of Cancer\",\n",
71
+ " \"an inclined plane ramp later ruled acceptable\": \"an inclined plane\",\n",
72
+ " \"nitrous oxide or laughing gas\": \"nitrous oxide\",\n",
73
+ " \"dividing splitting in two\": \"dividing\",\n",
74
+ " \"monosodium glutamate or MSG\": \"monosodium glutamate\",\n",
75
+ " \"carbohydrates or starches\": \"carbohydrates\",\n",
76
+ " \"vamoose vamonos\": \"vamoose\",\n",
77
+ " \"Dunce from John Duns Scotus\": \"Dunce\",\n",
78
+ " \"The People's Republic of China\": \"China\",\n",
79
+ " \"The People\\\\'s Republic of China\": \"China\",\n",
80
+ " \"Mary Stuart Mary, Queen of Scots\": \"Mary Stuart\",\n",
81
+ " \"Robert F. Kennedy Attorney General\": \"Robert F. Kennedy\",\n",
82
+ " \"Ford\\\\'s Theatre the Ford Theatre accepted\": \"Fords Theatre\",\n",
83
+ " \"The Stranger L\\\\'Etranger\": \"The Stranger\",\n",
84
+ " \"Côte d\\\\'Ivoire or the Ivory Coast\": \"Côte d'Ivoire\",\n",
85
+ " \"Henry David Thoreau\": \"Thoreau\",\n",
86
+ " \"escaping the Earth\\\\'s gravity and go off into outer space, on your way to the moon, for instance\":\"escaping the Earths gravity\",\n",
87
+ " \"Ernst Mach\": \"Mach\",\n",
88
+ " \"talons or claws\": \"talons\",\n",
89
+ " \"Mall from Pall Mall\": \"Mall\",\n",
90
+ " \"Crony from the Greek god Cronus\": \"Crony\",\n",
91
+ " \"hurry or quick or fast\": \"hurry\",\n",
92
+ " \"Dr. Samuel Mudd\": \"Mudd\",\n",
93
+ " \"Anniversary annus - year & verso - turn\": \"Anniversary\",\n",
94
+ "}\n",
95
+ "\n",
96
+ "replacements = {\n",
97
+ " \"White alba\": \"White\",\n",
98
+ " \"Valentina Tereshkova\": \"Tereshkova\",\n",
99
+ " \"Mikhail Gorbachev\": \"Gorbachev\",\n",
100
+ " \"Admiral Byrd\": \"Byrd\",\n",
101
+ " \"Red China\": \"China\",\n",
102
+ " \"The Netherlands Holland\": \"The Netherlands\",\n",
103
+ " \"Heinrich Schliemann\": \"Schliemann\",\n",
104
+ " \"Peter I Peter the Great\": \"Peter I\",\n",
105
+ " \"Russia or the Soviet Union\": \"Russia\",\n",
106
+ " \"Ferdinand II\": \"Ferdinand\",\n",
107
+ " \"Ramses the Great\": \"Ramses\",\n",
108
+ " \"Jose de San Martin\": \"San Martin\",\n",
109
+ " \"Douglas McArthur\": \"McArthur\",\n",
110
+ " \"Rutherford B. Hayes\": \"Hayes\",\n",
111
+ " \"Peter Stuyvesant\": \"Stuyvesant\",\n",
112
+ " \"a bar or a saloon\": \"a bar \",\n",
113
+ " \"West Virginia paid debt to Virginia\": \"West Virginia \",\n",
114
+ " \"Robert Fulton\": \"Fulton\",\n",
115
+ " \"CIA Central Intelligence Agency\": \"CIA \",\n",
116
+ " # remove later\n",
117
+ " \"1 of want, speech, religion, or fear\": \"1 of \",\n",
118
+ " \"James Madison\": \"Madison\",\n",
119
+ " \"Alger Hiss\": \"Hiss\",\n",
120
+ " \"NATO North Atlantic Treaty Organisation\": \"NATO \",\n",
121
+ " \"James Oglethorpe\": \"Oglethorpe\",\n",
122
+ " \"NRA National Recovery Administration\": \"NRA \",\n",
123
+ " \"the ERA Equal Rights Amendment\": \"the ERA \",\n",
124
+ " \"Ford\\'s Theatre the Ford Theatre accepted\": \"Fords Theatre \",\n",
125
+ " \"NATO North Atlantic Treaty Organization\": \"NATO \",\n",
126
+ " \"Lyndon Johnson LBJ\": \"Lyndon Johnson \",\n",
127
+ " \"Nathaniel Hawthorne\": \"Hawthorne\",\n",
128
+ " \"Lewis Carroll Charles L. Dodgson\": \"Lewis Carroll\",\n",
129
+ " \"Tropic of Cancer by Henry Miller\": \"Tropic of Cancer\",\n",
130
+ " \"James Fenimore Cooper\": \"Cooper\",\n",
131
+ " \"Rudyard Kipling\": \"Kipling\",\n",
132
+ " \"William Burroughs\": \"Burroughs\",\n",
133
+ " \"purple Riders of the Purple Sage\": \"purple\",\n",
134
+ " \"Sir Arthur Conan Doyle\": \"Doyle\",\n",
135
+ " \"Samuel Beckett\": \"Beckett\",\n",
136
+ " \"Percy Shelley\": \"Shelley\",\n",
137
+ " \"an inclined plane ramp later ruled acceptable\": \"an inclined plane\",\n",
138
+ " \"nitrous oxide or laughing gas\": \"nitrous oxide\",\n",
139
+ " \"dividing splitting in two\": \"dividing\",\n",
140
+ " \"Edward Jenner\": \"Jenner\",\n",
141
+ " \"Spiral\": \"Spiral\",\n",
142
+ " \"monosodium glutamate or MSG\": \"monosodium glutamate\",\n",
143
+ " \"carbohydrates or starches\": \"carbohydrates\",\n",
144
+ " \"Dog Laika\": \"Dog\",\n",
145
+ " \"Horse Mare\": \"Horse\",\n",
146
+ " \"Sir Isaac Newton\": \"Newton\",\n",
147
+ " \"vamoose vamonos\": \"vamoose\",\n",
148
+ " \"Dunce from John Duns Scotus\": \"Dunce\",\n",
149
+ " \"The People's Republic of China\": \"China\",\n",
150
+ " \"The People\\\\'s Republic of China\": \"China\",\n",
151
+ " \"Mary Stuart Mary, Queen of Scots\": \"Mary Stuart\",\n",
152
+ " \"Tomás de Torquemada\": \"Torquemada\",\n",
153
+ " \"Robert F. Kennedy Attorney General\": \"Robert F. Kennedy\",\n",
154
+ " \"Ford\\\\'s Theatre the Ford Theatre accepted\": \"Fords Theatre \",\n",
155
+ " \"Alexandre Dumas\": \"Dumas\",\n",
156
+ " 'Percy Bysshe Shelley': \"Shelley\",\n",
157
+ " \"The Stranger L\\\\'Etranger\": \"The Stranger\",\n",
158
+ " \"Rudyard Kipling\": \"Kipling\",\n",
159
+ " \"Elizabeth I\": \"Elizabeth\",\n",
160
+ " \"Pearl Buck\": \"Buck\",\n",
161
+ " \"Theodore Dreiser\": \"Dreiser\",\n",
162
+ " \"Geoffrey Chaucer\": \"Chaucer\",\n",
163
+ " \"John Updike\": \"Updike\",\n",
164
+ " \"Côte d\\\\'Ivoire or the Ivory Coast\": \"Côte dIvoire\",\n",
165
+ " \"Henry David Thoreau\": \"Thoreau\",\n",
166
+ " \"escaping the Earth\\\\'s gravity and go off into outer space, on your way to the moon, for instance\":\"escaping the Earths gravity\",\n",
167
+ " \"Ernst Mach\": \"Mach\",\n",
168
+ " \"talons or claws\": \"talons\",\n",
169
+ " \"Mall from Pall Mall\": \"Mall\",\n",
170
+ " \"Crony from the Greek god Cronus\": \"Crony\",\n",
171
+ " \"hurry or quick or fast\": \"hurry\",\n",
172
+ " \"Dr. Samuel Mudd\": \"Mudd\",\n",
173
+ " \"Anniversary annus - year & verso - turn\": \"Anniversary\",\n",
174
+ "}\n",
175
+ "\n",
176
+ "reversed_replacements = {\n",
177
+ " \"3430-c34791\": {\"Hayes\": \"Rutherford B. Hayes\"},\n",
178
+ " # \"5098-f4fecb\": {\"Ford\\'s Theatre the Ford Theatre accepted\": \"Fords Theatre \"},\n",
179
+ " \"3786-565e32\": {\"Beckett\": \"Samuel Beckett\"},\n",
180
+ " \"4956-718970\": {\"nitrous oxide\": \"nitrous oxide\"},\n",
181
+ " \"3601-8602cf\": {\"Spiral\": \"Spiral\"},\n",
182
+ " \"3444-401076\": {\"Newton\": \"Sir Isaac Newton\"},\n",
183
+ " \"2543-59f257\": {\"Newton\": \"Sir Isaac Newton\"},\n",
184
+ " \"1906-9014ac\": {\"Kipling\": \"Rudyard Kipling\"},\n",
185
+ " \"2635-70b5a3\": {\"Kipling\": \"Rudyard Kipling\"},\n",
186
+ " \"3160-7a4598\": {\"Kipling\": \"Rudyard Kipling\"},\n",
187
+ " \"2958-433cff\": {\"Kipling\": \"Rudyard Kipling\"},\n",
188
+ " \"4627-76ba39\": {\"Kipling\": \"Rudyard Kipling\"},\n",
189
+ " \"4968-d9d217\": {\"Buck\": \"Pearl Buck\"},\n",
190
+ " \"2866-b796c5\": {\"Cooper\": \"James Fenimore Cooper\"},\n",
191
+ " \"2927-c6e128\": {\"Cooper\": \"James Fenimore Cooper\"},\n",
192
+ " \"2841-5fbe33\": {\"Updike\": \"John Updike\"},\n",
193
+ "\n",
194
+ "}\n",
195
+ "\n",
196
+ "context_replacements = {\n",
197
+ " \"Asia's population giant\": \"Asias population giant\",\n",
198
+ " \"Spain's Phillip II\": \"Spains Phillip II\",\n",
199
+ " \"It's been estimated that this grand inquisitor\": \"Its been estimated that this grand inquisitor\",\n",
200
+ " 'He wrote \"The 3 Musketeers\"; his son wrote \"Camille\"': \"He wrote The 3 Musketeers; his son wrote Camille\",\n",
201
+ " 'Hmm... he dedicated his 1820 poem \"The Witch of Atlas\" to his wife Mary': \"Hmm... he dedicated his 1820 poem The Witch of Atlas to his wife Mary\",\n",
202
+ " 'This 1942 French novel begins, \"Mother died today. Or, maybe, yesterday; I can\\'t be sure.\"': 'This 1942 French novel begins, Mother died today. Or, maybe, yesterday; I cant be sure.',\n",
203
+ " \"Mowgli's song Against People appears in this author's Second Jungle Book\": \"Mowglis song Against People appears in this authors Second Jungle Book\",\n",
204
+ " 'Wordsworth\\'s poem about her begins, \"Hail, Virgin Queen! O\\'er many an envious bar triumphant\"': \"Wordsworths poem about her begins, Hail, Virgin Queen! Oer many an envious bar triumphant\",\n",
205
+ " 'Mercedes of Castile is a lesser-known novel by this author of \"The Leather-Stocking Tales\"': \"Mercedes of Castile is a lesser-known novel by this author of The Leather-Stocking Tales\",\n",
206
+ " '\"The Knight\\'s Tale\" by this 14th century author is based on Boccaccio\\'s poem': 'The Knights Tale by this 14th century author is based on Boccaccios poem',\n",
207
+ " 'He wrote \"Bech: A Book\", Bech Is Back & Bech At Bay in addition to his Rabbit novels': 'He wrote Bech: A Book, Bech Is Back & Bech At Bay in addition to his Rabbit novels',\n",
208
+ " \"Bernard Binlin Dadie's novel Climbie depicts this Ivorian country, his homeland, during colonial times\": \"Bernard Binlin Dadies novel Climbie depicts this Ivorian country, his homeland, during colonial times\",\n",
209
+ " 'His Jungle Book prose begins, \"It was seven o\\'clock of a very warm evening in the Seeonee Hills...\"': \"His Jungle Book prose begins, It was seven oclock of a very warm evening in the Seeonee Hills...\"\n",
210
+ "}\n",
211
+ "\n",
212
+ "reversed_context_replacements = {}\n",
213
+ "\n",
214
+ "old_questions = []\n",
215
+ "for q in old_questions_raw:\n",
216
+ " nq = deepcopy(q)\n",
217
+ " question = q['question'].strip(single_quote)\n",
218
+ "\n",
219
+ " # Remove hyperlinks from the question, keeping only the text between the tags\n",
220
+ " if '<a' in question and '</a>' in question:\n",
221
+ " question = re.sub(r'<a[^>]*>(.*?)</a>', r'\\1', question)\n",
222
+ "\n",
223
+ " # Remove accidental backslashes from the question\n",
224
+ " question = question.replace('\\\\', '')\n",
225
+ "\n",
226
+ " # Remove text within parentheses from the question\n",
227
+ " light_edit_question = question = re.sub(r'(\\s*)\\([^)]*\\)\\s*', r'\\1', question).strip()\n",
228
+ "\n",
229
+ " # Remove text within double quotes from the question\n",
230
+ " question = re.sub(r'\"([^\"]+)\"', r'\\1', question).strip()\n",
231
+ "\n",
232
+ " # Remove aphostrophies from the question\n",
233
+ " question = re.sub(r\"(\\w+)'(\\w+)\", r'\\1\\2', question).strip()\n",
234
+ "\n",
235
+ " nq['context'] = f\"{q['category'].replace(double_quote, '')}: {question}\"\n",
236
+ " for k, v in context_replacements.items():\n",
237
+ " if k in nq['context']:\n",
238
+ " nq['context'] = nq['context'].replace(k, v)\n",
239
+ "\n",
240
+ " nq[\"ee-question\"] = light_edit_question\n",
241
+ " nq[\"ee-continuation\"] = reduce(\n",
242
+ " lambda x, y: x.replace(y[0], y[1]),\n",
243
+ " replacements.items(),\n",
244
+ " light_edit_question\n",
245
+ " )\n",
246
+ " nq[\"ee-category\"] = q['category']\n",
247
+ "\n",
248
+ " nq['continuation'] = replacements.get((c := q['answer'].replace('(', '').replace(')', '')), c)\n",
249
+ " nq['category'] = \"\".join([ch for ch in q['category'] if ch not in punctuation]).lower().replace(' ', '_')\n",
250
+ " nq['id'] = f\"{q['show_number']}-{md5(json.dumps(q).encode('utf-8')).hexdigest()[:6]}\"\n",
251
+ " nq['og-category'] = q['category']\n",
252
+ " for k, v in reversed_replacements.get(nq['id'], {}).items():\n",
253
+ " nq['continuation'] = nq['continuation'].replace(k, v)\n",
254
+ " for k, v in reversed_context_replacements.get(nq['id'], {}).items():\n",
255
+ " nq['context'] = v\n",
256
+ " old_questions.append(nq)"
257
+ ]
258
+ },
259
+ {
260
+ "cell_type": "code",
261
+ "execution_count": 5,
262
+ "metadata": {},
263
+ "outputs": [
264
+ {
265
+ "name": "stdout",
266
+ "output_type": "stream",
267
+ "text": [
268
+ "Missing: 0\n"
269
+ ]
270
+ }
271
+ ],
272
+ "source": [
273
+ "new_categories = set([q['category'] for q in new_questions.values()])\n",
274
+ "old_questions_subset = {''.join([ch for ch in f\"{q['context']} {q['continuation']}\" if ch not in punctuation and ch not in whitespace]):q for q in [q for q in old_questions if q['category'] in new_categories]}\n",
275
+ "\n",
276
+ "missing = [{**v, 'key': k} for k, v in new_questions.items() if k not in old_questions_subset]\n",
277
+ "print(f\"Missing: {len(missing)}\")\n",
278
+ "for m in missing:\n",
279
+ " print(m['context'])\n",
280
+ " print(m['continuation'])\n",
281
+ " break\n",
282
+ "\n",
283
+ "# print('-----')\n",
284
+ "# query = ' '.join(m['context'].split(':', 1)[1].split(' ')[5:9]).strip()\n",
285
+ "# for row in [o for o in old_questions if query in o['question']]:\n",
286
+ "# print(row['id'])\n",
287
+ "# print(f\"{row['context']} {'SAME' if row['context'] == m['context'] else 'DIFFERENT'}\")\n",
288
+ "# print(f\"{row['continuation']} {'SAME' if row['continuation'] == m['continuation'] else 'DIFFERENT'}\")\n",
289
+ "# print()"
290
+ ]
291
+ },
292
+ {
293
+ "cell_type": "code",
294
+ "execution_count": 10,
295
+ "metadata": {},
296
+ "outputs": [
297
+ {
298
+ "data": {
299
+ "application/vnd.jupyter.widget-view+json": {
300
+ "model_id": "33f3bd1d30d54874b990c17e34b44bb8",
301
+ "version_major": 2,
302
+ "version_minor": 0
303
+ },
304
+ "text/plain": [
305
+ "Uploading the dataset shards: 0%| | 0/1 [00:00<?, ?it/s]"
306
+ ]
307
+ },
308
+ "metadata": {},
309
+ "output_type": "display_data"
310
+ },
311
+ {
312
+ "data": {
313
+ "application/vnd.jupyter.widget-view+json": {
314
+ "model_id": "17dae484d5ef4a7bb1b2204da34da4ca",
315
+ "version_major": 2,
316
+ "version_minor": 0
317
+ },
318
+ "text/plain": [
319
+ "Creating parquet from Arrow format: 0ba [00:00, ?ba/s]"
320
+ ]
321
+ },
322
+ "metadata": {},
323
+ "output_type": "display_data"
324
+ },
325
+ {
326
+ "name": "stderr",
327
+ "output_type": "stream",
328
+ "text": [
329
+ "No files have been modified since last commit. Skipping to prevent empty commit.\n"
330
+ ]
331
+ },
332
+ {
333
+ "data": {
334
+ "application/vnd.jupyter.widget-view+json": {
335
+ "model_id": "491d1a420a6246fb9d74201437e0d490",
336
+ "version_major": 2,
337
+ "version_minor": 0
338
+ },
339
+ "text/plain": [
340
+ "Uploading the dataset shards: 0%| | 0/1 [00:00<?, ?it/s]"
341
+ ]
342
+ },
343
+ "metadata": {},
344
+ "output_type": "display_data"
345
+ },
346
+ {
347
+ "data": {
348
+ "application/vnd.jupyter.widget-view+json": {
349
+ "model_id": "ea3ec39f1ba145c6a5457bc34912cf72",
350
+ "version_major": 2,
351
+ "version_minor": 0
352
+ },
353
+ "text/plain": [
354
+ "Creating parquet from Arrow format: 0%| | 0/217 [00:00<?, ?ba/s]"
355
+ ]
356
+ },
357
+ "metadata": {},
358
+ "output_type": "display_data"
359
+ },
360
+ {
361
+ "data": {
362
+ "text/plain": [
363
+ "CommitInfo(commit_url='https://huggingface.co/datasets/soldni/jeopardy/commit/1618cf7f59f5e0a5132eb99cd43b3180e359fe78', commit_message='Upload dataset', commit_description='', oid='1618cf7f59f5e0a5132eb99cd43b3180e359fe78', pr_url=None, pr_revision=None, pr_num=None)"
364
+ ]
365
+ },
366
+ "execution_count": 10,
367
+ "metadata": {},
368
+ "output_type": "execute_result"
369
+ }
370
+ ],
371
+ "source": [
372
+ "all_questions = []\n",
373
+ "mosaicml_gauntlet = []\n",
374
+ "for row in old_questions:\n",
375
+ " key = ' '.join([ch for ch in f\"{row['context']} {row['continuation']}\" if ch not in punctuation and ch not in whitespace])\n",
376
+ " all_questions.append(row)\n",
377
+ " row['mosaicml_gauntlet'] = key in new_questions\n",
378
+ " if row['mosaicml_gauntlet']:\n",
379
+ " mosaicml_gauntlet.append(row)\n",
380
+ "\n",
381
+ "mosaicml_gauntlet_dataset = datasets.Dataset.from_list(mosaicml_gauntlet)\n",
382
+ "all_questions_dataset = datasets.Dataset.from_list(all_questions)\n",
383
+ "\n",
384
+ "mosaicml_gauntlet_dataset.push_to_hub(\n",
385
+ " \"soldni/jeopardy\",\n",
386
+ " config_name=\"mosaicml_gauntlet\",\n",
387
+ " data_dir=\"data/mosaicml_gauntlet\"\n",
388
+ ")\n",
389
+ "all_questions_dataset.push_to_hub(\n",
390
+ " \"soldni/jeopardy\",\n",
391
+ " config_name=\"all_questions\",\n",
392
+ " data_dir=\"data/all_questions\"\n",
393
+ ")\n"
394
+ ]
395
+ }
396
+ ],
397
+ "metadata": {
398
+ "kernelspec": {
399
+ "display_name": "dolma",
400
+ "language": "python",
401
+ "name": "python3"
402
+ },
403
+ "language_info": {
404
+ "codemirror_mode": {
405
+ "name": "ipython",
406
+ "version": 3
407
+ },
408
+ "file_extension": ".py",
409
+ "mimetype": "text/x-python",
410
+ "name": "python",
411
+ "nbconvert_exporter": "python",
412
+ "pygments_lexer": "ipython3",
413
+ "version": "3.11.9"
414
+ }
415
+ },
416
+ "nbformat": 4,
417
+ "nbformat_minor": 2
418
+ }
raw/JEOPARDY_QUESTIONS1.json.zst ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e5f60ba1add9d242c6d78ad74dae10002fc2a492a769efc7df9530640cb25a7
3
+ size 8613817
raw/test.jsonl ADDED
The diff for this file is too large to render. See raw diff