lvwerra HF staff commited on
Commit
0c0a1bc
β€’
1 Parent(s): 15f64f0

update notebook

Browse files
Files changed (1) hide show
  1. StackExchangeProcessing.ipynb +278 -123
StackExchangeProcessing.ipynb CHANGED
@@ -2,12 +2,12 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 78,
6
  "id": "7821c501-8c5d-4af6-81cd-caa6ad0bd58c",
7
  "metadata": {},
8
  "outputs": [],
9
  "source": [
10
- "from datasets import load_dataset\n",
11
  "from datasets import concatenate_datasets\n",
12
  "from IPython.display import HTML\n",
13
  "\n",
@@ -19,7 +19,7 @@
19
  },
20
  {
21
  "cell_type": "code",
22
- "execution_count": 2,
23
  "id": "dc821970-efdb-407f-bd79-59da09323280",
24
  "metadata": {
25
  "scrolled": true,
@@ -32,6 +32,19 @@
32
  "text": [
33
  "Found cached dataset parquet (/home/leandro/.cache/huggingface/datasets/HuggingFaceH4___parquet/HuggingFaceH4--stack-exchange-preferences-1d2bff9ecb5ffe2a/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec)\n"
34
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
  ],
37
  "source": [
@@ -41,7 +54,7 @@
41
  },
42
  {
43
  "cell_type": "code",
44
- "execution_count": 6,
45
  "id": "0d8d8729-6d6b-4791-a24a-cb112c399bd0",
46
  "metadata": {},
47
  "outputs": [
@@ -58,7 +71,7 @@
58
  "<IPython.core.display.HTML object>"
59
  ]
60
  },
61
- "execution_count": 6,
62
  "metadata": {},
63
  "output_type": "execute_result"
64
  }
@@ -69,7 +82,7 @@
69
  },
70
  {
71
  "cell_type": "code",
72
- "execution_count": 7,
73
  "id": "b3b60caa-3bd9-4033-ab1c-90c5b08ef3ec",
74
  "metadata": {},
75
  "outputs": [],
@@ -84,7 +97,7 @@
84
  },
85
  {
86
  "cell_type": "code",
87
- "execution_count": 57,
88
  "id": "de1123a0-7468-4d13-a8d3-4011ace36c3c",
89
  "metadata": {},
90
  "outputs": [],
@@ -97,7 +110,7 @@
97
  },
98
  {
99
  "cell_type": "code",
100
- "execution_count": 77,
101
  "id": "c9da64a0-c753-4d35-9369-b70a7a9fa2f9",
102
  "metadata": {},
103
  "outputs": [
@@ -123,7 +136,7 @@
123
  },
124
  {
125
  "cell_type": "code",
126
- "execution_count": 13,
127
  "id": "3bf33a2f-fed5-49e7-8046-e813ad172b17",
128
  "metadata": {},
129
  "outputs": [
@@ -133,7 +146,7 @@
133
  "49.935"
134
  ]
135
  },
136
- "execution_count": 13,
137
  "metadata": {},
138
  "output_type": "execute_result"
139
  }
@@ -144,7 +157,63 @@
144
  },
145
  {
146
  "cell_type": "code",
147
- "execution_count": 58,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  "id": "edc8af18-94a5-49e9-ae73-ce4ba81d9739",
149
  "metadata": {},
150
  "outputs": [],
@@ -164,7 +233,7 @@
164
  },
165
  {
166
  "cell_type": "code",
167
- "execution_count": 63,
168
  "id": "88afe90e-364e-4b21-898b-1c6ceb9cfd32",
169
  "metadata": {},
170
  "outputs": [],
@@ -204,7 +273,7 @@
204
  },
205
  {
206
  "cell_type": "code",
207
- "execution_count": 64,
208
  "id": "ac06aac5-3953-4321-9f1e-6ff210bee82d",
209
  "metadata": {},
210
  "outputs": [
@@ -216,7 +285,7 @@
216
  "version_minor": 0
217
  },
218
  "text/plain": [
219
- "Map (num_proc=60): 0%| | 0/10807695 [00:00<?, ? examples/s]"
220
  ]
221
  },
222
  "metadata": {},
@@ -227,7 +296,49 @@
227
  "output_type": "stream",
228
  "text": [
229
  "/opt/conda/envs/jupyter/lib/python3.8/site-packages/bs4/__init__.py:435: MarkupResemblesLocatorWarning: The input looks more like a filename than markup. You may want to open this file and pass the filehandle into Beautiful Soup.\n",
230
- " warnings.warn(\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  "/opt/conda/envs/jupyter/lib/python3.8/site-packages/bs4/__init__.py:435: MarkupResemblesLocatorWarning: The input looks more like a filename than markup. You may want to open this file and pass the filehandle into Beautiful Soup.\n",
232
  " warnings.warn(\n",
233
  "/opt/conda/envs/jupyter/lib/python3.8/site-packages/bs4/__init__.py:435: MarkupResemblesLocatorWarning: The input looks more like a filename than markup. You may want to open this file and pass the filehandle into Beautiful Soup.\n",
@@ -235,28 +346,64 @@
235
  "/opt/conda/envs/jupyter/lib/python3.8/site-packages/bs4/__init__.py:435: MarkupResemblesLocatorWarning: The input looks more like a filename than markup. You may want to open this file and pass the filehandle into Beautiful Soup.\n",
236
  " warnings.warn(\n"
237
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  }
239
  ],
240
  "source": [
241
- "ds_result = ds.map(preprocess, batch_size=1000, batched=True, num_proc=60)"
242
  ]
243
  },
