.
675 |
--------------------------------------------------------------------------------
/notebooks/Train_TweeGen.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "nbformat": 4,
3 | "nbformat_minor": 0,
4 | "metadata": {
5 | "colab": {
6 | "name": "Train-TweeGen",
7 | "provenance": [],
8 | "collapsed_sections": [],
9 | "toc_visible": true
10 | },
11 | "kernelspec": {
12 | "name": "python3",
13 | "display_name": "Python 3"
14 | },
15 | "accelerator": "GPU",
16 | "widgets": {
17 | "application/vnd.jupyter.widget-state+json": {
18 | "169795ac5899428abc59e4bbd1c31fb2": {
19 | "model_module": "@jupyter-widgets/controls",
20 | "model_name": "HBoxModel",
21 | "state": {
22 | "_view_name": "HBoxView",
23 | "_dom_classes": [],
24 | "_model_name": "HBoxModel",
25 | "_view_module": "@jupyter-widgets/controls",
26 | "_model_module_version": "1.5.0",
27 | "_view_count": null,
28 | "_view_module_version": "1.5.0",
29 | "box_style": "",
30 | "layout": "IPY_MODEL_8109b891da804ea1812300be930293bc",
31 | "_model_module": "@jupyter-widgets/controls",
32 | "children": [
33 | "IPY_MODEL_ae468860eaa541b98a266b42d7cc25a0",
34 | "IPY_MODEL_24f54adb9ede4ee1bb55020f03b1d0aa"
35 | ]
36 | }
37 | },
38 | "8109b891da804ea1812300be930293bc": {
39 | "model_module": "@jupyter-widgets/base",
40 | "model_name": "LayoutModel",
41 | "state": {
42 | "_view_name": "LayoutView",
43 | "grid_template_rows": null,
44 | "right": null,
45 | "justify_content": null,
46 | "_view_module": "@jupyter-widgets/base",
47 | "overflow": null,
48 | "_model_module_version": "1.2.0",
49 | "_view_count": null,
50 | "flex_flow": null,
51 | "width": null,
52 | "min_width": null,
53 | "border": null,
54 | "align_items": null,
55 | "bottom": null,
56 | "_model_module": "@jupyter-widgets/base",
57 | "top": null,
58 | "grid_column": null,
59 | "overflow_y": null,
60 | "overflow_x": null,
61 | "grid_auto_flow": null,
62 | "grid_area": null,
63 | "grid_template_columns": null,
64 | "flex": null,
65 | "_model_name": "LayoutModel",
66 | "justify_items": null,
67 | "grid_row": null,
68 | "max_height": null,
69 | "align_content": null,
70 | "visibility": null,
71 | "align_self": null,
72 | "height": null,
73 | "min_height": null,
74 | "padding": null,
75 | "grid_auto_rows": null,
76 | "grid_gap": null,
77 | "max_width": null,
78 | "order": null,
79 | "_view_module_version": "1.2.0",
80 | "grid_template_areas": null,
81 | "object_position": null,
82 | "object_fit": null,
83 | "grid_auto_columns": null,
84 | "margin": null,
85 | "display": null,
86 | "left": null
87 | }
88 | },
89 | "ae468860eaa541b98a266b42d7cc25a0": {
90 | "model_module": "@jupyter-widgets/controls",
91 | "model_name": "FloatProgressModel",
92 | "state": {
93 | "_view_name": "ProgressView",
94 | "style": "IPY_MODEL_f2c0610c2e5348c199d4665f162e8067",
95 | "_dom_classes": [],
96 | "description": "Downloading: 100%",
97 | "_model_name": "FloatProgressModel",
98 | "bar_style": "success",
99 | "max": 665,
100 | "_view_module": "@jupyter-widgets/controls",
101 | "_model_module_version": "1.5.0",
102 | "value": 665,
103 | "_view_count": null,
104 | "_view_module_version": "1.5.0",
105 | "orientation": "horizontal",
106 | "min": 0,
107 | "description_tooltip": null,
108 | "_model_module": "@jupyter-widgets/controls",
109 | "layout": "IPY_MODEL_8a044d24709f4a75adab056f7f1b1a19"
110 | }
111 | },
112 | "24f54adb9ede4ee1bb55020f03b1d0aa": {
113 | "model_module": "@jupyter-widgets/controls",
114 | "model_name": "HTMLModel",
115 | "state": {
116 | "_view_name": "HTMLView",
117 | "style": "IPY_MODEL_60dd9c14ef364210933e892d1d6f3070",
118 | "_dom_classes": [],
119 | "description": "",
120 | "_model_name": "HTMLModel",
121 | "placeholder": "",
122 | "_view_module": "@jupyter-widgets/controls",
123 | "_model_module_version": "1.5.0",
124 | "value": " 665/665 [00:02<00:00, 258B/s]",
125 | "_view_count": null,
126 | "_view_module_version": "1.5.0",
127 | "description_tooltip": null,
128 | "_model_module": "@jupyter-widgets/controls",
129 | "layout": "IPY_MODEL_5fa8a3d8c5cb4f45aa1aa21b11c0200e"
130 | }
131 | },
132 | "f2c0610c2e5348c199d4665f162e8067": {
133 | "model_module": "@jupyter-widgets/controls",
134 | "model_name": "ProgressStyleModel",
135 | "state": {
136 | "_view_name": "StyleView",
137 | "_model_name": "ProgressStyleModel",
138 | "description_width": "initial",
139 | "_view_module": "@jupyter-widgets/base",
140 | "_model_module_version": "1.5.0",
141 | "_view_count": null,
142 | "_view_module_version": "1.2.0",
143 | "bar_color": null,
144 | "_model_module": "@jupyter-widgets/controls"
145 | }
146 | },
147 | "8a044d24709f4a75adab056f7f1b1a19": {
148 | "model_module": "@jupyter-widgets/base",
149 | "model_name": "LayoutModel",
150 | "state": {
151 | "_view_name": "LayoutView",
152 | "grid_template_rows": null,
153 | "right": null,
154 | "justify_content": null,
155 | "_view_module": "@jupyter-widgets/base",
156 | "overflow": null,
157 | "_model_module_version": "1.2.0",
158 | "_view_count": null,
159 | "flex_flow": null,
160 | "width": null,
161 | "min_width": null,
162 | "border": null,
163 | "align_items": null,
164 | "bottom": null,
165 | "_model_module": "@jupyter-widgets/base",
166 | "top": null,
167 | "grid_column": null,
168 | "overflow_y": null,
169 | "overflow_x": null,
170 | "grid_auto_flow": null,
171 | "grid_area": null,
172 | "grid_template_columns": null,
173 | "flex": null,
174 | "_model_name": "LayoutModel",
175 | "justify_items": null,
176 | "grid_row": null,
177 | "max_height": null,
178 | "align_content": null,
179 | "visibility": null,
180 | "align_self": null,
181 | "height": null,
182 | "min_height": null,
183 | "padding": null,
184 | "grid_auto_rows": null,
185 | "grid_gap": null,
186 | "max_width": null,
187 | "order": null,
188 | "_view_module_version": "1.2.0",
189 | "grid_template_areas": null,
190 | "object_position": null,
191 | "object_fit": null,
192 | "grid_auto_columns": null,
193 | "margin": null,
194 | "display": null,
195 | "left": null
196 | }
197 | },
198 | "60dd9c14ef364210933e892d1d6f3070": {
199 | "model_module": "@jupyter-widgets/controls",
200 | "model_name": "DescriptionStyleModel",
201 | "state": {
202 | "_view_name": "StyleView",
203 | "_model_name": "DescriptionStyleModel",
204 | "description_width": "",
205 | "_view_module": "@jupyter-widgets/base",
206 | "_model_module_version": "1.5.0",
207 | "_view_count": null,
208 | "_view_module_version": "1.2.0",
209 | "_model_module": "@jupyter-widgets/controls"
210 | }
211 | },
212 | "5fa8a3d8c5cb4f45aa1aa21b11c0200e": {
213 | "model_module": "@jupyter-widgets/base",
214 | "model_name": "LayoutModel",
215 | "state": {
216 | "_view_name": "LayoutView",
217 | "grid_template_rows": null,
218 | "right": null,
219 | "justify_content": null,
220 | "_view_module": "@jupyter-widgets/base",
221 | "overflow": null,
222 | "_model_module_version": "1.2.0",
223 | "_view_count": null,
224 | "flex_flow": null,
225 | "width": null,
226 | "min_width": null,
227 | "border": null,
228 | "align_items": null,
229 | "bottom": null,
230 | "_model_module": "@jupyter-widgets/base",
231 | "top": null,
232 | "grid_column": null,
233 | "overflow_y": null,
234 | "overflow_x": null,
235 | "grid_auto_flow": null,
236 | "grid_area": null,
237 | "grid_template_columns": null,
238 | "flex": null,
239 | "_model_name": "LayoutModel",
240 | "justify_items": null,
241 | "grid_row": null,
242 | "max_height": null,
243 | "align_content": null,
244 | "visibility": null,
245 | "align_self": null,
246 | "height": null,
247 | "min_height": null,
248 | "padding": null,
249 | "grid_auto_rows": null,
250 | "grid_gap": null,
251 | "max_width": null,
252 | "order": null,
253 | "_view_module_version": "1.2.0",
254 | "grid_template_areas": null,
255 | "object_position": null,
256 | "object_fit": null,
257 | "grid_auto_columns": null,
258 | "margin": null,
259 | "display": null,
260 | "left": null
261 | }
262 | },
263 | "16f2d3c06a4b4d1f8d290ba9307359ae": {
264 | "model_module": "@jupyter-widgets/controls",
265 | "model_name": "HBoxModel",
266 | "state": {
267 | "_view_name": "HBoxView",
268 | "_dom_classes": [],
269 | "_model_name": "HBoxModel",
270 | "_view_module": "@jupyter-widgets/controls",
271 | "_model_module_version": "1.5.0",
272 | "_view_count": null,
273 | "_view_module_version": "1.5.0",
274 | "box_style": "",
275 | "layout": "IPY_MODEL_f568a5a969004c0785c253c0f1c007e0",
276 | "_model_module": "@jupyter-widgets/controls",
277 | "children": [
278 | "IPY_MODEL_199ca4ca35024e579297d062f581fceb",
279 | "IPY_MODEL_a85541beb1574a3cbeffe1e2a7f68e9a"
280 | ]
281 | }
282 | },
283 | "f568a5a969004c0785c253c0f1c007e0": {
284 | "model_module": "@jupyter-widgets/base",
285 | "model_name": "LayoutModel",
286 | "state": {
287 | "_view_name": "LayoutView",
288 | "grid_template_rows": null,
289 | "right": null,
290 | "justify_content": null,
291 | "_view_module": "@jupyter-widgets/base",
292 | "overflow": null,
293 | "_model_module_version": "1.2.0",
294 | "_view_count": null,
295 | "flex_flow": null,
296 | "width": null,
297 | "min_width": null,
298 | "border": null,
299 | "align_items": null,
300 | "bottom": null,
301 | "_model_module": "@jupyter-widgets/base",
302 | "top": null,
303 | "grid_column": null,
304 | "overflow_y": null,
305 | "overflow_x": null,
306 | "grid_auto_flow": null,
307 | "grid_area": null,
308 | "grid_template_columns": null,
309 | "flex": null,
310 | "_model_name": "LayoutModel",
311 | "justify_items": null,
312 | "grid_row": null,
313 | "max_height": null,
314 | "align_content": null,
315 | "visibility": null,
316 | "align_self": null,
317 | "height": null,
318 | "min_height": null,
319 | "padding": null,
320 | "grid_auto_rows": null,
321 | "grid_gap": null,
322 | "max_width": null,
323 | "order": null,
324 | "_view_module_version": "1.2.0",
325 | "grid_template_areas": null,
326 | "object_position": null,
327 | "object_fit": null,
328 | "grid_auto_columns": null,
329 | "margin": null,
330 | "display": null,
331 | "left": null
332 | }
333 | },
334 | "199ca4ca35024e579297d062f581fceb": {
335 | "model_module": "@jupyter-widgets/controls",
336 | "model_name": "FloatProgressModel",
337 | "state": {
338 | "_view_name": "ProgressView",
339 | "style": "IPY_MODEL_388aa3a3b61640798d51ef5873b4527d",
340 | "_dom_classes": [],
341 | "description": "Downloading: 100%",
342 | "_model_name": "FloatProgressModel",
343 | "bar_style": "success",
344 | "max": 1042301,
345 | "_view_module": "@jupyter-widgets/controls",
346 | "_model_module_version": "1.5.0",
347 | "value": 1042301,
348 | "_view_count": null,
349 | "_view_module_version": "1.5.0",
350 | "orientation": "horizontal",
351 | "min": 0,
352 | "description_tooltip": null,
353 | "_model_module": "@jupyter-widgets/controls",
354 | "layout": "IPY_MODEL_8f45b4db30364904aa881d0eb6eb3664"
355 | }
356 | },
357 | "a85541beb1574a3cbeffe1e2a7f68e9a": {
358 | "model_module": "@jupyter-widgets/controls",
359 | "model_name": "HTMLModel",
360 | "state": {
361 | "_view_name": "HTMLView",
362 | "style": "IPY_MODEL_997d9df0b1b44cbda161dd6aede6033b",
363 | "_dom_classes": [],
364 | "description": "",
365 | "_model_name": "HTMLModel",
366 | "placeholder": "",
367 | "_view_module": "@jupyter-widgets/controls",
368 | "_model_module_version": "1.5.0",
369 | "value": " 1.04M/1.04M [00:02<00:00, 495kB/s]",
370 | "_view_count": null,
371 | "_view_module_version": "1.5.0",
372 | "description_tooltip": null,
373 | "_model_module": "@jupyter-widgets/controls",
374 | "layout": "IPY_MODEL_bbd3f600363443e380d325073ffe2c94"
375 | }
376 | },
377 | "388aa3a3b61640798d51ef5873b4527d": {
378 | "model_module": "@jupyter-widgets/controls",
379 | "model_name": "ProgressStyleModel",
380 | "state": {
381 | "_view_name": "StyleView",
382 | "_model_name": "ProgressStyleModel",
383 | "description_width": "initial",
384 | "_view_module": "@jupyter-widgets/base",
385 | "_model_module_version": "1.5.0",
386 | "_view_count": null,
387 | "_view_module_version": "1.2.0",
388 | "bar_color": null,
389 | "_model_module": "@jupyter-widgets/controls"
390 | }
391 | },
392 | "8f45b4db30364904aa881d0eb6eb3664": {
393 | "model_module": "@jupyter-widgets/base",
394 | "model_name": "LayoutModel",
395 | "state": {
396 | "_view_name": "LayoutView",
397 | "grid_template_rows": null,
398 | "right": null,
399 | "justify_content": null,
400 | "_view_module": "@jupyter-widgets/base",
401 | "overflow": null,
402 | "_model_module_version": "1.2.0",
403 | "_view_count": null,
404 | "flex_flow": null,
405 | "width": null,
406 | "min_width": null,
407 | "border": null,
408 | "align_items": null,
409 | "bottom": null,
410 | "_model_module": "@jupyter-widgets/base",
411 | "top": null,
412 | "grid_column": null,
413 | "overflow_y": null,
414 | "overflow_x": null,
415 | "grid_auto_flow": null,
416 | "grid_area": null,
417 | "grid_template_columns": null,
418 | "flex": null,
419 | "_model_name": "LayoutModel",
420 | "justify_items": null,
421 | "grid_row": null,
422 | "max_height": null,
423 | "align_content": null,
424 | "visibility": null,
425 | "align_self": null,
426 | "height": null,
427 | "min_height": null,
428 | "padding": null,
429 | "grid_auto_rows": null,
430 | "grid_gap": null,
431 | "max_width": null,
432 | "order": null,
433 | "_view_module_version": "1.2.0",
434 | "grid_template_areas": null,
435 | "object_position": null,
436 | "object_fit": null,
437 | "grid_auto_columns": null,
438 | "margin": null,
439 | "display": null,
440 | "left": null
441 | }
442 | },
443 | "997d9df0b1b44cbda161dd6aede6033b": {
444 | "model_module": "@jupyter-widgets/controls",
445 | "model_name": "DescriptionStyleModel",
446 | "state": {
447 | "_view_name": "StyleView",
448 | "_model_name": "DescriptionStyleModel",
449 | "description_width": "",
450 | "_view_module": "@jupyter-widgets/base",
451 | "_model_module_version": "1.5.0",
452 | "_view_count": null,
453 | "_view_module_version": "1.2.0",
454 | "_model_module": "@jupyter-widgets/controls"
455 | }
456 | },
457 | "bbd3f600363443e380d325073ffe2c94": {
458 | "model_module": "@jupyter-widgets/base",
459 | "model_name": "LayoutModel",
460 | "state": {
461 | "_view_name": "LayoutView",
462 | "grid_template_rows": null,
463 | "right": null,
464 | "justify_content": null,
465 | "_view_module": "@jupyter-widgets/base",
466 | "overflow": null,
467 | "_model_module_version": "1.2.0",
468 | "_view_count": null,
469 | "flex_flow": null,
470 | "width": null,
471 | "min_width": null,
472 | "border": null,
473 | "align_items": null,
474 | "bottom": null,
475 | "_model_module": "@jupyter-widgets/base",
476 | "top": null,
477 | "grid_column": null,
478 | "overflow_y": null,
479 | "overflow_x": null,
480 | "grid_auto_flow": null,
481 | "grid_area": null,
482 | "grid_template_columns": null,
483 | "flex": null,
484 | "_model_name": "LayoutModel",
485 | "justify_items": null,
486 | "grid_row": null,
487 | "max_height": null,
488 | "align_content": null,
489 | "visibility": null,
490 | "align_self": null,
491 | "height": null,
492 | "min_height": null,
493 | "padding": null,
494 | "grid_auto_rows": null,
495 | "grid_gap": null,
496 | "max_width": null,
497 | "order": null,
498 | "_view_module_version": "1.2.0",
499 | "grid_template_areas": null,
500 | "object_position": null,
501 | "object_fit": null,
502 | "grid_auto_columns": null,
503 | "margin": null,
504 | "display": null,
505 | "left": null
506 | }
507 | },
508 | "6185dd576a7c4378bdfaca5ac188ad04": {
509 | "model_module": "@jupyter-widgets/controls",
510 | "model_name": "HBoxModel",
511 | "state": {
512 | "_view_name": "HBoxView",
513 | "_dom_classes": [],
514 | "_model_name": "HBoxModel",
515 | "_view_module": "@jupyter-widgets/controls",
516 | "_model_module_version": "1.5.0",
517 | "_view_count": null,
518 | "_view_module_version": "1.5.0",
519 | "box_style": "",
520 | "layout": "IPY_MODEL_17cca8bf255046e383014412592177f3",
521 | "_model_module": "@jupyter-widgets/controls",
522 | "children": [
523 | "IPY_MODEL_d6144f472ade45068b7caa255e568391",
524 | "IPY_MODEL_ba19d902c23845b49e7611ef858e162d"
525 | ]
526 | }
527 | },
528 | "17cca8bf255046e383014412592177f3": {
529 | "model_module": "@jupyter-widgets/base",
530 | "model_name": "LayoutModel",
531 | "state": {
532 | "_view_name": "LayoutView",
533 | "grid_template_rows": null,
534 | "right": null,
535 | "justify_content": null,
536 | "_view_module": "@jupyter-widgets/base",
537 | "overflow": null,
538 | "_model_module_version": "1.2.0",
539 | "_view_count": null,
540 | "flex_flow": null,
541 | "width": null,
542 | "min_width": null,
543 | "border": null,
544 | "align_items": null,
545 | "bottom": null,
546 | "_model_module": "@jupyter-widgets/base",
547 | "top": null,
548 | "grid_column": null,
549 | "overflow_y": null,
550 | "overflow_x": null,
551 | "grid_auto_flow": null,
552 | "grid_area": null,
553 | "grid_template_columns": null,
554 | "flex": null,
555 | "_model_name": "LayoutModel",
556 | "justify_items": null,
557 | "grid_row": null,
558 | "max_height": null,
559 | "align_content": null,
560 | "visibility": null,
561 | "align_self": null,
562 | "height": null,
563 | "min_height": null,
564 | "padding": null,
565 | "grid_auto_rows": null,
566 | "grid_gap": null,
567 | "max_width": null,
568 | "order": null,
569 | "_view_module_version": "1.2.0",
570 | "grid_template_areas": null,
571 | "object_position": null,
572 | "object_fit": null,
573 | "grid_auto_columns": null,
574 | "margin": null,
575 | "display": null,
576 | "left": null
577 | }
578 | },
579 | "d6144f472ade45068b7caa255e568391": {
580 | "model_module": "@jupyter-widgets/controls",
581 | "model_name": "FloatProgressModel",
582 | "state": {
583 | "_view_name": "ProgressView",
584 | "style": "IPY_MODEL_bf7c641b24764c33a09afac8ad31637e",
585 | "_dom_classes": [],
586 | "description": "Downloading: 100%",
587 | "_model_name": "FloatProgressModel",
588 | "bar_style": "success",
589 | "max": 456318,
590 | "_view_module": "@jupyter-widgets/controls",
591 | "_model_module_version": "1.5.0",
592 | "value": 456318,
593 | "_view_count": null,
594 | "_view_module_version": "1.5.0",
595 | "orientation": "horizontal",
596 | "min": 0,
597 | "description_tooltip": null,
598 | "_model_module": "@jupyter-widgets/controls",
599 | "layout": "IPY_MODEL_971861dbfb5f48ca94776f53eeb21d64"
600 | }
601 | },
602 | "ba19d902c23845b49e7611ef858e162d": {
603 | "model_module": "@jupyter-widgets/controls",
604 | "model_name": "HTMLModel",
605 | "state": {
606 | "_view_name": "HTMLView",
607 | "style": "IPY_MODEL_651bb42eb283408a85fdc2109ade9387",
608 | "_dom_classes": [],
609 | "description": "",
610 | "_model_name": "HTMLModel",
611 | "placeholder": "",
612 | "_view_module": "@jupyter-widgets/controls",
613 | "_model_module_version": "1.5.0",
614 | "value": " 456k/456k [00:01<00:00, 357kB/s]",
615 | "_view_count": null,
616 | "_view_module_version": "1.5.0",
617 | "description_tooltip": null,
618 | "_model_module": "@jupyter-widgets/controls",
619 | "layout": "IPY_MODEL_7558ed69090f4c40b22e6a0ca8268c43"
620 | }
621 | },
622 | "bf7c641b24764c33a09afac8ad31637e": {
623 | "model_module": "@jupyter-widgets/controls",
624 | "model_name": "ProgressStyleModel",
625 | "state": {
626 | "_view_name": "StyleView",
627 | "_model_name": "ProgressStyleModel",
628 | "description_width": "initial",
629 | "_view_module": "@jupyter-widgets/base",
630 | "_model_module_version": "1.5.0",
631 | "_view_count": null,
632 | "_view_module_version": "1.2.0",
633 | "bar_color": null,
634 | "_model_module": "@jupyter-widgets/controls"
635 | }
636 | },
637 | "971861dbfb5f48ca94776f53eeb21d64": {
638 | "model_module": "@jupyter-widgets/base",
639 | "model_name": "LayoutModel",
640 | "state": {
641 | "_view_name": "LayoutView",
642 | "grid_template_rows": null,
643 | "right": null,
644 | "justify_content": null,
645 | "_view_module": "@jupyter-widgets/base",
646 | "overflow": null,
647 | "_model_module_version": "1.2.0",
648 | "_view_count": null,
649 | "flex_flow": null,
650 | "width": null,
651 | "min_width": null,
652 | "border": null,
653 | "align_items": null,
654 | "bottom": null,
655 | "_model_module": "@jupyter-widgets/base",
656 | "top": null,
657 | "grid_column": null,
658 | "overflow_y": null,
659 | "overflow_x": null,
660 | "grid_auto_flow": null,
661 | "grid_area": null,
662 | "grid_template_columns": null,
663 | "flex": null,
664 | "_model_name": "LayoutModel",
665 | "justify_items": null,
666 | "grid_row": null,
667 | "max_height": null,
668 | "align_content": null,
669 | "visibility": null,
670 | "align_self": null,
671 | "height": null,
672 | "min_height": null,
673 | "padding": null,
674 | "grid_auto_rows": null,
675 | "grid_gap": null,
676 | "max_width": null,
677 | "order": null,
678 | "_view_module_version": "1.2.0",
679 | "grid_template_areas": null,
680 | "object_position": null,
681 | "object_fit": null,
682 | "grid_auto_columns": null,
683 | "margin": null,
684 | "display": null,
685 | "left": null
686 | }
687 | },
688 | "651bb42eb283408a85fdc2109ade9387": {
689 | "model_module": "@jupyter-widgets/controls",
690 | "model_name": "DescriptionStyleModel",
691 | "state": {
692 | "_view_name": "StyleView",
693 | "_model_name": "DescriptionStyleModel",
694 | "description_width": "",
695 | "_view_module": "@jupyter-widgets/base",
696 | "_model_module_version": "1.5.0",
697 | "_view_count": null,
698 | "_view_module_version": "1.2.0",
699 | "_model_module": "@jupyter-widgets/controls"
700 | }
701 | },
702 | "7558ed69090f4c40b22e6a0ca8268c43": {
703 | "model_module": "@jupyter-widgets/base",
704 | "model_name": "LayoutModel",
705 | "state": {
706 | "_view_name": "LayoutView",
707 | "grid_template_rows": null,
708 | "right": null,
709 | "justify_content": null,
710 | "_view_module": "@jupyter-widgets/base",
711 | "overflow": null,
712 | "_model_module_version": "1.2.0",
713 | "_view_count": null,
714 | "flex_flow": null,
715 | "width": null,
716 | "min_width": null,
717 | "border": null,
718 | "align_items": null,
719 | "bottom": null,
720 | "_model_module": "@jupyter-widgets/base",
721 | "top": null,
722 | "grid_column": null,
723 | "overflow_y": null,
724 | "overflow_x": null,
725 | "grid_auto_flow": null,
726 | "grid_area": null,
727 | "grid_template_columns": null,
728 | "flex": null,
729 | "_model_name": "LayoutModel",
730 | "justify_items": null,
731 | "grid_row": null,
732 | "max_height": null,
733 | "align_content": null,
734 | "visibility": null,
735 | "align_self": null,
736 | "height": null,
737 | "min_height": null,
738 | "padding": null,
739 | "grid_auto_rows": null,
740 | "grid_gap": null,
741 | "max_width": null,
742 | "order": null,
743 | "_view_module_version": "1.2.0",
744 | "grid_template_areas": null,
745 | "object_position": null,
746 | "object_fit": null,
747 | "grid_auto_columns": null,
748 | "margin": null,
749 | "display": null,
750 | "left": null
751 | }
752 | },
753 | "5161accdbffe44768b5895b6d53daf48": {
754 | "model_module": "@jupyter-widgets/controls",
755 | "model_name": "HBoxModel",
756 | "state": {
757 | "_view_name": "HBoxView",
758 | "_dom_classes": [],
759 | "_model_name": "HBoxModel",
760 | "_view_module": "@jupyter-widgets/controls",
761 | "_model_module_version": "1.5.0",
762 | "_view_count": null,
763 | "_view_module_version": "1.5.0",
764 | "box_style": "",
765 | "layout": "IPY_MODEL_4291cb0e3c3942d387b83a18e2fba993",
766 | "_model_module": "@jupyter-widgets/controls",
767 | "children": [
768 | "IPY_MODEL_bc37533e085a4c37aa3991bd6d216b02",
769 | "IPY_MODEL_66666e44a2d0421da1ce7ddb9c20b61e"
770 | ]
771 | }
772 | },
773 | "4291cb0e3c3942d387b83a18e2fba993": {
774 | "model_module": "@jupyter-widgets/base",
775 | "model_name": "LayoutModel",
776 | "state": {
777 | "_view_name": "LayoutView",
778 | "grid_template_rows": null,
779 | "right": null,
780 | "justify_content": null,
781 | "_view_module": "@jupyter-widgets/base",
782 | "overflow": null,
783 | "_model_module_version": "1.2.0",
784 | "_view_count": null,
785 | "flex_flow": null,
786 | "width": null,
787 | "min_width": null,
788 | "border": null,
789 | "align_items": null,
790 | "bottom": null,
791 | "_model_module": "@jupyter-widgets/base",
792 | "top": null,
793 | "grid_column": null,
794 | "overflow_y": null,
795 | "overflow_x": null,
796 | "grid_auto_flow": null,
797 | "grid_area": null,
798 | "grid_template_columns": null,
799 | "flex": null,
800 | "_model_name": "LayoutModel",
801 | "justify_items": null,
802 | "grid_row": null,
803 | "max_height": null,
804 | "align_content": null,
805 | "visibility": null,
806 | "align_self": null,
807 | "height": null,
808 | "min_height": null,
809 | "padding": null,
810 | "grid_auto_rows": null,
811 | "grid_gap": null,
812 | "max_width": null,
813 | "order": null,
814 | "_view_module_version": "1.2.0",
815 | "grid_template_areas": null,
816 | "object_position": null,
817 | "object_fit": null,
818 | "grid_auto_columns": null,
819 | "margin": null,
820 | "display": null,
821 | "left": null
822 | }
823 | },
824 | "bc37533e085a4c37aa3991bd6d216b02": {
825 | "model_module": "@jupyter-widgets/controls",
826 | "model_name": "FloatProgressModel",
827 | "state": {
828 | "_view_name": "ProgressView",
829 | "style": "IPY_MODEL_79cff82ab6db4491a6c82157c3acbe61",
830 | "_dom_classes": [],
831 | "description": "Downloading: 100%",
832 | "_model_name": "FloatProgressModel",
833 | "bar_style": "success",
834 | "max": 1355256,
835 | "_view_module": "@jupyter-widgets/controls",
836 | "_model_module_version": "1.5.0",
837 | "value": 1355256,
838 | "_view_count": null,
839 | "_view_module_version": "1.5.0",
840 | "orientation": "horizontal",
841 | "min": 0,
842 | "description_tooltip": null,
843 | "_model_module": "@jupyter-widgets/controls",
844 | "layout": "IPY_MODEL_bc096c5ededb48128858f8c4c6765997"
845 | }
846 | },
847 | "66666e44a2d0421da1ce7ddb9c20b61e": {
848 | "model_module": "@jupyter-widgets/controls",
849 | "model_name": "HTMLModel",
850 | "state": {
851 | "_view_name": "HTMLView",
852 | "style": "IPY_MODEL_85ea67060f994a0886fb0eb3c0a996f4",
853 | "_dom_classes": [],
854 | "description": "",
855 | "_model_name": "HTMLModel",
856 | "placeholder": "",
857 | "_view_module": "@jupyter-widgets/controls",
858 | "_model_module_version": "1.5.0",
859 | "value": " 1.36M/1.36M [00:00<00:00, 2.68MB/s]",
860 | "_view_count": null,
861 | "_view_module_version": "1.5.0",
862 | "description_tooltip": null,
863 | "_model_module": "@jupyter-widgets/controls",
864 | "layout": "IPY_MODEL_750f585dd68b421cb18e299fcbde3700"
865 | }
866 | },
867 | "79cff82ab6db4491a6c82157c3acbe61": {
868 | "model_module": "@jupyter-widgets/controls",
869 | "model_name": "ProgressStyleModel",
870 | "state": {
871 | "_view_name": "StyleView",
872 | "_model_name": "ProgressStyleModel",
873 | "description_width": "initial",
874 | "_view_module": "@jupyter-widgets/base",
875 | "_model_module_version": "1.5.0",
876 | "_view_count": null,
877 | "_view_module_version": "1.2.0",
878 | "bar_color": null,
879 | "_model_module": "@jupyter-widgets/controls"
880 | }
881 | },
882 | "bc096c5ededb48128858f8c4c6765997": {
883 | "model_module": "@jupyter-widgets/base",
884 | "model_name": "LayoutModel",
885 | "state": {
886 | "_view_name": "LayoutView",
887 | "grid_template_rows": null,
888 | "right": null,
889 | "justify_content": null,
890 | "_view_module": "@jupyter-widgets/base",
891 | "overflow": null,
892 | "_model_module_version": "1.2.0",
893 | "_view_count": null,
894 | "flex_flow": null,
895 | "width": null,
896 | "min_width": null,
897 | "border": null,
898 | "align_items": null,
899 | "bottom": null,
900 | "_model_module": "@jupyter-widgets/base",
901 | "top": null,
902 | "grid_column": null,
903 | "overflow_y": null,
904 | "overflow_x": null,
905 | "grid_auto_flow": null,
906 | "grid_area": null,
907 | "grid_template_columns": null,
908 | "flex": null,
909 | "_model_name": "LayoutModel",
910 | "justify_items": null,
911 | "grid_row": null,
912 | "max_height": null,
913 | "align_content": null,
914 | "visibility": null,
915 | "align_self": null,
916 | "height": null,
917 | "min_height": null,
918 | "padding": null,
919 | "grid_auto_rows": null,
920 | "grid_gap": null,
921 | "max_width": null,
922 | "order": null,
923 | "_view_module_version": "1.2.0",
924 | "grid_template_areas": null,
925 | "object_position": null,
926 | "object_fit": null,
927 | "grid_auto_columns": null,
928 | "margin": null,
929 | "display": null,
930 | "left": null
931 | }
932 | },
933 | "85ea67060f994a0886fb0eb3c0a996f4": {
934 | "model_module": "@jupyter-widgets/controls",
935 | "model_name": "DescriptionStyleModel",
936 | "state": {
937 | "_view_name": "StyleView",
938 | "_model_name": "DescriptionStyleModel",
939 | "description_width": "",
940 | "_view_module": "@jupyter-widgets/base",
941 | "_model_module_version": "1.5.0",
942 | "_view_count": null,
943 | "_view_module_version": "1.2.0",
944 | "_model_module": "@jupyter-widgets/controls"
945 | }
946 | },
947 | "750f585dd68b421cb18e299fcbde3700": {
948 | "model_module": "@jupyter-widgets/base",
949 | "model_name": "LayoutModel",
950 | "state": {
951 | "_view_name": "LayoutView",
952 | "grid_template_rows": null,
953 | "right": null,
954 | "justify_content": null,
955 | "_view_module": "@jupyter-widgets/base",
956 | "overflow": null,
957 | "_model_module_version": "1.2.0",
958 | "_view_count": null,
959 | "flex_flow": null,
960 | "width": null,
961 | "min_width": null,
962 | "border": null,
963 | "align_items": null,
964 | "bottom": null,
965 | "_model_module": "@jupyter-widgets/base",
966 | "top": null,
967 | "grid_column": null,
968 | "overflow_y": null,
969 | "overflow_x": null,
970 | "grid_auto_flow": null,
971 | "grid_area": null,
972 | "grid_template_columns": null,
973 | "flex": null,
974 | "_model_name": "LayoutModel",
975 | "justify_items": null,
976 | "grid_row": null,
977 | "max_height": null,
978 | "align_content": null,
979 | "visibility": null,
980 | "align_self": null,
981 | "height": null,
982 | "min_height": null,
983 | "padding": null,
984 | "grid_auto_rows": null,
985 | "grid_gap": null,
986 | "max_width": null,
987 | "order": null,
988 | "_view_module_version": "1.2.0",
989 | "grid_template_areas": null,
990 | "object_position": null,
991 | "object_fit": null,
992 | "grid_auto_columns": null,
993 | "margin": null,
994 | "display": null,
995 | "left": null
996 | }
997 | },
998 | "322c8fb0b1bf40b9b2870e7fe1475361": {
999 | "model_module": "@jupyter-widgets/controls",
1000 | "model_name": "HBoxModel",
1001 | "state": {
1002 | "_view_name": "HBoxView",
1003 | "_dom_classes": [],
1004 | "_model_name": "HBoxModel",
1005 | "_view_module": "@jupyter-widgets/controls",
1006 | "_model_module_version": "1.5.0",
1007 | "_view_count": null,
1008 | "_view_module_version": "1.5.0",
1009 | "box_style": "",
1010 | "layout": "IPY_MODEL_803635b8dc1645b5bc38ff6f6c4a6ccf",
1011 | "_model_module": "@jupyter-widgets/controls",
1012 | "children": [
1013 | "IPY_MODEL_819cfb49894f454491e16026ce133499",
1014 | "IPY_MODEL_84a3bea1d5614030b1f2397ee493214e"
1015 | ]
1016 | }
1017 | },
1018 | "803635b8dc1645b5bc38ff6f6c4a6ccf": {
1019 | "model_module": "@jupyter-widgets/base",
1020 | "model_name": "LayoutModel",
1021 | "state": {
1022 | "_view_name": "LayoutView",
1023 | "grid_template_rows": null,
1024 | "right": null,
1025 | "justify_content": null,
1026 | "_view_module": "@jupyter-widgets/base",
1027 | "overflow": null,
1028 | "_model_module_version": "1.2.0",
1029 | "_view_count": null,
1030 | "flex_flow": null,
1031 | "width": null,
1032 | "min_width": null,
1033 | "border": null,
1034 | "align_items": null,
1035 | "bottom": null,
1036 | "_model_module": "@jupyter-widgets/base",
1037 | "top": null,
1038 | "grid_column": null,
1039 | "overflow_y": null,
1040 | "overflow_x": null,
1041 | "grid_auto_flow": null,
1042 | "grid_area": null,
1043 | "grid_template_columns": null,
1044 | "flex": null,
1045 | "_model_name": "LayoutModel",
1046 | "justify_items": null,
1047 | "grid_row": null,
1048 | "max_height": null,
1049 | "align_content": null,
1050 | "visibility": null,
1051 | "align_self": null,
1052 | "height": null,
1053 | "min_height": null,
1054 | "padding": null,
1055 | "grid_auto_rows": null,
1056 | "grid_gap": null,
1057 | "max_width": null,
1058 | "order": null,
1059 | "_view_module_version": "1.2.0",
1060 | "grid_template_areas": null,
1061 | "object_position": null,
1062 | "object_fit": null,
1063 | "grid_auto_columns": null,
1064 | "margin": null,
1065 | "display": null,
1066 | "left": null
1067 | }
1068 | },
1069 | "819cfb49894f454491e16026ce133499": {
1070 | "model_module": "@jupyter-widgets/controls",
1071 | "model_name": "FloatProgressModel",
1072 | "state": {
1073 | "_view_name": "ProgressView",
1074 | "style": "IPY_MODEL_08d10b0c763f4ac0976d90ccbb839b85",
1075 | "_dom_classes": [],
1076 | "description": "Downloading: 100%",
1077 | "_model_name": "FloatProgressModel",
1078 | "bar_style": "success",
1079 | "max": 548118077,
1080 | "_view_module": "@jupyter-widgets/controls",
1081 | "_model_module_version": "1.5.0",
1082 | "value": 548118077,
1083 | "_view_count": null,
1084 | "_view_module_version": "1.5.0",
1085 | "orientation": "horizontal",
1086 | "min": 0,
1087 | "description_tooltip": null,
1088 | "_model_module": "@jupyter-widgets/controls",
1089 | "layout": "IPY_MODEL_9e54ec935dc54fb6abfb62bf8a373af5"
1090 | }
1091 | },
1092 | "84a3bea1d5614030b1f2397ee493214e": {
1093 | "model_module": "@jupyter-widgets/controls",
1094 | "model_name": "HTMLModel",
1095 | "state": {
1096 | "_view_name": "HTMLView",
1097 | "style": "IPY_MODEL_0655410dd4f3474cbe8fe2d082c1e4eb",
1098 | "_dom_classes": [],
1099 | "description": "",
1100 | "_model_name": "HTMLModel",
1101 | "placeholder": "",
1102 | "_view_module": "@jupyter-widgets/controls",
1103 | "_model_module_version": "1.5.0",
1104 | "value": " 548M/548M [00:12<00:00, 45.3MB/s]",
1105 | "_view_count": null,
1106 | "_view_module_version": "1.5.0",
1107 | "description_tooltip": null,
1108 | "_model_module": "@jupyter-widgets/controls",
1109 | "layout": "IPY_MODEL_f4705878eca6477d8eef19017330bfb5"
1110 | }
1111 | },
1112 | "08d10b0c763f4ac0976d90ccbb839b85": {
1113 | "model_module": "@jupyter-widgets/controls",
1114 | "model_name": "ProgressStyleModel",
1115 | "state": {
1116 | "_view_name": "StyleView",
1117 | "_model_name": "ProgressStyleModel",
1118 | "description_width": "initial",
1119 | "_view_module": "@jupyter-widgets/base",
1120 | "_model_module_version": "1.5.0",
1121 | "_view_count": null,
1122 | "_view_module_version": "1.2.0",
1123 | "bar_color": null,
1124 | "_model_module": "@jupyter-widgets/controls"
1125 | }
1126 | },
1127 | "9e54ec935dc54fb6abfb62bf8a373af5": {
1128 | "model_module": "@jupyter-widgets/base",
1129 | "model_name": "LayoutModel",
1130 | "state": {
1131 | "_view_name": "LayoutView",
1132 | "grid_template_rows": null,
1133 | "right": null,
1134 | "justify_content": null,
1135 | "_view_module": "@jupyter-widgets/base",
1136 | "overflow": null,
1137 | "_model_module_version": "1.2.0",
1138 | "_view_count": null,
1139 | "flex_flow": null,
1140 | "width": null,
1141 | "min_width": null,
1142 | "border": null,
1143 | "align_items": null,
1144 | "bottom": null,
1145 | "_model_module": "@jupyter-widgets/base",
1146 | "top": null,
1147 | "grid_column": null,
1148 | "overflow_y": null,
1149 | "overflow_x": null,
1150 | "grid_auto_flow": null,
1151 | "grid_area": null,
1152 | "grid_template_columns": null,
1153 | "flex": null,
1154 | "_model_name": "LayoutModel",
1155 | "justify_items": null,
1156 | "grid_row": null,
1157 | "max_height": null,
1158 | "align_content": null,
1159 | "visibility": null,
1160 | "align_self": null,
1161 | "height": null,
1162 | "min_height": null,
1163 | "padding": null,
1164 | "grid_auto_rows": null,
1165 | "grid_gap": null,
1166 | "max_width": null,
1167 | "order": null,
1168 | "_view_module_version": "1.2.0",
1169 | "grid_template_areas": null,
1170 | "object_position": null,
1171 | "object_fit": null,
1172 | "grid_auto_columns": null,
1173 | "margin": null,
1174 | "display": null,
1175 | "left": null
1176 | }
1177 | },
1178 | "0655410dd4f3474cbe8fe2d082c1e4eb": {
1179 | "model_module": "@jupyter-widgets/controls",
1180 | "model_name": "DescriptionStyleModel",
1181 | "state": {
1182 | "_view_name": "StyleView",
1183 | "_model_name": "DescriptionStyleModel",
1184 | "description_width": "",
1185 | "_view_module": "@jupyter-widgets/base",
1186 | "_model_module_version": "1.5.0",
1187 | "_view_count": null,
1188 | "_view_module_version": "1.2.0",
1189 | "_model_module": "@jupyter-widgets/controls"
1190 | }
1191 | },
1192 | "f4705878eca6477d8eef19017330bfb5": {
1193 | "model_module": "@jupyter-widgets/base",
1194 | "model_name": "LayoutModel",
1195 | "state": {
1196 | "_view_name": "LayoutView",
1197 | "grid_template_rows": null,
1198 | "right": null,
1199 | "justify_content": null,
1200 | "_view_module": "@jupyter-widgets/base",
1201 | "overflow": null,
1202 | "_model_module_version": "1.2.0",
1203 | "_view_count": null,
1204 | "flex_flow": null,
1205 | "width": null,
1206 | "min_width": null,
1207 | "border": null,
1208 | "align_items": null,
1209 | "bottom": null,
1210 | "_model_module": "@jupyter-widgets/base",
1211 | "top": null,
1212 | "grid_column": null,
1213 | "overflow_y": null,
1214 | "overflow_x": null,
1215 | "grid_auto_flow": null,
1216 | "grid_area": null,
1217 | "grid_template_columns": null,
1218 | "flex": null,
1219 | "_model_name": "LayoutModel",
1220 | "justify_items": null,
1221 | "grid_row": null,
1222 | "max_height": null,
1223 | "align_content": null,
1224 | "visibility": null,
1225 | "align_self": null,
1226 | "height": null,
1227 | "min_height": null,
1228 | "padding": null,
1229 | "grid_auto_rows": null,
1230 | "grid_gap": null,
1231 | "max_width": null,
1232 | "order": null,
1233 | "_view_module_version": "1.2.0",
1234 | "grid_template_areas": null,
1235 | "object_position": null,
1236 | "object_fit": null,
1237 | "grid_auto_columns": null,
1238 | "margin": null,
1239 | "display": null,
1240 | "left": null
1241 | }
1242 | }
1243 | }
1244 | }
1245 | },
1246 | "cells": [
1247 | {
1248 | "cell_type": "markdown",
1249 | "metadata": {
1250 | "id": "nVNIlGjIxffD"
1251 | },
1252 | "source": [
1253 | "# Training a tweet generator model\n"
1254 | ]
1255 | },
1256 | {
1257 | "cell_type": "code",
1258 | "metadata": {
1259 | "colab": {
1260 | "base_uri": "https://localhost:8080/",
1261 | "height": 213,
1262 | "referenced_widgets": [
1263 | "169795ac5899428abc59e4bbd1c31fb2",
1264 | "8109b891da804ea1812300be930293bc",
1265 | "ae468860eaa541b98a266b42d7cc25a0",
1266 | "24f54adb9ede4ee1bb55020f03b1d0aa",
1267 | "f2c0610c2e5348c199d4665f162e8067",
1268 | "8a044d24709f4a75adab056f7f1b1a19",
1269 | "60dd9c14ef364210933e892d1d6f3070",
1270 | "5fa8a3d8c5cb4f45aa1aa21b11c0200e",
1271 | "16f2d3c06a4b4d1f8d290ba9307359ae",
1272 | "f568a5a969004c0785c253c0f1c007e0",
1273 | "199ca4ca35024e579297d062f581fceb",
1274 | "a85541beb1574a3cbeffe1e2a7f68e9a",
1275 | "388aa3a3b61640798d51ef5873b4527d",
1276 | "8f45b4db30364904aa881d0eb6eb3664",
1277 | "997d9df0b1b44cbda161dd6aede6033b",
1278 | "bbd3f600363443e380d325073ffe2c94",
1279 | "6185dd576a7c4378bdfaca5ac188ad04",
1280 | "17cca8bf255046e383014412592177f3",
1281 | "d6144f472ade45068b7caa255e568391",
1282 | "ba19d902c23845b49e7611ef858e162d",
1283 | "bf7c641b24764c33a09afac8ad31637e",
1284 | "971861dbfb5f48ca94776f53eeb21d64",
1285 | "651bb42eb283408a85fdc2109ade9387",
1286 | "7558ed69090f4c40b22e6a0ca8268c43",
1287 | "5161accdbffe44768b5895b6d53daf48",
1288 | "4291cb0e3c3942d387b83a18e2fba993",
1289 | "bc37533e085a4c37aa3991bd6d216b02",
1290 | "66666e44a2d0421da1ce7ddb9c20b61e",
1291 | "79cff82ab6db4491a6c82157c3acbe61",
1292 | "bc096c5ededb48128858f8c4c6765997",
1293 | "85ea67060f994a0886fb0eb3c0a996f4",
1294 | "750f585dd68b421cb18e299fcbde3700"
1295 | ]
1296 | },
1297 | "id": "p8xG94Adz1e_",
1298 | "outputId": "8ec630d9-4e3d-45d0-ff33-2b8f7dac5afd"
1299 | },
1300 | "source": [
1301 | "from transformers import AutoTokenizer\n",
1302 | "\n",
1303 | "tokenizer = AutoTokenizer.from_pretrained(\"gpt2\")"
1304 | ],
1305 | "execution_count": 2,
1306 | "outputs": [
1307 | {
1308 | "output_type": "display_data",
1309 | "data": {
1310 | "application/vnd.jupyter.widget-view+json": {
1311 | "model_id": "169795ac5899428abc59e4bbd1c31fb2",
1312 | "version_minor": 0,
1313 | "version_major": 2
1314 | },
1315 | "text/plain": [
1316 | "HBox(children=(FloatProgress(value=0.0, description='Downloading', max=665.0, style=ProgressStyle(description_…"
1317 | ]
1318 | },
1319 | "metadata": {
1320 | "tags": []
1321 | }
1322 | },
1323 | {
1324 | "output_type": "stream",
1325 | "text": [
1326 | "\n"
1327 | ],
1328 | "name": "stdout"
1329 | },
1330 | {
1331 | "output_type": "display_data",
1332 | "data": {
1333 | "application/vnd.jupyter.widget-view+json": {
1334 | "model_id": "16f2d3c06a4b4d1f8d290ba9307359ae",
1335 | "version_minor": 0,
1336 | "version_major": 2
1337 | },
1338 | "text/plain": [
1339 | "HBox(children=(FloatProgress(value=0.0, description='Downloading', max=1042301.0, style=ProgressStyle(descript…"
1340 | ]
1341 | },
1342 | "metadata": {
1343 | "tags": []
1344 | }
1345 | },
1346 | {
1347 | "output_type": "stream",
1348 | "text": [
1349 | "\n"
1350 | ],
1351 | "name": "stdout"
1352 | },
1353 | {
1354 | "output_type": "display_data",
1355 | "data": {
1356 | "application/vnd.jupyter.widget-view+json": {
1357 | "model_id": "6185dd576a7c4378bdfaca5ac188ad04",
1358 | "version_minor": 0,
1359 | "version_major": 2
1360 | },
1361 | "text/plain": [
1362 | "HBox(children=(FloatProgress(value=0.0, description='Downloading', max=456318.0, style=ProgressStyle(descripti…"
1363 | ]
1364 | },
1365 | "metadata": {
1366 | "tags": []
1367 | }
1368 | },
1369 | {
1370 | "output_type": "stream",
1371 | "text": [
1372 | "\n"
1373 | ],
1374 | "name": "stdout"
1375 | },
1376 | {
1377 | "output_type": "display_data",
1378 | "data": {
1379 | "application/vnd.jupyter.widget-view+json": {
1380 | "model_id": "5161accdbffe44768b5895b6d53daf48",
1381 | "version_minor": 0,
1382 | "version_major": 2
1383 | },
1384 | "text/plain": [
1385 | "HBox(children=(FloatProgress(value=0.0, description='Downloading', max=1355256.0, style=ProgressStyle(descript…"
1386 | ]
1387 | },
1388 | "metadata": {
1389 | "tags": []
1390 | }
1391 | },
1392 | {
1393 | "output_type": "stream",
1394 | "text": [
1395 | "\n"
1396 | ],
1397 | "name": "stdout"
1398 | }
1399 | ]
1400 | },
1401 | {
1402 | "cell_type": "code",
1403 | "metadata": {
1404 | "colab": {
1405 | "base_uri": "https://localhost:8080/"
1406 | },
1407 | "id": "lrl8jp1S0TL3",
1408 | "outputId": "47a696ee-e58b-4d64-bca1-021ac6f59892"
1409 | },
1410 | "source": [
1411 | "from transformers import TextDataset,DataCollatorForLanguageModeling\n",
1412 | "\n",
1413 | "def load_dataset(train_path,tokenizer):\n",
1414 | " train_dataset = TextDataset(\n",
1415 | " tokenizer=tokenizer,\n",
1416 | " file_path=train_path,\n",
1417 | " block_size=128)\n",
1418 | " \n",
1419 | "# test_dataset = TextDataset(\n",
1420 | "# tokenizer=tokenizer,\n",
1421 | "# file_path=test_path,\n",
1422 | "# block_size=128) \n",
1423 | " \n",
1424 | " data_collator = DataCollatorForLanguageModeling(\n",
1425 | " tokenizer=tokenizer, mlm=False,\n",
1426 | " )\n",
1427 | " return train_dataset ,data_collator\n",
1428 | "\n",
1429 | "train_dataset ,data_collator = load_dataset('tweets_train.txt', tokenizer)"
1430 | ],
1431 | "execution_count": 3,
1432 | "outputs": [
1433 | {
1434 | "output_type": "stream",
1435 | "text": [
1436 | "/usr/local/lib/python3.6/dist-packages/transformers/data/datasets/language_modeling.py:58: FutureWarning: This dataset will be removed from the library soon, preprocessing should be handled with the 🤗 Datasets library. You can have a look at this example script for pointers: https://github.com/huggingface/transformers/blob/master/examples/language-modeling/run_mlm.py\n",
1437 | " FutureWarning,\n",
1438 | "Token indices sequence length is longer than the specified maximum sequence length for this model (113470 > 1024). Running this sequence through the model will result in indexing errors\n"
1439 | ],
1440 | "name": "stderr"
1441 | }
1442 | ]
1443 | },
1444 | {
1445 | "cell_type": "code",
1446 | "metadata": {
1447 | "colab": {
1448 | "base_uri": "https://localhost:8080/",
1449 | "height": 120,
1450 | "referenced_widgets": [
1451 | "322c8fb0b1bf40b9b2870e7fe1475361",
1452 | "803635b8dc1645b5bc38ff6f6c4a6ccf",
1453 | "819cfb49894f454491e16026ce133499",
1454 | "84a3bea1d5614030b1f2397ee493214e",
1455 | "08d10b0c763f4ac0976d90ccbb839b85",
1456 | "9e54ec935dc54fb6abfb62bf8a373af5",
1457 | "0655410dd4f3474cbe8fe2d082c1e4eb",
1458 | "f4705878eca6477d8eef19017330bfb5"
1459 | ]
1460 | },
1461 | "id": "eOKPBgJ30kJ1",
1462 | "outputId": "30150e33-c726-4cd6-e2b8-4ea7405af115"
1463 | },
1464 | "source": [
1465 | "from transformers import Trainer, TrainingArguments,AutoModelWithLMHead\n",
1466 | "\n",
1467 | "model = AutoModelWithLMHead.from_pretrained(\"gpt2\")\n",
1468 | "\n",
1469 | "training_args = TrainingArguments(\n",
1470 | " output_dir=\"./gpt2-tweetgen\", #The output directory\n",
1471 | " overwrite_output_dir=True, #overwrite the content of the output directory\n",
1472 | " num_train_epochs=3, # number of training epochs\n",
1473 | " per_device_train_batch_size=32, # batch size for training\n",
1474 | " per_device_eval_batch_size=64, # batch size for evaluation\n",
1475 | " eval_steps = 400, # Number of update steps between two evaluations.\n",
1476 | " save_steps=800, # after # steps model is saved \n",
1477 | " warmup_steps=500,# number of warmup steps for learning rate scheduler\n",
1478 | " )\n",
1479 | "\n",
1480 | "\n",
1481 | "trainer = Trainer(\n",
1482 | " model=model,\n",
1483 | " args=training_args,\n",
1484 | " data_collator=data_collator,\n",
1485 | " train_dataset=train_dataset,\n",
1486 | ")"
1487 | ],
1488 | "execution_count": 4,
1489 | "outputs": [
1490 | {
1491 | "output_type": "stream",
1492 | "text": [
1493 | "/usr/local/lib/python3.6/dist-packages/transformers/models/auto/modeling_auto.py:925: FutureWarning: The class `AutoModelWithLMHead` is deprecated and will be removed in a future version. Please use `AutoModelForCausalLM` for causal language models, `AutoModelForMaskedLM` for masked language models and `AutoModelForSeq2SeqLM` for encoder-decoder models.\n",
1494 | " FutureWarning,\n"
1495 | ],
1496 | "name": "stderr"
1497 | },
1498 | {
1499 | "output_type": "display_data",
1500 | "data": {
1501 | "application/vnd.jupyter.widget-view+json": {
1502 | "model_id": "322c8fb0b1bf40b9b2870e7fe1475361",
1503 | "version_minor": 0,
1504 | "version_major": 2
1505 | },
1506 | "text/plain": [
1507 | "HBox(children=(FloatProgress(value=0.0, description='Downloading', max=548118077.0, style=ProgressStyle(descri…"
1508 | ]
1509 | },
1510 | "metadata": {
1511 | "tags": []
1512 | }
1513 | },
1514 | {
1515 | "output_type": "stream",
1516 | "text": [
1517 | "\n"
1518 | ],
1519 | "name": "stdout"
1520 | }
1521 | ]
1522 | },
1523 | {
1524 | "cell_type": "code",
1525 | "metadata": {
1526 | "colab": {
1527 | "base_uri": "https://localhost:8080/",
1528 | "height": 112
1529 | },
1530 | "id": "MEno7Hgr1Anw",
1531 | "outputId": "5b193783-397d-4fee-df56-5a4d6d36dac5"
1532 | },
1533 | "source": [
1534 | "trainer.train()"
1535 | ],
1536 | "execution_count": 5,
1537 | "outputs": [
1538 | {
1539 | "output_type": "display_data",
1540 | "data": {
1541 | "text/html": [
1542 | "\n",
1543 | " \n",
1544 | " \n",
1553 | " \n",
1554 | "
\n",
1555 | " [84/84 01:36, Epoch 3/3]\n",
1556 | "
\n",
1557 | " \n",
1558 | " \n",
1559 | " \n",
1560 | " | Step | \n",
1561 | " Training Loss | \n",
1562 | "
\n",
1563 | " \n",
1564 | " \n",
1565 | " \n",
1566 | "
"
1567 | ],
1568 | "text/plain": [
1569 | ""
1570 | ]
1571 | },
1572 | "metadata": {
1573 | "tags": []
1574 | }
1575 | },
1576 | {
1577 | "output_type": "execute_result",
1578 | "data": {
1579 | "text/plain": [
1580 | "TrainOutput(global_step=84, training_loss=3.549079168410528, metrics={'train_runtime': 97.5001, 'train_samples_per_second': 0.862, 'total_flos': 254024455421952, 'epoch': 3.0})"
1581 | ]
1582 | },
1583 | "metadata": {
1584 | "tags": []
1585 | },
1586 | "execution_count": 5
1587 | }
1588 | ]
1589 | },
1590 | {
1591 | "cell_type": "code",
1592 | "metadata": {
1593 | "id": "TOTbP42X1q9b"
1594 | },
1595 | "source": [
1596 | "trainer.save_model()"
1597 | ],
1598 | "execution_count": 6,
1599 | "outputs": []
1600 | },
1601 | {
1602 | "cell_type": "code",
1603 | "metadata": {
1604 | "id": "jGRP85uT3psQ"
1605 | },
1606 | "source": [
1607 | "from transformers import pipeline\n",
1608 | "\n",
1609 | "generator = pipeline('text-generation',model='./gpt2-tweetgen', tokenizer='gpt2',config={'max_length':280})\n"
1610 | ],
1611 | "execution_count": 10,
1612 | "outputs": []
1613 | },
1614 | {
1615 | "cell_type": "code",
1616 | "metadata": {
1617 | "colab": {
1618 | "base_uri": "https://localhost:8080/"
1619 | },
1620 | "id": "DQmAuGy833Mr",
1621 | "outputId": "e9eea8c7-5e9a-4d25-bf46-9485e56a30bb"
1622 | },
1623 | "source": [
1624 | "generator('America')"
1625 | ],
1626 | "execution_count": 12,
1627 | "outputs": [
1628 | {
1629 | "output_type": "stream",
1630 | "text": [
1631 | "Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.\n"
1632 | ],
1633 | "name": "stderr"
1634 | },
1635 | {
1636 | "output_type": "execute_result",
1637 | "data": {
1638 | "text/plain": [
1639 | "[{'generated_text': \"America. (Don't forget about Trump's tweet!)\"}]"
1640 | ]
1641 | },
1642 | "metadata": {
1643 | "tags": []
1644 | },
1645 | "execution_count": 12
1646 | }
1647 | ]
1648 | },
1649 | {
1650 | "cell_type": "code",
1651 | "metadata": {
1652 | "colab": {
1653 | "base_uri": "https://localhost:8080/"
1654 | },
1655 | "id": "-rWLndu94iDO",
1656 | "outputId": "5156b8b9-b079-43a8-f8d7-d917b2d0e6fc"
1657 | },
1658 | "source": [
1659 | "generator('Me')"
1660 | ],
1661 | "execution_count": 14,
1662 | "outputs": [
1663 | {
1664 | "output_type": "stream",
1665 | "text": [
1666 | "Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.\n"
1667 | ],
1668 | "name": "stderr"
1669 | },
1670 | {
1671 | "output_type": "execute_result",
1672 | "data": {
1673 | "text/plain": [
1674 | "[{'generated_text': \"Me on. We are all very, very sad to hear about what has been done to this family after so many years. We want to thank those who were here to help us, like our president's team, our state officials, to fight for\"}]"
1675 | ]
1676 | },
1677 | "metadata": {
1678 | "tags": []
1679 | },
1680 | "execution_count": 14
1681 | }
1682 | ]
1683 | },
1684 | {
1685 | "cell_type": "code",
1686 | "metadata": {
1687 | "colab": {
1688 | "base_uri": "https://localhost:8080/"
1689 | },
1690 | "id": "QxHE-E2A4pPi",
1691 | "outputId": "01ae65d9-2f92-4809-ac83-2c0ffc3830fa"
1692 | },
1693 | "source": [
1694 | "generator('Bernie')"
1695 | ],
1696 | "execution_count": 15,
1697 | "outputs": [
1698 | {
1699 | "output_type": "stream",
1700 | "text": [
1701 | "Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.\n"
1702 | ],
1703 | "name": "stderr"
1704 | },
1705 | {
1706 | "output_type": "execute_result",
1707 | "data": {
1708 | "text/plain": [
1709 | "[{'generated_text': 'Bernie and Senator Sanders today joined us today in calling for Donald Rumsfeld to be impeached for lying to Vice President Joe Biden about his support for war in Iraq.\\n\\nLet me come to you now and discuss what is at stake for the'}]"
1710 | ]
1711 | },
1712 | "metadata": {
1713 | "tags": []
1714 | },
1715 | "execution_count": 15
1716 | }
1717 | ]
1718 | },
1719 | {
1720 | "cell_type": "code",
1721 | "metadata": {
1722 | "colab": {
1723 | "base_uri": "https://localhost:8080/"
1724 | },
1725 | "id": "NFsw2Qsq4wRT",
1726 | "outputId": "795a4c14-4e3f-44d9-cc7b-09fcef9f74fc"
1727 | },
1728 | "source": [
1729 | "generator('')"
1730 | ],
1731 | "execution_count": 16,
1732 | "outputs": [
1733 | {
1734 | "output_type": "stream",
1735 | "text": [
1736 | "Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.\n"
1737 | ],
1738 | "name": "stderr"
1739 | },
1740 | {
1741 | "output_type": "execute_result",
1742 | "data": {
1743 | "text/plain": [
1744 | "[{'generated_text': 'The next wave, as Donald Trump has vowed, will target American workers. A few small groups are trying for change: young workers, minorities and people of color.\\n\\nThe American Dream deserves a president who will make fair and free trade a'}]"
1745 | ]
1746 | },
1747 | "metadata": {
1748 | "tags": []
1749 | },
1750 | "execution_count": 16
1751 | }
1752 | ]
1753 | },
1754 | {
1755 | "cell_type": "code",
1756 | "metadata": {
1757 | "id": "zQJSaWRU41Ds"
1758 | },
1759 | "source": [
1760 | ""
1761 | ],
1762 | "execution_count": null,
1763 | "outputs": []
1764 | }
1765 | ]
1766 | }
--------------------------------------------------------------------------------