Antoniskaraolis commited on
Commit
3f7a3a9
·
verified ·
1 Parent(s): ac888bf

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -1021
app.py DELETED
@@ -1,1021 +0,0 @@
1
- {
2
- "nbformat": 4,
3
- "nbformat_minor": 0,
4
- "metadata": {
5
- "colab": {
6
- "provenance": []
7
- },
8
- "kernelspec": {
9
- "name": "python3",
10
- "display_name": "Python 3"
11
- },
12
- "language_info": {
13
- "name": "python"
14
- },
15
- "widgets": {
16
- "application/vnd.jupyter.widget-state+json": {
17
- "c083c2266f934a1aa97993396bc7cb70": {
18
- "model_module": "@jupyter-widgets/controls",
19
- "model_name": "HBoxModel",
20
- "model_module_version": "1.5.0",
21
- "state": {
22
- "_dom_classes": [],
23
- "_model_module": "@jupyter-widgets/controls",
24
- "_model_module_version": "1.5.0",
25
- "_model_name": "HBoxModel",
26
- "_view_count": null,
27
- "_view_module": "@jupyter-widgets/controls",
28
- "_view_module_version": "1.5.0",
29
- "_view_name": "HBoxView",
30
- "box_style": "",
31
- "children": [
32
- "IPY_MODEL_5e41dc1da0af4ca9bd15aa06dfe181cc",
33
- "IPY_MODEL_1e14b0bf051947c8aa2c52e962c519e9",
34
- "IPY_MODEL_0f10d680af0149bd85dc3ee99611b404"
35
- ],
36
- "layout": "IPY_MODEL_9774acbd2d10469faba55e7cce5989c4"
37
- }
38
- },
39
- "5e41dc1da0af4ca9bd15aa06dfe181cc": {
40
- "model_module": "@jupyter-widgets/controls",
41
- "model_name": "HTMLModel",
42
- "model_module_version": "1.5.0",
43
- "state": {
44
- "_dom_classes": [],
45
- "_model_module": "@jupyter-widgets/controls",
46
- "_model_module_version": "1.5.0",
47
- "_model_name": "HTMLModel",
48
- "_view_count": null,
49
- "_view_module": "@jupyter-widgets/controls",
50
- "_view_module_version": "1.5.0",
51
- "_view_name": "HTMLView",
52
- "description": "",
53
- "description_tooltip": null,
54
- "layout": "IPY_MODEL_d7c5d768c14549dfac849f116e992e62",
55
- "placeholder": "​",
56
- "style": "IPY_MODEL_adc2e977fd5941de8a7f7e427fde6b96",
57
- "value": "Batches: 100%"
58
- }
59
- },
60
- "1e14b0bf051947c8aa2c52e962c519e9": {
61
- "model_module": "@jupyter-widgets/controls",
62
- "model_name": "FloatProgressModel",
63
- "model_module_version": "1.5.0",
64
- "state": {
65
- "_dom_classes": [],
66
- "_model_module": "@jupyter-widgets/controls",
67
- "_model_module_version": "1.5.0",
68
- "_model_name": "FloatProgressModel",
69
- "_view_count": null,
70
- "_view_module": "@jupyter-widgets/controls",
71
- "_view_module_version": "1.5.0",
72
- "_view_name": "ProgressView",
73
- "bar_style": "success",
74
- "description": "",
75
- "description_tooltip": null,
76
- "layout": "IPY_MODEL_421f286f91334ec183d7f73d54720573",
77
- "max": 16,
78
- "min": 0,
79
- "orientation": "horizontal",
80
- "style": "IPY_MODEL_d643bd30eee7486197f88eb7e97b8483",
81
- "value": 16
82
- }
83
- },
84
- "0f10d680af0149bd85dc3ee99611b404": {
85
- "model_module": "@jupyter-widgets/controls",
86
- "model_name": "HTMLModel",
87
- "model_module_version": "1.5.0",
88
- "state": {
89
- "_dom_classes": [],
90
- "_model_module": "@jupyter-widgets/controls",
91
- "_model_module_version": "1.5.0",
92
- "_model_name": "HTMLModel",
93
- "_view_count": null,
94
- "_view_module": "@jupyter-widgets/controls",
95
- "_view_module_version": "1.5.0",
96
- "_view_name": "HTMLView",
97
- "description": "",
98
- "description_tooltip": null,
99
- "layout": "IPY_MODEL_4f094db2d5644ac5afe9d29709db205b",
100
- "placeholder": "​",
101
- "style": "IPY_MODEL_96e07c6f046741999326f844c361f417",
102
- "value": " 16/16 [01:49<00:00,  5.36s/it]"
103
- }
104
- },
105
- "9774acbd2d10469faba55e7cce5989c4": {
106
- "model_module": "@jupyter-widgets/base",
107
- "model_name": "LayoutModel",
108
- "model_module_version": "1.2.0",
109
- "state": {
110
- "_model_module": "@jupyter-widgets/base",
111
- "_model_module_version": "1.2.0",
112
- "_model_name": "LayoutModel",
113
- "_view_count": null,
114
- "_view_module": "@jupyter-widgets/base",
115
- "_view_module_version": "1.2.0",
116
- "_view_name": "LayoutView",
117
- "align_content": null,
118
- "align_items": null,
119
- "align_self": null,
120
- "border": null,
121
- "bottom": null,
122
- "display": null,
123
- "flex": null,
124
- "flex_flow": null,
125
- "grid_area": null,
126
- "grid_auto_columns": null,
127
- "grid_auto_flow": null,
128
- "grid_auto_rows": null,
129
- "grid_column": null,
130
- "grid_gap": null,
131
- "grid_row": null,
132
- "grid_template_areas": null,
133
- "grid_template_columns": null,
134
- "grid_template_rows": null,
135
- "height": null,
136
- "justify_content": null,
137
- "justify_items": null,
138
- "left": null,
139
- "margin": null,
140
- "max_height": null,
141
- "max_width": null,
142
- "min_height": null,
143
- "min_width": null,
144
- "object_fit": null,
145
- "object_position": null,
146
- "order": null,
147
- "overflow": null,
148
- "overflow_x": null,
149
- "overflow_y": null,
150
- "padding": null,
151
- "right": null,
152
- "top": null,
153
- "visibility": null,
154
- "width": null
155
- }
156
- },
157
- "d7c5d768c14549dfac849f116e992e62": {
158
- "model_module": "@jupyter-widgets/base",
159
- "model_name": "LayoutModel",
160
- "model_module_version": "1.2.0",
161
- "state": {
162
- "_model_module": "@jupyter-widgets/base",
163
- "_model_module_version": "1.2.0",
164
- "_model_name": "LayoutModel",
165
- "_view_count": null,
166
- "_view_module": "@jupyter-widgets/base",
167
- "_view_module_version": "1.2.0",
168
- "_view_name": "LayoutView",
169
- "align_content": null,
170
- "align_items": null,
171
- "align_self": null,
172
- "border": null,
173
- "bottom": null,
174
- "display": null,
175
- "flex": null,
176
- "flex_flow": null,
177
- "grid_area": null,
178
- "grid_auto_columns": null,
179
- "grid_auto_flow": null,
180
- "grid_auto_rows": null,
181
- "grid_column": null,
182
- "grid_gap": null,
183
- "grid_row": null,
184
- "grid_template_areas": null,
185
- "grid_template_columns": null,
186
- "grid_template_rows": null,
187
- "height": null,
188
- "justify_content": null,
189
- "justify_items": null,
190
- "left": null,
191
- "margin": null,
192
- "max_height": null,
193
- "max_width": null,
194
- "min_height": null,
195
- "min_width": null,
196
- "object_fit": null,
197
- "object_position": null,
198
- "order": null,
199
- "overflow": null,
200
- "overflow_x": null,
201
- "overflow_y": null,
202
- "padding": null,
203
- "right": null,
204
- "top": null,
205
- "visibility": null,
206
- "width": null
207
- }
208
- },
209
- "adc2e977fd5941de8a7f7e427fde6b96": {
210
- "model_module": "@jupyter-widgets/controls",
211
- "model_name": "DescriptionStyleModel",
212
- "model_module_version": "1.5.0",
213
- "state": {
214
- "_model_module": "@jupyter-widgets/controls",
215
- "_model_module_version": "1.5.0",
216
- "_model_name": "DescriptionStyleModel",
217
- "_view_count": null,
218
- "_view_module": "@jupyter-widgets/base",
219
- "_view_module_version": "1.2.0",
220
- "_view_name": "StyleView",
221
- "description_width": ""
222
- }
223
- },
224
- "421f286f91334ec183d7f73d54720573": {
225
- "model_module": "@jupyter-widgets/base",
226
- "model_name": "LayoutModel",
227
- "model_module_version": "1.2.0",
228
- "state": {
229
- "_model_module": "@jupyter-widgets/base",
230
- "_model_module_version": "1.2.0",
231
- "_model_name": "LayoutModel",
232
- "_view_count": null,
233
- "_view_module": "@jupyter-widgets/base",
234
- "_view_module_version": "1.2.0",
235
- "_view_name": "LayoutView",
236
- "align_content": null,
237
- "align_items": null,
238
- "align_self": null,
239
- "border": null,
240
- "bottom": null,
241
- "display": null,
242
- "flex": null,
243
- "flex_flow": null,
244
- "grid_area": null,
245
- "grid_auto_columns": null,
246
- "grid_auto_flow": null,
247
- "grid_auto_rows": null,
248
- "grid_column": null,
249
- "grid_gap": null,
250
- "grid_row": null,
251
- "grid_template_areas": null,
252
- "grid_template_columns": null,
253
- "grid_template_rows": null,
254
- "height": null,
255
- "justify_content": null,
256
- "justify_items": null,
257
- "left": null,
258
- "margin": null,
259
- "max_height": null,
260
- "max_width": null,
261
- "min_height": null,
262
- "min_width": null,
263
- "object_fit": null,
264
- "object_position": null,
265
- "order": null,
266
- "overflow": null,
267
- "overflow_x": null,
268
- "overflow_y": null,
269
- "padding": null,
270
- "right": null,
271
- "top": null,
272
- "visibility": null,
273
- "width": null
274
- }
275
- },
276
- "d643bd30eee7486197f88eb7e97b8483": {
277
- "model_module": "@jupyter-widgets/controls",
278
- "model_name": "ProgressStyleModel",
279
- "model_module_version": "1.5.0",
280
- "state": {
281
- "_model_module": "@jupyter-widgets/controls",
282
- "_model_module_version": "1.5.0",
283
- "_model_name": "ProgressStyleModel",
284
- "_view_count": null,
285
- "_view_module": "@jupyter-widgets/base",
286
- "_view_module_version": "1.2.0",
287
- "_view_name": "StyleView",
288
- "bar_color": null,
289
- "description_width": ""
290
- }
291
- },
292
- "4f094db2d5644ac5afe9d29709db205b": {
293
- "model_module": "@jupyter-widgets/base",
294
- "model_name": "LayoutModel",
295
- "model_module_version": "1.2.0",
296
- "state": {
297
- "_model_module": "@jupyter-widgets/base",
298
- "_model_module_version": "1.2.0",
299
- "_model_name": "LayoutModel",
300
- "_view_count": null,
301
- "_view_module": "@jupyter-widgets/base",
302
- "_view_module_version": "1.2.0",
303
- "_view_name": "LayoutView",
304
- "align_content": null,
305
- "align_items": null,
306
- "align_self": null,
307
- "border": null,
308
- "bottom": null,
309
- "display": null,
310
- "flex": null,
311
- "flex_flow": null,
312
- "grid_area": null,
313
- "grid_auto_columns": null,
314
- "grid_auto_flow": null,
315
- "grid_auto_rows": null,
316
- "grid_column": null,
317
- "grid_gap": null,
318
- "grid_row": null,
319
- "grid_template_areas": null,
320
- "grid_template_columns": null,
321
- "grid_template_rows": null,
322
- "height": null,
323
- "justify_content": null,
324
- "justify_items": null,
325
- "left": null,
326
- "margin": null,
327
- "max_height": null,
328
- "max_width": null,
329
- "min_height": null,
330
- "min_width": null,
331
- "object_fit": null,
332
- "object_position": null,
333
- "order": null,
334
- "overflow": null,
335
- "overflow_x": null,
336
- "overflow_y": null,
337
- "padding": null,
338
- "right": null,
339
- "top": null,
340
- "visibility": null,
341
- "width": null
342
- }
343
- },
344
- "96e07c6f046741999326f844c361f417": {
345
- "model_module": "@jupyter-widgets/controls",
346
- "model_name": "DescriptionStyleModel",
347
- "model_module_version": "1.5.0",
348
- "state": {
349
- "_model_module": "@jupyter-widgets/controls",
350
- "_model_module_version": "1.5.0",
351
- "_model_name": "DescriptionStyleModel",
352
- "_view_count": null,
353
- "_view_module": "@jupyter-widgets/base",
354
- "_view_module_version": "1.2.0",
355
- "_view_name": "StyleView",
356
- "description_width": ""
357
- }
358
- },
359
- "08fbb18f52c14073bb203bde7863205b": {
360
- "model_module": "@jupyter-widgets/controls",
361
- "model_name": "HBoxModel",
362
- "model_module_version": "1.5.0",
363
- "state": {
364
- "_dom_classes": [],
365
- "_model_module": "@jupyter-widgets/controls",
366
- "_model_module_version": "1.5.0",
367
- "_model_name": "HBoxModel",
368
- "_view_count": null,
369
- "_view_module": "@jupyter-widgets/controls",
370
- "_view_module_version": "1.5.0",
371
- "_view_name": "HBoxView",
372
- "box_style": "",
373
- "children": [
374
- "IPY_MODEL_80b5a4f71f3b47bdb17a63dbc5d7290f",
375
- "IPY_MODEL_345f3ca6dfea4bdfb35f4c071a90fd06",
376
- "IPY_MODEL_93c6ee53bdd54b87807006e26017c34c"
377
- ],
378
- "layout": "IPY_MODEL_c9ecefaa4ef94a73a322ceb790dd49ff"
379
- }
380
- },
381
- "80b5a4f71f3b47bdb17a63dbc5d7290f": {
382
- "model_module": "@jupyter-widgets/controls",
383
- "model_name": "HTMLModel",
384
- "model_module_version": "1.5.0",
385
- "state": {
386
- "_dom_classes": [],
387
- "_model_module": "@jupyter-widgets/controls",
388
- "_model_module_version": "1.5.0",
389
- "_model_name": "HTMLModel",
390
- "_view_count": null,
391
- "_view_module": "@jupyter-widgets/controls",
392
- "_view_module_version": "1.5.0",
393
- "_view_name": "HTMLView",
394
- "description": "",
395
- "description_tooltip": null,
396
- "layout": "IPY_MODEL_c08695aa39404d959746142450f339f4",
397
- "placeholder": "​",
398
- "style": "IPY_MODEL_8ab81e3714fe48f9a404e11ef707a3f2",
399
- "value": "Map (num_proc=4): 100%"
400
- }
401
- },
402
- "345f3ca6dfea4bdfb35f4c071a90fd06": {
403
- "model_module": "@jupyter-widgets/controls",
404
- "model_name": "FloatProgressModel",
405
- "model_module_version": "1.5.0",
406
- "state": {
407
- "_dom_classes": [],
408
- "_model_module": "@jupyter-widgets/controls",
409
- "_model_module_version": "1.5.0",
410
- "_model_name": "FloatProgressModel",
411
- "_view_count": null,
412
- "_view_module": "@jupyter-widgets/controls",
413
- "_view_module_version": "1.5.0",
414
- "_view_name": "ProgressView",
415
- "bar_style": "success",
416
- "description": "",
417
- "description_tooltip": null,
418
- "layout": "IPY_MODEL_d887be61a40842beb9979cb610ae5199",
419
- "max": 500,
420
- "min": 0,
421
- "orientation": "horizontal",
422
- "style": "IPY_MODEL_2844eb5338494c0692c12dfdce3c25dc",
423
- "value": 500
424
- }
425
- },
426
- "93c6ee53bdd54b87807006e26017c34c": {
427
- "model_module": "@jupyter-widgets/controls",
428
- "model_name": "HTMLModel",
429
- "model_module_version": "1.5.0",
430
- "state": {
431
- "_dom_classes": [],
432
- "_model_module": "@jupyter-widgets/controls",
433
- "_model_module_version": "1.5.0",
434
- "_model_name": "HTMLModel",
435
- "_view_count": null,
436
- "_view_module": "@jupyter-widgets/controls",
437
- "_view_module_version": "1.5.0",
438
- "_view_name": "HTMLView",
439
- "description": "",
440
- "description_tooltip": null,
441
- "layout": "IPY_MODEL_cb7836f4452d41f5a487d5f20fb23d6c",
442
- "placeholder": "​",
443
- "style": "IPY_MODEL_86b480f7edc940b9978302616b27812b",
444
- "value": " 500/500 [00:06<00:00, 128.43 examples/s]"
445
- }
446
- },
447
- "c9ecefaa4ef94a73a322ceb790dd49ff": {
448
- "model_module": "@jupyter-widgets/base",
449
- "model_name": "LayoutModel",
450
- "model_module_version": "1.2.0",
451
- "state": {
452
- "_model_module": "@jupyter-widgets/base",
453
- "_model_module_version": "1.2.0",
454
- "_model_name": "LayoutModel",
455
- "_view_count": null,
456
- "_view_module": "@jupyter-widgets/base",
457
- "_view_module_version": "1.2.0",
458
- "_view_name": "LayoutView",
459
- "align_content": null,
460
- "align_items": null,
461
- "align_self": null,
462
- "border": null,
463
- "bottom": null,
464
- "display": null,
465
- "flex": null,
466
- "flex_flow": null,
467
- "grid_area": null,
468
- "grid_auto_columns": null,
469
- "grid_auto_flow": null,
470
- "grid_auto_rows": null,
471
- "grid_column": null,
472
- "grid_gap": null,
473
- "grid_row": null,
474
- "grid_template_areas": null,
475
- "grid_template_columns": null,
476
- "grid_template_rows": null,
477
- "height": null,
478
- "justify_content": null,
479
- "justify_items": null,
480
- "left": null,
481
- "margin": null,
482
- "max_height": null,
483
- "max_width": null,
484
- "min_height": null,
485
- "min_width": null,
486
- "object_fit": null,
487
- "object_position": null,
488
- "order": null,
489
- "overflow": null,
490
- "overflow_x": null,
491
- "overflow_y": null,
492
- "padding": null,
493
- "right": null,
494
- "top": null,
495
- "visibility": null,
496
- "width": null
497
- }
498
- },
499
- "c08695aa39404d959746142450f339f4": {
500
- "model_module": "@jupyter-widgets/base",
501
- "model_name": "LayoutModel",
502
- "model_module_version": "1.2.0",
503
- "state": {
504
- "_model_module": "@jupyter-widgets/base",
505
- "_model_module_version": "1.2.0",
506
- "_model_name": "LayoutModel",
507
- "_view_count": null,
508
- "_view_module": "@jupyter-widgets/base",
509
- "_view_module_version": "1.2.0",
510
- "_view_name": "LayoutView",
511
- "align_content": null,
512
- "align_items": null,
513
- "align_self": null,
514
- "border": null,
515
- "bottom": null,
516
- "display": null,
517
- "flex": null,
518
- "flex_flow": null,
519
- "grid_area": null,
520
- "grid_auto_columns": null,
521
- "grid_auto_flow": null,
522
- "grid_auto_rows": null,
523
- "grid_column": null,
524
- "grid_gap": null,
525
- "grid_row": null,
526
- "grid_template_areas": null,
527
- "grid_template_columns": null,
528
- "grid_template_rows": null,
529
- "height": null,
530
- "justify_content": null,
531
- "justify_items": null,
532
- "left": null,
533
- "margin": null,
534
- "max_height": null,
535
- "max_width": null,
536
- "min_height": null,
537
- "min_width": null,
538
- "object_fit": null,
539
- "object_position": null,
540
- "order": null,
541
- "overflow": null,
542
- "overflow_x": null,
543
- "overflow_y": null,
544
- "padding": null,
545
- "right": null,
546
- "top": null,
547
- "visibility": null,
548
- "width": null
549
- }
550
- },
551
- "8ab81e3714fe48f9a404e11ef707a3f2": {
552
- "model_module": "@jupyter-widgets/controls",
553
- "model_name": "DescriptionStyleModel",
554
- "model_module_version": "1.5.0",
555
- "state": {
556
- "_model_module": "@jupyter-widgets/controls",
557
- "_model_module_version": "1.5.0",
558
- "_model_name": "DescriptionStyleModel",
559
- "_view_count": null,
560
- "_view_module": "@jupyter-widgets/base",
561
- "_view_module_version": "1.2.0",
562
- "_view_name": "StyleView",
563
- "description_width": ""
564
- }
565
- },
566
- "d887be61a40842beb9979cb610ae5199": {
567
- "model_module": "@jupyter-widgets/base",
568
- "model_name": "LayoutModel",
569
- "model_module_version": "1.2.0",
570
- "state": {
571
- "_model_module": "@jupyter-widgets/base",
572
- "_model_module_version": "1.2.0",
573
- "_model_name": "LayoutModel",
574
- "_view_count": null,
575
- "_view_module": "@jupyter-widgets/base",
576
- "_view_module_version": "1.2.0",
577
- "_view_name": "LayoutView",
578
- "align_content": null,
579
- "align_items": null,
580
- "align_self": null,
581
- "border": null,
582
- "bottom": null,
583
- "display": null,
584
- "flex": null,
585
- "flex_flow": null,
586
- "grid_area": null,
587
- "grid_auto_columns": null,
588
- "grid_auto_flow": null,
589
- "grid_auto_rows": null,
590
- "grid_column": null,
591
- "grid_gap": null,
592
- "grid_row": null,
593
- "grid_template_areas": null,
594
- "grid_template_columns": null,
595
- "grid_template_rows": null,
596
- "height": null,
597
- "justify_content": null,
598
- "justify_items": null,
599
- "left": null,
600
- "margin": null,
601
- "max_height": null,
602
- "max_width": null,
603
- "min_height": null,
604
- "min_width": null,
605
- "object_fit": null,
606
- "object_position": null,
607
- "order": null,
608
- "overflow": null,
609
- "overflow_x": null,
610
- "overflow_y": null,
611
- "padding": null,
612
- "right": null,
613
- "top": null,
614
- "visibility": null,
615
- "width": null
616
- }
617
- },
618
- "2844eb5338494c0692c12dfdce3c25dc": {
619
- "model_module": "@jupyter-widgets/controls",
620
- "model_name": "ProgressStyleModel",
621
- "model_module_version": "1.5.0",
622
- "state": {
623
- "_model_module": "@jupyter-widgets/controls",
624
- "_model_module_version": "1.5.0",
625
- "_model_name": "ProgressStyleModel",
626
- "_view_count": null,
627
- "_view_module": "@jupyter-widgets/base",
628
- "_view_module_version": "1.2.0",
629
- "_view_name": "StyleView",
630
- "bar_color": null,
631
- "description_width": ""
632
- }
633
- },
634
- "cb7836f4452d41f5a487d5f20fb23d6c": {
635
- "model_module": "@jupyter-widgets/base",
636
- "model_name": "LayoutModel",
637
- "model_module_version": "1.2.0",
638
- "state": {
639
- "_model_module": "@jupyter-widgets/base",
640
- "_model_module_version": "1.2.0",
641
- "_model_name": "LayoutModel",
642
- "_view_count": null,
643
- "_view_module": "@jupyter-widgets/base",
644
- "_view_module_version": "1.2.0",
645
- "_view_name": "LayoutView",
646
- "align_content": null,
647
- "align_items": null,
648
- "align_self": null,
649
- "border": null,
650
- "bottom": null,
651
- "display": null,
652
- "flex": null,
653
- "flex_flow": null,
654
- "grid_area": null,
655
- "grid_auto_columns": null,
656
- "grid_auto_flow": null,
657
- "grid_auto_rows": null,
658
- "grid_column": null,
659
- "grid_gap": null,
660
- "grid_row": null,
661
- "grid_template_areas": null,
662
- "grid_template_columns": null,
663
- "grid_template_rows": null,
664
- "height": null,
665
- "justify_content": null,
666
- "justify_items": null,
667
- "left": null,
668
- "margin": null,
669
- "max_height": null,
670
- "max_width": null,
671
- "min_height": null,
672
- "min_width": null,
673
- "object_fit": null,
674
- "object_position": null,
675
- "order": null,
676
- "overflow": null,
677
- "overflow_x": null,
678
- "overflow_y": null,
679
- "padding": null,
680
- "right": null,
681
- "top": null,
682
- "visibility": null,
683
- "width": null
684
- }
685
- },
686
- "86b480f7edc940b9978302616b27812b": {
687
- "model_module": "@jupyter-widgets/controls",
688
- "model_name": "DescriptionStyleModel",
689
- "model_module_version": "1.5.0",
690
- "state": {
691
- "_model_module": "@jupyter-widgets/controls",
692
- "_model_module_version": "1.5.0",
693
- "_model_name": "DescriptionStyleModel",
694
- "_view_count": null,
695
- "_view_module": "@jupyter-widgets/base",
696
- "_view_module_version": "1.2.0",
697
- "_view_name": "StyleView",
698
- "description_width": ""
699
- }
700
- }
701
- }
702
- }
703
- },
704
- "cells": [
705
- {
706
- "cell_type": "code",
707
- "source": [
708
- "!pip install -U sentence-transformers\n",
709
- "!pip install transformers\n",
710
- "!pip install gradio\n",
711
- "!pip install chromadb\n",
712
- "!pip install datasets\n",
713
- "pip install accelerate -U\n",
714
- "pip install transformers[torch]"
715
- ],
716
- "metadata": {
717
- "id": "LDBXSE2gNJyE"
718
- },
719
- "execution_count": null,
720
- "outputs": []
721
- },
722
- {
723
- "cell_type": "code",
724
- "execution_count": 7,
725
- "metadata": {
726
- "id": "g64RnidIM0u2"
727
- },
728
- "outputs": [],
729
- "source": [
730
- "import pandas as pd\n",
731
- "from sentence_transformers import SentenceTransformer\n",
732
- "import chromadb\n",
733
- "from transformers import GPT2LMHeadModel, GPT2Tokenizer, TextDataset, DataCollatorForLanguageModeling, Trainer, TrainingArguments\n",
734
- "import gradio as gr\n",
735
- "import torch\n",
736
- "from accelerate import Accelerator\n",
737
- "from transformers import Trainer, TrainingArguments\n",
738
- "from datasets import Dataset\n",
739
- "from torch.cuda.amp import autocast"
740
- ]
741
- },
742
- {
743
- "cell_type": "code",
744
- "source": [
745
- "emails_df = pd.read_csv('/content/emails.csv', nrows=500, on_bad_lines='skip')\n",
746
- "emails_df['message'] = emails_df['message'].apply(lambda x: x.strip() if type(x) == str else '')\n",
747
- "\n",
748
- "model = SentenceTransformer('all-MiniLM-L6-v2')\n",
749
- "\n",
750
- "emails_embeddings = model.encode(emails_df['message'].tolist(), show_progress_bar=True)\n",
751
- "\n",
752
- "chroma_client = chromadb.Client()\n",
753
- "collection = chroma_client.create_collection(name=\"enron_emails_subset\")\n",
754
- "\n",
755
- "collection.add(\n",
756
- " embeddings=emails_embeddings.tolist(),\n",
757
- " documents=emails_df['message'].tolist(),\n",
758
- " metadatas=[{\"email_id\": idx} for idx in emails_df.index],\n",
759
- " ids=[str(idx) for idx in emails_df.index]\n",
760
- ")"
761
- ],
762
- "metadata": {
763
- "colab": {
764
- "base_uri": "https://localhost:8080/",
765
- "height": 171,
766
- "referenced_widgets": [
767
- "c083c2266f934a1aa97993396bc7cb70",
768
- "5e41dc1da0af4ca9bd15aa06dfe181cc",
769
- "1e14b0bf051947c8aa2c52e962c519e9",
770
- "0f10d680af0149bd85dc3ee99611b404",
771
- "9774acbd2d10469faba55e7cce5989c4",
772
- "d7c5d768c14549dfac849f116e992e62",
773
- "adc2e977fd5941de8a7f7e427fde6b96",
774
- "421f286f91334ec183d7f73d54720573",
775
- "d643bd30eee7486197f88eb7e97b8483",
776
- "4f094db2d5644ac5afe9d29709db205b",
777
- "96e07c6f046741999326f844c361f417"
778
- ]
779
- },
780
- "id": "g507lOnyM6rj",
781
- "outputId": "fb4dd6b7-1f8c-47f4-bc83-951d7dc6d408"
782
- },
783
- "execution_count": 3,
784
- "outputs": [
785
- {
786
- "output_type": "stream",
787
- "name": "stderr",
788
- "text": [
789
- "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_token.py:88: UserWarning: \n",
790
- "The secret `HF_TOKEN` does not exist in your Colab secrets.\n",
791
- "To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.\n",
792
- "You will be able to reuse this secret in all of your notebooks.\n",
793
- "Please note that authentication is recommended but still optional to access public models or datasets.\n",
794
- " warnings.warn(\n"
795
- ]
796
- },
797
- {
798
- "output_type": "display_data",
799
- "data": {
800
- "text/plain": [
801
- "Batches: 0%| | 0/16 [00:00<?, ?it/s]"
802
- ],
803
- "application/vnd.jupyter.widget-view+json": {
804
- "version_major": 2,
805
- "version_minor": 0,
806
- "model_id": "c083c2266f934a1aa97993396bc7cb70"
807
- }
808
- },
809
- "metadata": {}
810
- }
811
- ]
812
- },
813
- {
814
- "cell_type": "code",
815
- "source": [
816
- "tokenizer = GPT2Tokenizer.from_pretrained('distilgpt2')\n",
817
- "tokenizer.pad_token = tokenizer.eos_token\n",
818
- "\n",
819
- "def tokenize_function(examples):\n",
820
- " with autocast():\n",
821
- " result = tokenizer(examples['message'], truncation=True, padding=\"max_length\", max_length=128)\n",
822
- " result[\"labels\"] = result[\"input_ids\"].copy()\n",
823
- " return result\n",
824
- "\n",
825
- "emails_df = pd.read_csv('/content/emails.csv', nrows=500, on_bad_lines='skip')\n",
826
- "dataset = Dataset.from_pandas(emails_df[['message']])\n",
827
- "dataset = dataset.map(tokenize_function, batched=True, num_proc=4)\n",
828
- "\n",
829
- "train_dataset = dataset.train_test_split(test_size=0.1)['train']\n",
830
- "\n",
831
- "model = GPT2LMHeadModel.from_pretrained('distilgpt2')\n",
832
- "model.resize_token_embeddings(len(tokenizer))\n",
833
- "\n",
834
- "training_args = TrainingArguments(\n",
835
- " output_dir='/content/model_output',\n",
836
- " num_train_epochs=1,\n",
837
- " per_device_train_batch_size=8,\n",
838
- " gradient_accumulation_steps=2,\n",
839
- " save_steps=250,\n",
840
- " logging_dir='/content/logs',\n",
841
- " logging_strategy=\"steps\",\n",
842
- " logging_steps=50\n",
843
- ")\n",
844
- "\n",
845
- "trainer = Trainer(\n",
846
- " model=model,\n",
847
- " args=training_args,\n",
848
- " train_dataset=train_dataset,\n",
849
- " tokenizer=tokenizer\n",
850
- ")\n",
851
- "\n",
852
- "trainer.train()"
853
- ],
854
- "metadata": {
855
- "colab": {
856
- "base_uri": "https://localhost:8080/",
857
- "height": 433,
858
- "referenced_widgets": [
859
- "08fbb18f52c14073bb203bde7863205b",
860
- "80b5a4f71f3b47bdb17a63dbc5d7290f",
861
- "345f3ca6dfea4bdfb35f4c071a90fd06",
862
- "93c6ee53bdd54b87807006e26017c34c",
863
- "c9ecefaa4ef94a73a322ceb790dd49ff",
864
- "c08695aa39404d959746142450f339f4",
865
- "8ab81e3714fe48f9a404e11ef707a3f2",
866
- "d887be61a40842beb9979cb610ae5199",
867
- "2844eb5338494c0692c12dfdce3c25dc",
868
- "cb7836f4452d41f5a487d5f20fb23d6c",
869
- "86b480f7edc940b9978302616b27812b"
870
- ]
871
- },
872
- "id": "MjAoLEaGM6uX",
873
- "outputId": "ffc9ea74-ff48-49b9-c73d-ece659bd951c"
874
- },
875
- "execution_count": 11,
876
- "outputs": [
877
- {
878
- "output_type": "stream",
879
- "name": "stderr",
880
- "text": [
881
- "/usr/local/lib/python3.10/dist-packages/multiprocess/popen_fork.py:66: RuntimeWarning: os.fork() was called. os.fork() is incompatible with multithreaded code, and JAX is multithreaded, so this will likely lead to a deadlock.\n",
882
- " self.pid = os.fork()\n"
883
- ]
884
- },
885
- {
886
- "output_type": "display_data",
887
- "data": {
888
- "text/plain": [
889
- "Map (num_proc=4): 0%| | 0/500 [00:00<?, ? examples/s]"
890
- ],
891
- "application/vnd.jupyter.widget-view+json": {
892
- "version_major": 2,
893
- "version_minor": 0,
894
- "model_id": "08fbb18f52c14073bb203bde7863205b"
895
- }
896
- },
897
- "metadata": {}
898
- },
899
- {
900
- "output_type": "stream",
901
- "name": "stderr",
902
- "text": [
903
- "/usr/local/lib/python3.10/dist-packages/multiprocess/popen_fork.py:66: RuntimeWarning: os.fork() was called. os.fork() is incompatible with multithreaded code, and JAX is multithreaded, so this will likely lead to a deadlock.\n",
904
- " self.pid = os.fork()\n",
905
- "/usr/local/lib/python3.10/dist-packages/torch/amp/autocast_mode.py:250: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling\n",
906
- " warnings.warn(\n",
907
- "/usr/local/lib/python3.10/dist-packages/torch/amp/autocast_mode.py:250: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling\n",
908
- " warnings.warn(\n",
909
- "/usr/local/lib/python3.10/dist-packages/torch/amp/autocast_mode.py:250: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling\n",
910
- " warnings.warn(\n",
911
- "/usr/local/lib/python3.10/dist-packages/torch/amp/autocast_mode.py:250: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling\n",
912
- " warnings.warn(\n",
913
- "/usr/local/lib/python3.10/dist-packages/accelerate/accelerator.py:436: FutureWarning: Passing the following arguments to `Accelerator` is deprecated and will be removed in version 1.0 of Accelerate: dict_keys(['dispatch_batches', 'split_batches', 'even_batches', 'use_seedable_sampler']). Please pass an `accelerate.DataLoaderConfiguration` instead: \n",
914
- "dataloader_config = DataLoaderConfiguration(dispatch_batches=None, split_batches=False, even_batches=True, use_seedable_sampler=True)\n",
915
- " warnings.warn(\n"
916
- ]
917
- },
918
- {
919
- "output_type": "display_data",
920
- "data": {
921
- "text/plain": [
922
- "<IPython.core.display.HTML object>"
923
- ],
924
- "text/html": [
925
- "\n",
926
- " <div>\n",
927
- " \n",
928
- " <progress value='28' max='28' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
929
- " [28/28 12:03, Epoch 0/1]\n",
930
- " </div>\n",
931
- " <table border=\"1\" class=\"dataframe\">\n",
932
- " <thead>\n",
933
- " <tr style=\"text-align: left;\">\n",
934
- " <th>Step</th>\n",
935
- " <th>Training Loss</th>\n",
936
- " </tr>\n",
937
- " </thead>\n",
938
- " <tbody>\n",
939
- " </tbody>\n",
940
- "</table><p>"
941
- ]
942
- },
943
- "metadata": {}
944
- },
945
- {
946
- "output_type": "execute_result",
947
- "data": {
948
- "text/plain": [
949
- "TrainOutput(global_step=28, training_loss=1.6547047751290458, metrics={'train_runtime': 752.8531, 'train_samples_per_second': 0.598, 'train_steps_per_second': 0.037, 'total_flos': 14632618033152.0, 'train_loss': 1.6547047751290458, 'epoch': 0.98})"
950
- ]
951
- },
952
- "metadata": {},
953
- "execution_count": 11
954
- }
955
- ]
956
- },
957
- {
958
- "cell_type": "code",
959
- "source": [
960
- "model.save_pretrained('/content/model_output')\n",
961
- "tokenizer.save_pretrained('/content/model_output')\n",
962
- "\n",
963
- "model = GPT2LMHeadModel.from_pretrained('/content/model_output')\n",
964
- "tokenizer = GPT2Tokenizer.from_pretrained('/content/model_output')\n",
965
- "\n",
966
- "def answer_question(question):\n",
967
- " model.eval()\n",
968
- " inputs = tokenizer.encode(question, return_tensors='pt')\n",
969
- " outputs = model.generate(inputs, max_length=100, num_return_sequences=1)\n",
970
- " return tokenizer.decode(outputs[0], skip_special_tokens=True)\n",
971
- "\n",
972
- "# Gradio interface\n",
973
- "iface = gr.Interface(fn=answer_question, inputs=\"text\", outputs=\"text\")\n",
974
- "iface.launch()"
975
- ],
976
- "metadata": {
977
- "colab": {
978
- "base_uri": "https://localhost:8080/",
979
- "height": 643
980
- },
981
- "id": "dAH4YWrlM6w-",
982
- "outputId": "f3f1431f-4a3f-4d92-b454-0d82feefe6a5"
983
- },
984
- "execution_count": 14,
985
- "outputs": [
986
- {
987
- "output_type": "stream",
988
- "name": "stdout",
989
- "text": [
990
- "Setting queue=True in a Colab notebook requires sharing enabled. Setting `share=True` (you can turn this off by setting `share=False` in `launch()` explicitly).\n",
991
- "\n",
992
- "Colab notebook detected. To show errors in colab notebook, set debug=True in launch()\n",
993
- "Running on public URL: https://beb88024cdd0715d8f.gradio.live\n",
994
- "\n",
995
- "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n"
996
- ]
997
- },
998
- {
999
- "output_type": "display_data",
1000
- "data": {
1001
- "text/plain": [
1002
- "<IPython.core.display.HTML object>"
1003
- ],
1004
- "text/html": [
1005
- "<div><iframe src=\"https://beb88024cdd0715d8f.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
1006
- ]
1007
- },
1008
- "metadata": {}
1009
- },
1010
- {
1011
- "output_type": "execute_result",
1012
- "data": {
1013
- "text/plain": []
1014
- },
1015
- "metadata": {},
1016
- "execution_count": 14
1017
- }
1018
- ]
1019
- }
1020
- ]
1021
- }