244
  {
245
  "cell_type": "code",
246
- "execution_count": 65,
247
  "id": "06e3d891-ffde-4762-95d5-39658a1127ef",
248
  "metadata": {},
249
  "outputs": [
250
  {
251
  "data": {
252
  "text/plain": [
253
- "Dataset({\n",
254
- " features: ['qid', 'question', 'answers', 'date', 'metadata', 'response_j', 'response_k'],\n",
255
- " num_rows: 26801833\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  "})"
257
  ]
258
  },
259
- "execution_count": 65,
260
  "metadata": {},
261
  "output_type": "execute_result"
262
  }
@@ -267,56 +414,49 @@
267
  },
268
  {
269
  "cell_type": "code",
270
- "execution_count": 47,
271
  "id": "631416dc-cf19-485d-a2f3-94c9b2cb2bfc",
272
  "metadata": {},
273
  "outputs": [
274
  {
275
  "data": {
276
  "text/plain": [
277
- "{'qid': 1,\n",
278
- " 'question': 'I have been wanting to learn about 3D printing a long time so I really want this site to succeed but I have no previous experience with the subject. \\n\\nI was wondering how can I help the site at this early stage. I thought about asking about how to get started with 3D printing but SE explicitly discourages \"easy\" questions in the private beta.\\n\\nWhat can newbies like me do for the site at this stage besides voting questions and answers?',\n",
279
- " 'answers': [{'answer_id': 14,\n",
280
- " 'author': 'Eric Johnson',\n",
281
- " 'author_id': 43,\n",
282
- " 'author_profile': 'https://3dprinting.meta.stackexchange.com/users/43',\n",
283
- " 'pm_score': 2,\n",
284
- " 'selected': False,\n",
285
- " 'text': '<p>I would suggest doing a bit of basic research on 3D printing (including reading questions and answers). From these you will learn more about it and hopefull you will have new questions about 3D printing that can be asked. </p>\\n\\n<p>If you are looking at getting a 3D printer, you could ask about different features listed and why they make prints better.</p>\\n'},\n",
286
- " {'answer_id': 15,\n",
287
- " 'author': 'kenorb',\n",
288
- " 'author_id': 20,\n",
289
- " 'author_profile': 'https://3dprinting.meta.stackexchange.com/users/20',\n",
290
- " 'pm_score': 2,\n",
291
- " 'selected': False,\n",
292
- " 'text': '<p>That\\'s the goal of the site, learn, research and ask.</p>\\n\\n<p>While you learn, you can always perform other tasks such as:</p>\\n\\n<ul>\\n<li>improve quality posts by proposing edits,</li>\\n<li>be active in meta (propose new ideas or write your opinion which are always welcomed),</li>\\n<li>review <a href=\"https://3dprinting.stackexchange.com/review\">moderation queues</a>,</li>\\n<li>housekeeping - help to keep things organised (e.g. tags),</li>\\n<li>propose descriptions for wiki tags,</li>\\n<li>vote on questions, down-vote bad or propose changes on low-quality posts,</li>\\n<li>and so on.</li>\\n</ul>\\n'},\n",
293
- " {'answer_id': 41,\n",
294
- " 'author': 'Zizouz212',\n",
295
- " 'author_id': 138,\n",
296
- " 'author_profile': 'https://3dprinting.meta.stackexchange.com/users/138',\n",
297
  " 'pm_score': 4,\n",
 
 
 
 
 
 
 
298
  " 'selected': False,\n",
299
- " 'text': '<h1>Vote!</h1>\\n\\n<p>Private Betas love, love, <em>love</em> votes. Without votes, it\\'s difficult to attain privileges, get rewards, and help push us out to public beta.</p>\\n\\n<h1>Ask Questions!</h1>\\n\\n<p>I know you said this:</p>\\n\\n<blockquote>\\n <p>I thought about asking about how to get started with 3D printing but SE explicitly discourages \"easy\" questions in the private beta.</p>\\n</blockquote>\\n\\n<p>But here\\'s the catch. \"Easy\" isn\\'t defined. If you have an \"easy\" question, but it is specific, high-quality, and to the point, and you can show some effort in it, then, please, go ahead and ask it!</p>\\n\\n<h1>Participate!</h1>\\n\\n<p>You have a voice in our meta discussions as well. You also have the authority to suggest edits, to posts, tag wikis, and tag excerpts. They also get you +2 rep for each that is approved, which can help bring you more afloat. You can also give your opinion in scope, by casting close and reopen votes as well :)</p>\\n'}],\n",
300
- " 'date': '2016/01/12',\n",
301
- " 'metadata': ['https://3dprinting.meta.stackexchange.com/questions/1',\n",
302
- " 'https://3dprinting.meta.stackexchange.com',\n",
303
- " 'https://3dprinting.meta.stackexchange.com/users/30/'],\n",
304
- " 'response_j': 'Vote!\\n=====\\n\\nPrivate Betas love, love, *love* votes. Without votes, it\\'s difficult to attain privileges, get rewards, and help push us out to public beta.\\n\\nAsk Questions!\\n==============\\n\\nI know you said this:\\n\\n> \\n> I thought about asking about how to get started with 3D printing but SE explicitly discourages \"easy\" questions in the private beta.\\n> \\n> \\n> \\n\\nBut here\\'s the catch. \"Easy\" isn\\'t defined. If you have an \"easy\" question, but it is specific, high-quality, and to the point, and you can show some effort in it, then, please, go ahead and ask it!\\n\\nParticipate!\\n============\\n\\nYou have a voice in our meta discussions as well. You also have the authority to suggest edits, to posts, tag wikis, and tag excerpts. They also get you +2 rep for each that is approved, which can help bring you more afloat. You can also give your opinion in scope, by casting close and reopen votes as well :)',\n",
305
- " 'response_k': 'I would suggest doing a bit of basic research on 3D printing (including reading questions and answers). From these you will learn more about it and hopefull you will have new questions about 3D printing that can be asked. \\n\\nIf you are looking at getting a 3D printer, you could ask about different features listed and why they make prints better.'}"
306
  ]
307
  },
308
- "execution_count": 47,
309
  "metadata": {},
310
  "output_type": "execute_result"
311
  }
312
  ],
313
  "source": [
314
- "ds_result[0]"
315
  ]
316
  },
317
  {
318
  "cell_type": "code",
319
- "execution_count": 67,
320
  "id": "2c96653b-7a5a-4cae-a327-b6aa77aa5850",
321
  "metadata": {},
322
  "outputs": [],
@@ -326,58 +466,34 @@
326
  },
327
  {
328
  "cell_type": "code",
329
- "execution_count": 71,
330
  "id": "15c2e5ee-7c7d-4e98-9e63-e5d37a9354aa",
331
  "metadata": {},
332
  "outputs": [
333
  {
334
  "data": {
335
  "text/plain": [
336
- "{'qid': 5,\n",
337
- " 'question': 'What are the main differences when using ABS over PLA and vice versa?',\n",
338
- " 'date': '2016/01/12',\n",
339
- " 'metadata': ['https://3dprinting.stackexchange.com/questions/5',\n",
340
- " 'https://3dprinting.stackexchange.com',\n",
341
- " 'https://3dprinting.stackexchange.com/users/11/'],\n",
342
- " 'response_j': \"Paraphrasing [this](http://www.protoparadigm.com/news-updates/the-difference-between-abs-and-pla-for-3d-printing/) site. Feel free to add suggestions in the form of comments and I will try to incorporate them.\\n\\nSummary\\n\\n* ABS: Stronger, machinable, more flexible, and more temperature\\nresistant than PLA. Typically printed on a heated bed. Warping is a common problem when printing ABS.\\n* PLA: Wider range of filaments available, easier and in some cases faster to print. Not as strong as ABS and the fact that its biodegradable could be seen as both a benefit and a drawback.\\n\\nMaterial Properties:\\n\\n* ABS: Strong plastic with mild flexibility. Naturally beige in color. Can be filled and sanded. Higher temperature. Easy to recycle.\\n* PLA: Not as strong as ABS but more rigid. Naturally transparent. More difficult to fill and sand. Can sag in hot temperatures. Sourced from organic matter so it can be broken down in commercial compost facilities.\\n\\nPart Accuracy:\\n\\n* ABS: Part warping is a significant issue. Sharp corners will often be rounded.\\n* PLA: Less heat required contributes to less warping. Becomes more liquid at common extruder temperatures so finer details can be printed.\\n\\nSafety and Handling:\\n\\n* ABS: Strong burning/melting plastic smell is present when printing ABS. Health concerns have been raised regarding airborne ultrafine particles generated while printing with ABS ([ref](https://dx.doi.org/10.1016%2Fj.atmosenv.2013.06.050)). ABS will absorb moisture causing popping when the moisture enters the hot end. This leads to discontinuities in the print job.\\n* PLA: Doesn't smell as strongly when printing due to its organic nature. Moisture can also be absorbed into PLA and can irreversibly damage it.\",\n",
343
- " 'response_k': '> \\n> PLA/ABS general and thermal properties\\n> \\n> \\n> \\n\\n![PLA vs ABS general properties PLA ABS Performance Higher strength Higher rigidity Stronger layer bond Higher impact resistance Higher flexibility Higher temperature resistance higher Tg Quality Sharper details features corners surfaces Process Lower warping Better color Les particle emissions Lower risk of jamming](https://i.stack.imgur.com/atDXf.png)'}"
344
- ]
345
- },
346
- "execution_count": 71,
347
- "metadata": {},
348
- "output_type": "execute_result"
349
- }
350
- ],
351
- "source": [
352
- "ds_result[199]"
353
- ]
354
- },
355
- {
356
- "cell_type": "code",
357
- "execution_count": 72,
358
- "id": "32834c62-86bb-478b-a95f-b44fc28fe7d8",
359
- "metadata": {},
360
- "outputs": [],
361
- "source": [
362
- "ds_result = ds_result.shuffle(seed=42)"
363
- ]
364
- },
365
- {
366
- "cell_type": "code",
367
- "execution_count": 73,
368
- "id": "ae6dcb5b-b549-438d-984d-ecd54919afa1",
369
- "metadata": {},
370
- "outputs": [
371
- {
372
- "data": {
373
- "text/plain": [
374
- "Dataset({\n",
375
- " features: ['qid', 'question', 'date', 'metadata', 'response_j', 'response_k'],\n",
376
- " num_rows: 26801833\n",
377
  "})"
378
  ]
379
  },
380
- "execution_count": 73,
381
  "metadata": {},
382
  "output_type": "execute_result"
383
  }
@@ -388,35 +504,29 @@
388
  },
389
  {
390
  "cell_type": "code",
391
- "execution_count": 74,
392
- "id": "a5c0d187-aafe-4138-8951-bccdb4777d6d",
393
  "metadata": {},
394
  "outputs": [
395
  {
396
- "data": {
397
- "text/plain": [
398
- "{'qid': 48865595,\n",
399
- " 'question': 'I am using [AGM maps](https://angular-maps.com/) for my angular 4 application, there I am facing issues, I will be having the multiple markers which are fetched from api as an array of Latitude and Longitude. I want to set the zoom level exactly covering all the markers on the map. Even if one marker in one country and other in some other country also, It should set the zoom level on load to show all the markers on the map.\\n Is there a way to do that in AGM angular maps? Could anyone please help me',\n",
400
- " 'date': '2018/02/19',\n",
401
- " 'metadata': ['https://Stackoverflow.com/questions/48865595',\n",
402
- " 'https://Stackoverflow.com',\n",
403
- " 'https://Stackoverflow.com/users/4715138/'],\n",
404
- " 'response_j': 'Since September 2018 there is the [`AgmFitBounds`](https://angular-maps.com/api-docs/agm-core/directives/agmfitbounds) directive. Super easy.\\n\\n```\\n<agm-map\\n style=\"width:100vw; height:100vh;\"\\n [fitBounds]=\"true\">\\n\\n <agm-marker\\n *ngFor=\"let location of locations\"\\n [latitude]=\"location.latitude\"\\n [longitude]=\"location.longitude\"\\n [agmFitBounds]=\"true\"></agm-marker>\\n</agm-map>\\n\\n```',\n",
405
- " 'response_k': '@renil-babu\\n\\nInstead of doing the `fitBounds` on `mapReady`, you have to do it in your adding markers subscription block\\n\\n```\\n const bounds: LatLngBounds = new google.maps.LatLngBounds();\\n for (const mm of this.markers) {\\n bounds.extend(new google.maps.LatLng(mm.lat, mm.lng));\\n }\\n // @ts-ignore\\n this.agmMap._mapsWrapper.fitBounds(bounds);\\n\\n```'}"
406
- ]
407
- },
408
- "execution_count": 74,
409
- "metadata": {},
410
- "output_type": "execute_result"
411
  }
412
  ],
413
  "source": [
414
- "ds_result[0]"
 
415
  ]
416
  },
417
  {
418
  "cell_type": "code",
419
- "execution_count": 75,
420
  "id": "e32c11d7-a88e-4d92-9dfc-92b2a67c5455",
421
  "metadata": {},
422
  "outputs": [],
@@ -436,7 +546,7 @@
436
  " shard.to_parquet(filename)\n",
437
  "\n",
438
  "\n",
439
- "def save_manual_shards(ds, user=\"lvwerra\", remote_dataset_repo=\"stack-exchange-paired\"):\n",
440
  " \"\"\"Save sharded data\n",
441
  " Args:\n",
442
  " ds (Dataset): dataset to be saved\n",
@@ -458,7 +568,10 @@
458
  " )\n",
459
  "\n",
460
  " # files will be numerous we save them in a folder called data inside out_path\n",
461
- " os.mkdir(out_path + \"/data\")\n",
 
 
 
462
  " SHARD_SIZE = 1000 << 20\n",
463
  " if ds._indices is not None:\n",
464
  " dataset_nbytes = ds.data.nbytes * len(ds._indices) / len(ds.data)\n",
@@ -475,7 +588,7 @@
475
  " )\n",
476
  " # use f\"{OUT_PATH}/data/train-{index:05d}-of-{num_shards:05d}.json\" instead for json files\n",
477
  " filenames = (\n",
478
- " f\"{out_path}/data/train-{index:05d}-of-{num_shards:05d}.parquet\"\n",
479
  " for index in range(num_shards)\n",
480
  " )\n",
481
  "\n",
@@ -492,22 +605,63 @@
492
  },
493
  {
494
  "cell_type": "code",
495
- "execution_count": 76,
496
  "id": "a90664eb-5c54-4fae-9a8a-d509bb2abdfe",
497
  "metadata": {},
498
  "outputs": [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
499
  {
500
  "name": "stderr",
501
  "output_type": "stream",
502
  "text": [
503
- "Cloning https://huggingface.co/datasets/lvwerra/stack-exchange-paired into local empty directory.\n"
504
  ]
505
  },
506
  {
507
  "name": "stdout",
508
  "output_type": "stream",
509
  "text": [
510
- "Number of shards: 72\n",
 
511
  "sharding the dataset\n"
512
  ]
513
  },
@@ -515,19 +669,20 @@
515
  "name": "stderr",
516
  "output_type": "stream",
517
  "text": [
518
- "100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 72/72 [03:50<00:00, 3.20s/it]\n"
519
  ]
520
  },
521
  {
522
  "name": "stdout",
523
  "output_type": "stream",
524
  "text": [
525
- "Time to save dataset: 231.51\n"
526
  ]
527
  }
528
  ],
529
  "source": [
530
- "save_manual_shards(ds_result)"
 
531
  ]
532
  },
533
  {
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 86,
6
  "id": "7821c501-8c5d-4af6-81cd-caa6ad0bd58c",
7
  "metadata": {},
8
  "outputs": [],
9
  "source": [
10
+ "from datasets import load_dataset, DatasetDict\n",
11
  "from datasets import concatenate_datasets\n",
12
  "from IPython.display import HTML\n",
13
  "\n",
 
19
  },
20
  {
21
  "cell_type": "code",
22
+ "execution_count": 80,
23
  "id": "dc821970-efdb-407f-bd79-59da09323280",
24
  "metadata": {
25
  "scrolled": true,
 
32
  "text": [
33
  "Found cached dataset parquet (/home/leandro/.cache/huggingface/datasets/HuggingFaceH4___parquet/HuggingFaceH4--stack-exchange-preferences-1d2bff9ecb5ffe2a/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec)\n"
34
  ]
35
+ },
36
+ {
37
+ "data": {
38
+ "text/plain": [
39
+ "Dataset({\n",
40
+ " features: ['qid', 'question', 'answers', 'date', 'metadata'],\n",
41
+ " num_rows: 10807695\n",
42
+ "})"
43
+ ]
44
+ },
45
+ "execution_count": 80,
46
+ "metadata": {},
47
+ "output_type": "execute_result"
48
  }
49
  ],
50
  "source": [
 
54
  },
55
  {
56
  "cell_type": "code",
57
+ "execution_count": 81,
58
  "id": "0d8d8729-6d6b-4791-a24a-cb112c399bd0",
59
  "metadata": {},
60
  "outputs": [
 
71
  "<IPython.core.display.HTML object>"
72
  ]
73
  },
74
+ "execution_count": 81,
75
  "metadata": {},
76
  "output_type": "execute_result"
77
  }
 
82
  },
83
  {
84
  "cell_type": "code",
85
+ "execution_count": 82,
86
  "id": "b3b60caa-3bd9-4033-ab1c-90c5b08ef3ec",
87
  "metadata": {},
88
  "outputs": [],
 
97
  },
98
  {
99
  "cell_type": "code",
100
+ "execution_count": 83,
101
  "id": "de1123a0-7468-4d13-a8d3-4011ace36c3c",
102
  "metadata": {},
103
  "outputs": [],
 
110
  },
111
  {
112
  "cell_type": "code",
113
+ "execution_count": 84,
114
  "id": "c9da64a0-c753-4d35-9369-b70a7a9fa2f9",
115
  "metadata": {},
116
  "outputs": [
 
136
  },
137
  {
138
  "cell_type": "code",
139
+ "execution_count": 85,
140
  "id": "3bf33a2f-fed5-49e7-8046-e813ad172b17",
141
  "metadata": {},
142
  "outputs": [
 
146
  "49.935"
147
  ]
148
  },
149
+ "execution_count": 85,
150
  "metadata": {},
151
  "output_type": "execute_result"
152
  }
 
157
  },
158
  {
159
  "cell_type": "code",
160
+ "execution_count": 87,
161
+ "id": "88ea2dd5-b885-4f65-bae3-1319c7816044",
162
+ "metadata": {},
163
+ "outputs": [],
164
+ "source": [
165
+ "ds = ds.shuffle(seed=42)\n",
166
+ "index = list(range(len(ds)))\n",
167
+ "\n",
168
+ "ds_splits = DatasetDict({\n",
169
+ " \"finetune\": ds.select(index[:3_000_000]),\n",
170
+ " \"reward\": ds.select(index[3_000_000:6_000_000]),\n",
171
+ " \"rl\": ds.select(index[6_000_000:9_000_000]),\n",
172
+ " \"evaluation\": ds.select(index[9_000_000:]),\n",
173
+ "})"
174
+ ]
175
+ },
176
+ {
177
+ "cell_type": "code",
178
+ "execution_count": 88,
179
+ "id": "1607922d-f585-4de7-be70-2205b5170102",
180
+ "metadata": {},
181
+ "outputs": [
182
+ {
183
+ "data": {
184
+ "text/plain": [
185
+ "DatasetDict({\n",
186
+ " finetune: Dataset({\n",
187
+ " features: ['qid', 'question', 'answers', 'date', 'metadata'],\n",
188
+ " num_rows: 3000000\n",
189
+ " })\n",
190
+ " reward: Dataset({\n",
191
+ " features: ['qid', 'question', 'answers', 'date', 'metadata'],\n",
192
+ " num_rows: 3000000\n",
193
+ " })\n",
194
+ " rl: Dataset({\n",
195
+ " features: ['qid', 'question', 'answers', 'date', 'metadata'],\n",
196
+ " num_rows: 3000000\n",
197
+ " })\n",
198
+ " evaluation: Dataset({\n",
199
+ " features: ['qid', 'question', 'answers', 'date', 'metadata'],\n",
200
+ " num_rows: 1807695\n",
201
+ " })\n",
202
+ "})"
203
+ ]
204
+ },
205
+ "execution_count": 88,
206
+ "metadata": {},
207
+ "output_type": "execute_result"
208
+ }
209
+ ],
210
+ "source": [
211
+ "ds_splits"
212
+ ]
213
+ },
214
+ {
215
+ "cell_type": "code",
216
+ "execution_count": 89,
217
  "id": "edc8af18-94a5-49e9-ae73-ce4ba81d9739",
218
  "metadata": {},
219
  "outputs": [],
 
233
  },
234
  {
235
  "cell_type": "code",
236
+ "execution_count": 90,
237
  "id": "88afe90e-364e-4b21-898b-1c6ceb9cfd32",
238
  "metadata": {},
239
  "outputs": [],
 
273
  },
274
  {
275
  "cell_type": "code",
276
+ "execution_count": 91,
277
  "id": "ac06aac5-3953-4321-9f1e-6ff210bee82d",
278
  "metadata": {},
279
  "outputs": [
 
285
  "version_minor": 0
286
  },
287
  "text/plain": [
288
+ "Map (num_proc=60): 0%| | 0/3000000 [00:00<?, ? examples/s]"
289
  ]
290
  },
291
  "metadata": {},
 
296
  "output_type": "stream",
297
  "text": [
298
  "/opt/conda/envs/jupyter/lib/python3.8/site-packages/bs4/__init__.py:435: MarkupResemblesLocatorWarning: The input looks more like a filename than markup. You may want to open this file and pass the filehandle into Beautiful Soup.\n",
299
+ " warnings.warn(\n"
300
+ ]
301
+ },
302
+ {
303
+ "data": {
304
+ "application/vnd.jupyter.widget-view+json": {
305
+ "model_id": "",
306
+ "version_major": 2,
307
+ "version_minor": 0
308
+ },
309
+ "text/plain": [
310
+ "Map (num_proc=60): 0%| | 0/3000000 [00:00<?, ? examples/s]"
311
+ ]
312
+ },
313
+ "metadata": {},
314
+ "output_type": "display_data"
315
+ },
316
+ {
317
+ "name": "stderr",
318
+ "output_type": "stream",
319
+ "text": [
320
+ "/opt/conda/envs/jupyter/lib/python3.8/site-packages/bs4/__init__.py:435: MarkupResemblesLocatorWarning: The input looks more like a filename than markup. You may want to open this file and pass the filehandle into Beautiful Soup.\n",
321
+ " warnings.warn(\n"
322
+ ]
323
+ },
324
+ {
325
+ "data": {
326
+ "application/vnd.jupyter.widget-view+json": {
327
+ "model_id": "",
328
+ "version_major": 2,
329
+ "version_minor": 0
330
+ },
331
+ "text/plain": [
332
+ "Map (num_proc=60): 0%| | 0/3000000 [00:00<?, ? examples/s]"
333
+ ]
334
+ },
335
+ "metadata": {},
336
+ "output_type": "display_data"
337
+ },
338
+ {
339
+ "name": "stderr",
340
+ "output_type": "stream",
341
+ "text": [
342
  "/opt/conda/envs/jupyter/lib/python3.8/site-packages/bs4/__init__.py:435: MarkupResemblesLocatorWarning: The input looks more like a filename than markup. You may want to open this file and pass the filehandle into Beautiful Soup.\n",
343
  " warnings.warn(\n",
344
  "/opt/conda/envs/jupyter/lib/python3.8/site-packages/bs4/__init__.py:435: MarkupResemblesLocatorWarning: The input looks more like a filename than markup. You may want to open this file and pass the filehandle into Beautiful Soup.\n",
 
346
  "/opt/conda/envs/jupyter/lib/python3.8/site-packages/bs4/__init__.py:435: MarkupResemblesLocatorWarning: The input looks more like a filename than markup. You may want to open this file and pass the filehandle into Beautiful Soup.\n",
347
  " warnings.warn(\n"
348
  ]
349
+ },
350
+ {
351
+ "data": {
352
+ "application/vnd.jupyter.widget-view+json": {
353
+ "model_id": "",
354
+ "version_major": 2,
355
+ "version_minor": 0
356
+ },
357
+ "text/plain": [
358
+ "Map (num_proc=60): 0%| | 0/1807695 [00:00<?, ? examples/s]"
359
+ ]
360
+ },
361
+ "metadata": {},
362
+ "output_type": "display_data"
363
+ },
364
+ {
365
+ "name": "stderr",
366
+ "output_type": "stream",
367
+ "text": [
368
+ "/opt/conda/envs/jupyter/lib/python3.8/site-packages/bs4/__init__.py:435: MarkupResemblesLocatorWarning: The input looks more like a filename than markup. You may want to open this file and pass the filehandle into Beautiful Soup.\n",
369
+ " warnings.warn(\n"
370
+ ]
371
  }
372
  ],
373
  "source": [
374
+ "ds_result = ds_splits.map(preprocess, batch_size=1000, batched=True, num_proc=60)"
375
  ]
376
  },
377
  {
378
  "cell_type": "code",
379
+ "execution_count": 92,
380
  "id": "06e3d891-ffde-4762-95d5-39658a1127ef",
381
  "metadata": {},
382
  "outputs": [
383
  {
384
  "data": {
385
  "text/plain": [
386
+ "DatasetDict({\n",
387
+ " finetune: Dataset({\n",
388
+ " features: ['qid', 'question', 'answers', 'date', 'metadata', 'response_j', 'response_k'],\n",
389
+ " num_rows: 7440923\n",
390
+ " })\n",
391
+ " reward: Dataset({\n",
392
+ " features: ['qid', 'question', 'answers', 'date', 'metadata', 'response_j', 'response_k'],\n",
393
+ " num_rows: 7441998\n",
394
+ " })\n",
395
+ " rl: Dataset({\n",
396
+ " features: ['qid', 'question', 'answers', 'date', 'metadata', 'response_j', 'response_k'],\n",
397
+ " num_rows: 7435908\n",
398
+ " })\n",
399
+ " evaluation: Dataset({\n",
400
+ " features: ['qid', 'question', 'answers', 'date', 'metadata', 'response_j', 'response_k'],\n",
401
+ " num_rows: 4483004\n",
402
+ " })\n",
403
  "})"
404
  ]
405
  },
406
+ "execution_count": 92,
407
  "metadata": {},
408
  "output_type": "execute_result"
409
  }
 
414
  },
415
  {
416
  "cell_type": "code",
417
+ "execution_count": 93,
418
  "id": "631416dc-cf19-485d-a2f3-94c9b2cb2bfc",
419
  "metadata": {},
420
  "outputs": [
421
  {
422
  "data": {
423
  "text/plain": [
424
+ "{'qid': 12891264,\n",
425
+ " 'question': \"I am using jQuery fileupload plugin and I want to do some custom jQuery stuff once fileupload is done\\n\\nfrom here <https://github.com/blueimp/jQuery-File-Upload/wiki/Options>\\n\\nNow it says this\\n\\n```\\nCallback for successful upload requests.\\n$('#fileupload')\\n .bind('fileuploaddone', function (e, data) {/* ... */})\\n\\n```\\n\\nNow I have defined this custom function for testing in my own js file\\n\\n```\\n$('#fileupload').bind('fileuploaddone', function (e, data) {/* ... */\\nalert('Hello');\\n})\\n\\n```\\n\\nBut it's not working.\\n\\nBut if I edit the main file in here\\n\\n```\\n // Callback for successful uploads:\\n done: function (e, data) {\\n\\n```\\n\\nThen it works.\",\n",
426
+ " 'answers': [{'answer_id': 12891484,\n",
427
+ " 'author': 'Reflective',\n",
428
+ " 'author_id': 1686626,\n",
429
+ " 'author_profile': 'https://Stackoverflow.com/users/1686626',\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
  " 'pm_score': 4,\n",
431
+ " 'selected': True,\n",
432
+ " 'text': \"<p>Looking at the library code, seems all events are renamed removing 'fileupload' ... so 'fileuploaddone' becomes just 'done'. It is valid for all other callbacks.\\nlook at this section:</p>\\n\\n<pre><code> // Other callbacks:\\n // Callback for the submit event of each file upload:\\n // submit: function (e, data) {}, // .bind('fileuploadsubmit', func);\\n // Callback for the start of each file upload request:\\n // send: function (e, data) {}, // .bind('fileuploadsend', func);\\n // Callback for successful uploads:\\n // done: function (e, data) {}, // .bind('fileuploaddone', func);\\n // Callback for failed (abort or error) uploads:\\n // fail: function (e, data) {}, // .bind('fileuploadfail', func);\\n // Callback for completed (success, abort or error) requests:\\n // always: function (e, data) {}, // .bind('fileuploadalways', func);\\n // Callback for upload progress events:\\n // progress: function (e, data) {}, // .bind('fileuploadprogress', func);\\n // Callback for global upload progress events:\\n // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);\\n // Callback for uploads start, equivalent to the global ajaxStart event:\\n // start: function (e) {}, // .bind('fileuploadstart', func);\\n // Callback for uploads stop, equivalent to the global ajaxStop event:\\n // stop: function (e) {}, // .bind('fileuploadstop', func);\\n // Callback for change events of the fileInput(s):\\n // change: function (e, data) {}, // .bind('fileuploadchange', func);\\n // Callback for paste events to the pasteZone(s):\\n // paste: function (e, data) {}, // .bind('fileuploadpaste', func);\\n // Callback for drop events of the dropZone(s):\\n // drop: function (e, data) {}, // .bind('fileuploaddrop', func);\\n // Callback for dragover events of the dropZone(s):\\n // dragover: function (e) {}, // .bind('fileuploaddragover', func);\\n</code></pre>\\n\\n<p>If you have some doubts about what's happening, just look at the code inside. This library is not compressed so it is easy to see. for example</p>\\n\\n<pre><code>// start: function (e) {}, // .bind('fileuploadstart', func);\\n</code></pre>\\n\\n<p><code>start</code> callback is implemented. <code>fileuploadstart</code> is not.</p>\\n\"},\n",
433
+ " {'answer_id': 15419140,\n",
434
+ " 'author': 'NXT',\n",
435
+ " 'author_id': 1554649,\n",
436
+ " 'author_profile': 'https://Stackoverflow.com/users/1554649',\n",
437
+ " 'pm_score': 3,\n",
438
  " 'selected': False,\n",
439
+ " 'text': '<p>Check if the server-side uploading script returns a JSON reply - in my case it didn\\'t work when the reply was empty, but file was uploaded successfully.</p>\\n\\n<p>So, below is working for me with jQuery 1.9.1 and the newest version of the \"jQuery File Upload Plugin\" - 5.21.3</p>\\n\\n<pre><code>$(\"#fileupload\").bind(\"fileuploaddone\", function (e, data) {\\n console.log(\"fileuploaddone event fired\");\\n});\\n</code></pre>\\n'}],\n",
440
+ " 'date': '2012/10/15',\n",
441
+ " 'metadata': ['https://Stackoverflow.com/questions/12891264',\n",
442
+ " 'https://Stackoverflow.com',\n",
443
+ " 'https://Stackoverflow.com/users/767244/'],\n",
444
+ " 'response_j': \"Looking at the library code, seems all events are renamed removing 'fileupload' ... so 'fileuploaddone' becomes just 'done'. It is valid for all other callbacks.\\nlook at this section:\\n\\n```\\n // Other callbacks:\\n // Callback for the submit event of each file upload:\\n // submit: function (e, data) {}, // .bind('fileuploadsubmit', func);\\n // Callback for the start of each file upload request:\\n // send: function (e, data) {}, // .bind('fileuploadsend', func);\\n // Callback for successful uploads:\\n // done: function (e, data) {}, // .bind('fileuploaddone', func);\\n // Callback for failed (abort or error) uploads:\\n // fail: function (e, data) {}, // .bind('fileuploadfail', func);\\n // Callback for completed (success, abort or error) requests:\\n // always: function (e, data) {}, // .bind('fileuploadalways', func);\\n // Callback for upload progress events:\\n // progress: function (e, data) {}, // .bind('fileuploadprogress', func);\\n // Callback for global upload progress events:\\n // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);\\n // Callback for uploads start, equivalent to the global ajaxStart event:\\n // start: function (e) {}, // .bind('fileuploadstart', func);\\n // Callback for uploads stop, equivalent to the global ajaxStop event:\\n // stop: function (e) {}, // .bind('fileuploadstop', func);\\n // Callback for change events of the fileInput(s):\\n // change: function (e, data) {}, // .bind('fileuploadchange', func);\\n // Callback for paste events to the pasteZone(s):\\n // paste: function (e, data) {}, // .bind('fileuploadpaste', func);\\n // Callback for drop events of the dropZone(s):\\n // drop: function (e, data) {}, // .bind('fileuploaddrop', func);\\n // Callback for dragover events of the dropZone(s):\\n // dragover: function (e) {}, // .bind('fileuploaddragover', func);\\n\\n```\\n\\nIf you have some doubts about what's happening, just look at the code inside. This library is not compressed so it is easy to see. for example\\n\\n```\\n// start: function (e) {}, // .bind('fileuploadstart', func);\\n\\n```\\n\\n`start` callback is implemented. `fileuploadstart` is not.\",\n",
445
+ " 'response_k': 'Check if the server-side uploading script returns a JSON reply - in my case it didn\\'t work when the reply was empty, but file was uploaded successfully.\\n\\nSo, below is working for me with jQuery 1.9.1 and the newest version of the \"jQuery File Upload Plugin\" - 5.21.3\\n\\n```\\n$(\"#fileupload\").bind(\"fileuploaddone\", function (e, data) {\\n console.log(\"fileuploaddone event fired\");\\n});\\n\\n```'}"
446
  ]
447
  },
448
+ "execution_count": 93,
449
  "metadata": {},
450
  "output_type": "execute_result"
451
  }
452
  ],
453
  "source": [
454
+ "ds_result[\"finetune\"][0]"
455
  ]
456
  },
457
  {
458
  "cell_type": "code",
459
+ "execution_count": 94,
460
  "id": "2c96653b-7a5a-4cae-a327-b6aa77aa5850",
461
  "metadata": {},
462
  "outputs": [],
 
466
  },
467
  {
468
  "cell_type": "code",
469
+ "execution_count": 95,
470
  "id": "15c2e5ee-7c7d-4e98-9e63-e5d37a9354aa",
471
  "metadata": {},
472
  "outputs": [
473
  {
474
  "data": {
475
  "text/plain": [
476
+ "DatasetDict({\n",
477
+ " finetune: Dataset({\n",
478
+ " features: ['qid', 'question', 'date', 'metadata', 'response_j', 'response_k'],\n",
479
+ " num_rows: 7440923\n",
480
+ " })\n",
481
+ " reward: Dataset({\n",
482
+ " features: ['qid', 'question', 'date', 'metadata', 'response_j', 'response_k'],\n",
483
+ " num_rows: 7441998\n",
484
+ " })\n",
485
+ " rl: Dataset({\n",
486
+ " features: ['qid', 'question', 'date', 'metadata', 'response_j', 'response_k'],\n",
487
+ " num_rows: 7435908\n",
488
+ " })\n",
489
+ " evaluation: Dataset({\n",
490
+ " features: ['qid', 'question', 'date', 'metadata', 'response_j', 'response_k'],\n",
491
+ " num_rows: 4483004\n",
492
+ " })\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
493
  "})"
494
  ]
495
  },
496
+ "execution_count": 95,
497
  "metadata": {},
498
  "output_type": "execute_result"
499
  }
 
504
  },
505
  {
506
  "cell_type": "code",
507
+ "execution_count": 96,
508
+ "id": "4d42b35c-5252-4b49-ba4b-20818bc9e086",
509
  "metadata": {},
510
  "outputs": [
511
  {
512
+ "name": "stdout",
513
+ "output_type": "stream",
514
+ "text": [
515
+ "finetune\n",
516
+ "reward\n",
517
+ "rl\n",
518
+ "evaluation\n"
519
+ ]
 
 
 
 
 
 
 
520
  }
521
  ],
522
  "source": [
523
+ "for key in ds_result:\n",
524
+ " print(key)"
525
  ]
526
  },
527
  {
528
  "cell_type": "code",
529
+ "execution_count": 100,
530
  "id": "e32c11d7-a88e-4d92-9dfc-92b2a67c5455",
531
  "metadata": {},
532
  "outputs": [],
 
546
  " shard.to_parquet(filename)\n",
547
  "\n",
548
  "\n",
549
+ "def save_manual_shards(ds, user=\"lvwerra\", remote_dataset_repo=\"stack-exchange-paired\", subfolder=\"train\"):\n",
550
  " \"\"\"Save sharded data\n",
551
  " Args:\n",
552
  " ds (Dataset): dataset to be saved\n",
 
568
  " )\n",
569
  "\n",
570
  " # files will be numerous we save them in a folder called data inside out_path\n",
571
+ " if not os.path.exists(out_path):\n",
572
+ " os.mkdir(out_path + \"/data\")\n",
573
+ " os.mkdir(out_path + f\"/data/{subfolder}\")\n",
574
+ " \n",
575
  " SHARD_SIZE = 1000 << 20\n",
576
  " if ds._indices is not None:\n",
577
  " dataset_nbytes = ds.data.nbytes * len(ds._indices) / len(ds.data)\n",
 
588
  " )\n",
589
  " # use f\"{OUT_PATH}/data/train-{index:05d}-of-{num_shards:05d}.json\" instead for json files\n",
590
  " filenames = (\n",
591
+ " f\"{out_path}/data/{subfolder}/train-{index:05d}-of-{num_shards:05d}.parquet\"\n",
592
  " for index in range(num_shards)\n",
593
  " )\n",
594
  "\n",
 
605
  },
606
  {
607
  "cell_type": "code",
608
+ "execution_count": 101,
609
  "id": "a90664eb-5c54-4fae-9a8a-d509bb2abdfe",
610
  "metadata": {},
611
  "outputs": [
612
+ {
613
+ "name": "stdout",
614
+ "output_type": "stream",
615
+ "text": [
616
+ "Number of shards: 20\n",
617
+ "sharding the dataset\n"
618
+ ]
619
+ },
620
+ {
621
+ "name": "stderr",
622
+ "output_type": "stream",
623
+ "text": [
624
+ "100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 20/20 [00:28<00:00, 1.43s/it]\n"
625
+ ]
626
+ },
627
+ {
628
+ "name": "stdout",
629
+ "output_type": "stream",
630
+ "text": [
631
+ "Time to save dataset: 29.15\n",
632
+ "Number of shards: 20\n",
633
+ "sharding the dataset\n"
634
+ ]
635
+ },
636
+ {
637
+ "name": "stderr",
638
+ "output_type": "stream",
639
+ "text": [
640
+ "100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 20/20 [00:22<00:00, 1.15s/it]\n"
641
+ ]
642
+ },
643
+ {
644
+ "name": "stdout",
645
+ "output_type": "stream",
646
+ "text": [
647
+ "Time to save dataset: 23.42\n",
648
+ "Number of shards: 20\n",
649
+ "sharding the dataset\n"
650
+ ]
651
+ },
652
  {
653
  "name": "stderr",
654
  "output_type": "stream",
655
  "text": [
656
+ "100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 20/20 [00:10<00:00, 1.83it/s]\n"
657
  ]
658
  },
659
  {
660
  "name": "stdout",
661
  "output_type": "stream",
662
  "text": [
663
+ "Time to save dataset: 11.36\n",
664
+ "Number of shards: 12\n",
665
  "sharding the dataset\n"
666
  ]
667
  },
 
669
  "name": "stderr",
670
  "output_type": "stream",
671
  "text": [
672
+ "100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 12/12 [00:10<00:00, 1.12it/s]\n"
673
  ]
674
  },
675
  {
676
  "name": "stdout",
677
  "output_type": "stream",
678
  "text": [
679
+ "Time to save dataset: 11.13\n"
680
  ]
681
  }
682
  ],
683
  "source": [
684
+ "for key in ds_result:\n",
685
+ " save_manual_shards(ds_result[key], subfolder=key)"
686
  ]
687
  },
688
  {