Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pszemraj/a5bb1952ea9a13fef1e4f0390ecb2fb5 to your computer and use it in GitHub Desktop.
Save pszemraj/a5bb1952ea9a13fef1e4f0390ecb2fb5 to your computer and use it in GitHub Desktop.
[GPT2-dailydialogue] aitextgen - text generation + training on GPU.ipynb
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"accelerator": "GPU",
"colab": {
"name": "[GPT2-dailydialogue] aitextgen - text generation + training on GPU.ipynb",
"provenance": [],
"collapsed_sections": [
"NK7daXR_cAU1"
],
"toc_visible": true,
"machine_shape": "hm",
"include_colab_link": true
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"9afea47529914bebaed6efafd367e2da": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_2927beaff2a24dbebe02e6eebb91acd2",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_98bc65a43ae34d49a6474953b05702a6",
"IPY_MODEL_796e9c54a5c54566a567dab0ba29e2b7",
"IPY_MODEL_0d60b852dc374ca8bd75d3be9edb1ba0"
]
}
},
"2927beaff2a24dbebe02e6eebb91acd2": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"98bc65a43ae34d49a6474953b05702a6": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_bbde77cd0baa4c1e996467d0d98d7e56",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "replacing speaker names: 100%",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_098ded8ef35a4784b4c4c3d6e588d3ed"
}
},
"796e9c54a5c54566a567dab0ba29e2b7": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_d9a3711063b3472aa7e8d0201b98d6e6",
"_dom_classes": [],
"description": "",
"_model_name": "FloatProgressModel",
"bar_style": "success",
"max": 216768,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 216768,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_ff7022056b5f4c0b84c20180d8e9b6b8"
}
},
"0d60b852dc374ca8bd75d3be9edb1ba0": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_c42ae63cc9954998b2b79cddb650f5d9",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 216768/216768 [00:00<00:00, 1017176.26it/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_87b5d8fb9b74479db76285686f87586f"
}
},
"bbde77cd0baa4c1e996467d0d98d7e56": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"098ded8ef35a4784b4c4c3d6e588d3ed": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"d9a3711063b3472aa7e8d0201b98d6e6": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"ff7022056b5f4c0b84c20180d8e9b6b8": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"c42ae63cc9954998b2b79cddb650f5d9": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"87b5d8fb9b74479db76285686f87586f": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"4bbc1e389df847ebbf1bd8fffcc7ff14": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_acb9d987da394257a48f60ac39f344c1",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_bd937d21823d449ebf4a5a3e24f41d69",
"IPY_MODEL_556377a09cc74bec9f183d7458fe0733",
"IPY_MODEL_597cd87c3b464f58b38c477e759719da"
]
}
},
"acb9d987da394257a48f60ac39f344c1": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"bd937d21823d449ebf4a5a3e24f41d69": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_39fddd7e8c20410990b87235b4f5cbf1",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100%",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_b5a67da5cd7446b6bcabab22ee64c0e2"
}
},
"556377a09cc74bec9f183d7458fe0733": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_b6d12f71d5a741529de496f91cdec0e0",
"_dom_classes": [],
"description": "",
"_model_name": "FloatProgressModel",
"bar_style": "success",
"max": 50,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 50,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_0e6058357d2e4f34a8a1082bd018342d"
}
},
"597cd87c3b464f58b38c477e759719da": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_c49b0e4e164b438bbefb00cd002d9bdb",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 50/50 [02:18<00:00, 2.75s/it]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_af0143ab76c244788b9663be849b2194"
}
},
"39fddd7e8c20410990b87235b4f5cbf1": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"b5a67da5cd7446b6bcabab22ee64c0e2": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"b6d12f71d5a741529de496f91cdec0e0": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"0e6058357d2e4f34a8a1082bd018342d": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"c49b0e4e164b438bbefb00cd002d9bdb": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"af0143ab76c244788b9663be849b2194": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"29dfe106b8334f5181e3cffce65c6943": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_cf832eb20b524aabad57f115727c96a6",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_be7073f8181946c08f1259fa674aa267",
"IPY_MODEL_985f08b647a7431da0a38e999155ecf3",
"IPY_MODEL_e4681291ca3d45839f3a781ce3209c34"
]
}
},
"cf832eb20b524aabad57f115727c96a6": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"be7073f8181946c08f1259fa674aa267": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_407dc22fab8c424b8ad5f148884c0cd0",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100%",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_c55efbb8143e4eb6bd56a61bad4bbc83"
}
},
"985f08b647a7431da0a38e999155ecf3": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_9a4050d8862d4e98b0febf2d6b8548ec",
"_dom_classes": [],
"description": "",
"_model_name": "FloatProgressModel",
"bar_style": "success",
"max": 50,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 50,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_749fa54d83cc43a2803cd06bdb1d4707"
}
},
"e4681291ca3d45839f3a781ce3209c34": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_700b93e7589646f99556494bf0e998ce",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 50/50 [02:19<00:00, 2.79s/it]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_dcdd8cde42824ebfb7bb4fb6e608ace1"
}
},
"407dc22fab8c424b8ad5f148884c0cd0": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"c55efbb8143e4eb6bd56a61bad4bbc83": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"9a4050d8862d4e98b0febf2d6b8548ec": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"749fa54d83cc43a2803cd06bdb1d4707": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"700b93e7589646f99556494bf0e998ce": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"dcdd8cde42824ebfb7bb4fb6e608ace1": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"008e7448840845f98466f6153216d2b6": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_8e7c900ebef044008fa1c6efa83dc0bd",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_528a35eaec2144efb62fc42bb1ae1be4",
"IPY_MODEL_66bd0256064f4c7e80083ada370c8ecb",
"IPY_MODEL_cb7ac963d1ce428b96e7647a2432c9e3"
]
}
},
"8e7c900ebef044008fa1c6efa83dc0bd": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"528a35eaec2144efb62fc42bb1ae1be4": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_125c4bfded16435e906eb9bcc40bf630",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100%",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_1c1064016c6f4c02bb404dd92602ac30"
}
},
"66bd0256064f4c7e80083ada370c8ecb": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_cf372e32f2c34a7d954aff392a5309f2",
"_dom_classes": [],
"description": "",
"_model_name": "FloatProgressModel",
"bar_style": "success",
"max": 50,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 50,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_6872b987fd604c7b8967236a236619a7"
}
},
"cb7ac963d1ce428b96e7647a2432c9e3": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_5f555482f3ac475e9da89d5a16a94ea3",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 50/50 [02:16<00:00, 2.73s/it]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_6ffc0e2ef884490e8e92b5e6ff3f77e4"
}
},
"125c4bfded16435e906eb9bcc40bf630": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"1c1064016c6f4c02bb404dd92602ac30": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"cf372e32f2c34a7d954aff392a5309f2": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"6872b987fd604c7b8967236a236619a7": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"5f555482f3ac475e9da89d5a16a94ea3": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"6ffc0e2ef884490e8e92b5e6ff3f77e4": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"43bcf41ce318410c996ac8c5694e75d9": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_2f79f95c687545a1820e92fc7df1330d",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_9d5f98d28c4f4523b0d512d05bcb1a0a",
"IPY_MODEL_37a135c212474b5e8dadd58e66577d2c",
"IPY_MODEL_961643cbf71e40f29ba071a03e3022a6"
]
}
},
"2f79f95c687545a1820e92fc7df1330d": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"9d5f98d28c4f4523b0d512d05bcb1a0a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_c9a36e89a8f046b4b21d23bd21f9bff5",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100%",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_704f3c9661714c35ac5c65fb6b8f0ee2"
}
},
"37a135c212474b5e8dadd58e66577d2c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_05bb0964d57c47099e3424f69d210f8f",
"_dom_classes": [],
"description": "",
"_model_name": "FloatProgressModel",
"bar_style": "success",
"max": 50,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 50,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_2e5c7d395e144cf896f9c995440b23bb"
}
},
"961643cbf71e40f29ba071a03e3022a6": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_b4e32a35d24b42a3a2ce182b04a8681d",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 50/50 [02:20<00:00, 2.79s/it]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_e630d959cd1c4ab792726f1d45f1c306"
}
},
"c9a36e89a8f046b4b21d23bd21f9bff5": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"704f3c9661714c35ac5c65fb6b8f0ee2": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"05bb0964d57c47099e3424f69d210f8f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"2e5c7d395e144cf896f9c995440b23bb": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"b4e32a35d24b42a3a2ce182b04a8681d": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"e630d959cd1c4ab792726f1d45f1c306": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"d5ce783d64474b3cb86369b792ed637b": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_b7100f97a2d74632bf08db45a4f54d59",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_e9b6ea50013145d4a28dfaa0271ff3ec",
"IPY_MODEL_f427497ef9d54d69a2dd59bae89b74b8",
"IPY_MODEL_bb1201c9ace44c00930e2ea7419dbfe2"
]
}
},
"b7100f97a2d74632bf08db45a4f54d59": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"e9b6ea50013145d4a28dfaa0271ff3ec": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_b9ea1fd0717c4bd2acdaca68c690426a",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100%",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_457a85a847c24117a598b0504a299840"
}
},
"f427497ef9d54d69a2dd59bae89b74b8": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_7554f5c2ccd7416d9a5a093ee8f4b616",
"_dom_classes": [],
"description": "",
"_model_name": "FloatProgressModel",
"bar_style": "success",
"max": 50,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 50,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_497121a49f1c43b9a53ede1dd13353b1"
}
},
"bb1201c9ace44c00930e2ea7419dbfe2": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_337fe6983dbf4e498abdca60bca7e7af",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 50/50 [02:15<00:00, 2.71s/it]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_729c1ccdf39c4a1e8446fbb6d862ec3d"
}
},
"b9ea1fd0717c4bd2acdaca68c690426a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"457a85a847c24117a598b0504a299840": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"7554f5c2ccd7416d9a5a093ee8f4b616": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"497121a49f1c43b9a53ede1dd13353b1": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"337fe6983dbf4e498abdca60bca7e7af": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"729c1ccdf39c4a1e8446fbb6d862ec3d": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
}
}
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/pszemraj/a5bb1952ea9a13fef1e4f0390ecb2fb5/-gpt2-dailydialogue-aitextgen-text-generation-training-on-gpu.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "H7LoMj4GA4n_"
},
"source": [
"# aitextgen — Train a GPT-2 (or GPT Neo) Text-Generating Model w/ GPU\n",
"\n",
"This notebook is based on the original tutorial from `aitextgen`!\n",
"\n",
"For more about `aitextgen`, you can visit [this GitHub repository](https://github.com/minimaxir/aitextgen) or [read the documentation](https://docs.aitextgen.io/).\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "xgMEhF7J3ubw",
"outputId": "31551a18-f3b3-41cd-bacb-d34e8ac23f6d"
},
"source": [
"!nvidia-smi"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Thu Oct 21 23:19:27 2021 \n",
"+-----------------------------------------------------------------------------+\n",
"| NVIDIA-SMI 470.74 Driver Version: 460.32.03 CUDA Version: 11.2 |\n",
"|-------------------------------+----------------------+----------------------+\n",
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n",
"| | | MIG M. |\n",
"|===============================+======================+======================|\n",
"| 0 Tesla V100-SXM2... Off | 00000000:00:04.0 Off | 0 |\n",
"| N/A 38C P0 25W / 300W | 0MiB / 16160MiB | 0% Default |\n",
"| | | N/A |\n",
"+-------------------------------+----------------------+----------------------+\n",
" \n",
"+-----------------------------------------------------------------------------+\n",
"| Processes: |\n",
"| GPU GI CI PID Type Process name GPU Memory |\n",
"| ID ID Usage |\n",
"|=============================================================================|\n",
"| No running processes found |\n",
"+-----------------------------------------------------------------------------+\n"
]
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "NK7daXR_cAU1"
},
"source": [
"## formatting"
]
},
{
"cell_type": "code",
"metadata": {
"id": "XztfEh86cDCR"
},
"source": [
"from IPython.display import HTML, display\n",
"# colab formatting\n",
"def set_css():\n",
" display(\n",
" HTML(\n",
" \"\"\"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" \"\"\"\n",
" )\n",
" )\n",
"\n",
"get_ipython().events.register(\"pre_run_cell\", set_css)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "CemDfmdgjefZ"
},
"source": [
"# setup"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 156
},
"id": "_UJ8ek31Uz-r",
"outputId": "736ecf9a-0e04-4634-d9c3-be6cd26373d6"
},
"source": [
"# update torch in case using a A100 GPU\n",
"!pip3 install torch==1.9.1+cu111 -f -q https://download.pytorch.org/whl/torch_stable.html\n",
"\n",
"!pip3 install cudatoolkit"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Looking in links: -q\n",
"Collecting https://download.pytorch.org/whl/torch_stable.html\n",
" Downloading https://download.pytorch.org/whl/torch_stable.html (253 kB)\n",
"\u001b[K |████████████████████████████████| 253 kB 511 kB/s \n",
"\u001b[31m ERROR: Cannot unpack file /tmp/pip-unpack-2ldte1l4/torch_stable.html (downloaded from /tmp/pip-req-build-nxej9t5y, content-type: text/html); cannot detect archive format\u001b[0m\n",
"\u001b[31mERROR: Cannot determine archive format of /tmp/pip-req-build-nxej9t5y\u001b[0m\n",
"\u001b[?25h\u001b[31mERROR: Could not find a version that satisfies the requirement cudatoolkit (from versions: none)\u001b[0m\n",
"\u001b[31mERROR: No matching distribution found for cudatoolkit\u001b[0m\n"
]
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 312
},
"id": "KBkpRgBCBS2_",
"outputId": "625dffb2-f5fb-4848-cdd5-0b3381d6a0b8"
},
"source": [
"!pip install -q aitextgen\n",
"\n",
"import logging\n",
"\n",
"logging.basicConfig(\n",
" format=\"%(asctime)s — %(levelname)s — %(name)s — %(message)s\",\n",
" datefmt=\"%m/%d/%Y %H:%M:%S\",\n",
" level=logging.INFO,\n",
")\n",
"\n",
"from aitextgen import aitextgen\n",
"from aitextgen.colab import mount_gdrive, copy_file_from_gdrive"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"\u001b[K |████████████████████████████████| 572 kB 16.6 MB/s \n",
"\u001b[K |████████████████████████████████| 2.9 MB 56.3 MB/s \n",
"\u001b[K |████████████████████████████████| 87 kB 7.8 MB/s \n",
"\u001b[K |████████████████████████████████| 925 kB 59.7 MB/s \n",
"\u001b[K |████████████████████████████████| 829 kB 66.8 MB/s \n",
"\u001b[K |████████████████████████████████| 596 kB 63.7 MB/s \n",
"\u001b[K |████████████████████████████████| 282 kB 68.6 MB/s \n",
"\u001b[K |████████████████████████████████| 125 kB 78.1 MB/s \n",
"\u001b[K |████████████████████████████████| 1.3 MB 70.7 MB/s \n",
"\u001b[K |████████████████████████████████| 895 kB 66.8 MB/s \n",
"\u001b[K |████████████████████████████████| 56 kB 4.7 MB/s \n",
"\u001b[K |████████████████████████████████| 3.3 MB 69.6 MB/s \n",
"\u001b[K |████████████████████████████████| 271 kB 80.3 MB/s \n",
"\u001b[K |████████████████████████████████| 160 kB 85.4 MB/s \n",
"\u001b[?25h Building wheel for aitextgen (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Building wheel for fire (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Building wheel for future (setup.py) ... \u001b[?25l\u001b[?25hdone\n"
]
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"id": "DuC67no59vMe",
"outputId": "9c6bf557-5b27-4500-b0b7-b8eb8c37ba73"
},
"source": [
"mount_gdrive()\n"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Mounted at /content/drive\n"
]
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Bj2IJLHP3KwE"
},
"source": [
"## GPU\n",
"\n",
"Colaboratory uses a Nvidia P4, an Nvidia T4, an Nvidia P100, or an Nvidia V100. For finetuning GPT-2 124M, any of these GPUs will be fine, but for text generation, a T4 or a P100 is ideal since they have more VRAM. **If you receive a T4 or a V100 GPU, you can enable `fp16=True` during training for faster/more memory efficient training.**\n",
"\n",
"You can verify which GPU is active by running the cell below. If you want to try for a different GPU, go to **Runtime -> Factory Reset Runtime**."
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 364
},
"id": "sUmTooTW3osf",
"outputId": "92929a52-cc42-41e3-bd0a-5ae9cb2e730d"
},
"source": [
"!nvidia-smi"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Thu Oct 21 23:20:27 2021 \n",
"+-----------------------------------------------------------------------------+\n",
"| NVIDIA-SMI 470.74 Driver Version: 460.32.03 CUDA Version: 11.2 |\n",
"|-------------------------------+----------------------+----------------------+\n",
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n",
"| | | MIG M. |\n",
"|===============================+======================+======================|\n",
"| 0 Tesla V100-SXM2... Off | 00000000:00:04.0 Off | 0 |\n",
"| N/A 38C P0 25W / 300W | 0MiB / 16160MiB | 0% Default |\n",
"| | | N/A |\n",
"+-------------------------------+----------------------+----------------------+\n",
" \n",
"+-----------------------------------------------------------------------------+\n",
"| Processes: |\n",
"| GPU GI CI PID Type Process name GPU Memory |\n",
"| ID ID Usage |\n",
"|=============================================================================|\n",
"| No running processes found |\n",
"+-----------------------------------------------------------------------------+\n"
]
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "trRhgNvsH4Wn"
},
"source": [
"## Loading GPT-2 or GPT Neo\n",
"\n",
"If you're retraining a model on new text, you need to download and load the GPT-2 model into the GPU. \n",
"\n",
"There are several sizes of GPT-2:\n",
"\n",
"* `124M` (default): the \"small\" model, 500MB on disk.\n",
"* `355M` (default): the \"medium\" model, 1.5GB on disk.\n",
"* `774M` (default): the \"large\" model, 3GB on disk.\n",
"\n",
"You can also finetune a GPT Neo model instead, which is more suitable for longer texts and the base model has more recent data:\n",
"\n",
"* `125M`: Analogous to the GPT-2 124M model.\n",
"* `350M`: Analogous to the GPT-2 355M model\n",
"\n",
"The next cell downloads the model and saves it in the Colaboratory VM. If the model has already been downloaded, running this cell will reload it."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "XPPsg8XDwHvl"
},
"source": [
"## "
]
},
{
"cell_type": "code",
"metadata": {
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 17
},
"id": "AXIbld-ASHL9",
"outputId": "7403beaf-bb2c-4bf6-f75b-1e6232e6e708"
},
"source": [
"model_size = \"355M\" #@param [\"355M\", \"774M\"]\n",
"load_from_folder = True #@param {type:\"boolean\"}\n",
"load_folder_dir = \"/content/drive/MyDrive/Programming/AI_peter/gpt2_dailydialogue_gpu_355M\" #@param {type:\"string\"}\n"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 139
},
"id": "flqSlHjMIeIw",
"outputId": "f3261c0f-098c-407a-ace3-ccb97b9b2973"
},
"source": [
"if load_from_folder:\n",
" ai = aitextgen(model_folder=load_folder_dir, to_gpu=True,\n",
" gradient_checkpointing=True)\n",
"else:\n",
" ai = aitextgen(tf_gpt2=model_size, to_gpu=True,\n",
" gradient_checkpointing=True)\n",
"# ai = aitextgen(tf_gpt2=\"124M\", to_gpu=True)\n",
"# https://huggingface.co/distilgpt2\n",
"# Comment out the above line and uncomment the below line to use GPT Neo instead.\n",
"# model_size\n",
"# ai = aitextgen(model='gpt2-medium', \n",
"# to_gpu=True, \n",
"# gradient_checkpointing=True)"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"10/21/2021 23:20:28 — INFO — aitextgen — Loading model from provided weights and config in //content/drive/MyDrive/Programming/AI_peter/gpt2_dailydialogue_gpu_355M.\n",
"/usr/local/lib/python3.7/dist-packages/transformers/configuration_utils.py:337: UserWarning: Passing `gradient_checkpointing` to a config initialization is deprecated and will be removed in v5 Transformers. Using `model.gradient_checkpointing_enable()` instead, or if you are using the `Trainer` API, pass `gradient_checkpointing=True` in your `TrainingArguments`.\n",
" \"Passing `gradient_checkpointing` to a config initialization is deprecated and will be removed in v5 \"\n",
"10/21/2021 23:20:44 — INFO — aitextgen — GPT2 loaded with 354M parameters.\n",
"10/21/2021 23:20:44 — INFO — aitextgen — Gradient checkpointing enabled for model training.\n",
"10/21/2021 23:20:44 — INFO — aitextgen — Using the default GPT-2 Tokenizer.\n"
]
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "W7oQAqQHiFiX"
},
"source": [
"# load training data\n",
"\n",
"\n",
"- <font color=\"orange\"> combine any other data from the _DailyDialogue_ dataset and do a final pass of training (with different data) </font>"
]
},
{
"cell_type": "code",
"metadata": {
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 17
},
"id": "jUWsiVOCUlLo",
"outputId": "ff42ce21-e2fa-4b1e-d9a8-5fd9142ac335"
},
"source": [
"dl_link = \"https://www.dropbox.com/s/zngfhi9zw438fxk/daily_dialogue_augment.txt?dl=1\" #@param {type:\"string\"}\n"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"id": "hirJkLvbUrMb",
"outputId": "0d10f818-baa8-4a75-a79c-39eff9b8b902"
},
"source": [
"# download test image\n",
"from urllib import request\n",
"from os.path import join\n",
"import os\n",
"vm_wd = os.getcwd()\n",
"local_name = join(vm_wd, \"dailydialogue.txt\")\n",
"request.urlretrieve(dl_link, local_name)\n"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"('/content/dailydialogue.txt', <http.client.HTTPMessage at 0x7fe94d380150>)"
]
},
"metadata": {},
"execution_count": 10
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 49,
"referenced_widgets": [
"9afea47529914bebaed6efafd367e2da",
"2927beaff2a24dbebe02e6eebb91acd2",
"98bc65a43ae34d49a6474953b05702a6",
"796e9c54a5c54566a567dab0ba29e2b7",
"0d60b852dc374ca8bd75d3be9edb1ba0",
"bbde77cd0baa4c1e996467d0d98d7e56",
"098ded8ef35a4784b4c4c3d6e588d3ed",
"d9a3711063b3472aa7e8d0201b98d6e6",
"ff7022056b5f4c0b84c20180d8e9b6b8",
"c42ae63cc9954998b2b79cddb650f5d9",
"87b5d8fb9b74479db76285686f87586f"
]
},
"id": "cEWZnWyYX3y8",
"outputId": "476c7e5f-c098-42fd-87ad-d08d23c4b9c6"
},
"source": [
"# adjust names \n",
"\n",
"\n",
"with open(local_name, 'r', encoding='utf-8', errors='ignore') as fi:\n",
" orig_lines = fi.readlines()\n",
"\n",
"from tqdm.auto import tqdm\n",
"\n",
"upd_lines = []\n",
"\n",
"for line in tqdm(orig_lines, total=len(orig_lines), desc=\"replacing speaker names\"):\n",
" fixline = line.replace(\"speaker a\", \"john smith\")\n",
" fixline = fixline.replace(\"speaker b\", \"nancy sellers\")\n",
" upd_lines.append(fixline)\n",
"\n",
"local_namev2 = join(vm_wd, \"V2dailydialogue.txt\")\n",
"\n",
"with open(local_namev2, 'w', encoding='utf-8', errors='ignore') as fo:\n",
" fo.writelines(upd_lines)\n"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9afea47529914bebaed6efafd367e2da",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"replacing speaker names: 0%| | 0/216768 [00:00<?, ?it/s]"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 191
},
"id": "Is-lpOMrZGyE",
"outputId": "abc2ea6e-e34d-4f9d-e3c6-bf47e4f5915d"
},
"source": [
"import pprint as pp\n",
"\n",
"pp.pprint(upd_lines[:10])"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"['john smith:\\n',\n",
" 'say, jim, how about going for a few beers after dinner?\\n',\n",
" '\\n',\n",
" 'nancy sellers:\\n',\n",
" 'you know that is tempting but is really not good for our fitness.\\n',\n",
" '\\n',\n",
" 'john smith:\\n',\n",
" 'what do you mean? it will help us to relax.\\n',\n",
" '\\n',\n",
" 'nancy sellers:\\n']\n"
]
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 17
},
"id": "6OFnPCLADfll",
"outputId": "da3f7c90-9fcd-4d76-e0bc-6df80aef7334"
},
"source": [
"file_name = local_namev2"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "HeeSKtNWUedE"
},
"source": [
"If your text file is large (>10MB), it is recommended to upload that file to Google Drive first, then copy that file from Google Drive to the Colaboratory VM.\n",
"\n",
"Additionally, you may want to consider [compressing the dataset to a cache first](https://docs.aitextgen.io/dataset/) on your local computer, then uploading the resulting `dataset_cache.tar.gz` and setting the `file_name`in the previous cell to that."
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 17
},
"id": "-Z6okFD8VKtS",
"outputId": "2f634019-bc15-4a91-aeb4-e1e51185625a"
},
"source": [
"# copy_file_from_gdrive(local_name)"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "LdpZQXknFNY3"
},
"source": [
"# Train / Finetune GPT-2\n",
"\n",
"The next cell will start the actual finetuning of GPT-2 in aitextgen. It runs for `num_steps`, and a progress bar will appear to show training progress, current loss (the lower the better the model), and average loss (to give a sense on loss trajectory).\n",
"\n",
"The model will be saved every `save_every` steps in `trained_model` by default, and when training completes. If you mounted your Google Drive, the model will _also_ be saved there in a unique folder.\n",
"\n",
"The training might time out after 4ish hours; if you did not mount to Google Drive, make sure you end training and save the results so you don't lose them! (if this happens frequently, you may want to consider using [Colab Pro](https://colab.research.google.com/signup))\n",
"\n",
"Important parameters for `train()`:\n",
"\n",
"- **`line_by_line`**: Set this to `True` if the input text file is a single-column CSV, with one record per row. aitextgen will automatically process it optimally.\n",
"- **`from_cache`**: If you compressed your dataset locally (as noted in the previous section) and are using that cache file, set this to `True`.\n",
"- **`num_steps`**: Number of steps to train the model for.\n",
"- **`generate_every`**: Interval of steps to generate example text from the model; good for qualitatively validating training.\n",
"- **`save_every`**: Interval of steps to save the model: the model will be saved in the VM to `/trained_model`.\n",
"- **`save_gdrive`**: Set this to `True` to copy the model to a unique folder in your Google Drive, if you have mounted it in the earlier cells\n",
"- **`fp16`**: Enables half-precision training for faster/more memory-efficient training. Only works on a T4 or V100 GPU.\n",
"\n",
"Here are other important parameters for `train()` that are useful but you likely do not need to change.\n",
"\n",
"- **`learning_rate`**: Learning rate of the model training.\n",
"- **`batch_size`**: Batch size of the model training; setting it too high will cause the GPU to go OOM. (if using `fp16`, you can increase the batch size more safely)"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"id": "sDmyL2A7uhaL",
"outputId": "3eb62fa5-bc1b-4f87-eb08-5304bb27a8b3"
},
"source": [
"import gc, os\n",
"from os.path import join\n",
"\n",
"base_dir = \"/content/drive/MyDrive/Programming/AI_peter\"\n",
"temp_gpu_path = join(base_dir, \"gp2_dailydialogue_{}\".format(model_size))\n",
"os.makedirs(temp_gpu_path, exist_ok=True)\n",
"gc.collect()"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"0"
]
},
"metadata": {},
"execution_count": 15
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "aeXshJM-Cuaf"
},
"source": [
"# DO NOT USE WARMUP STEPS\n",
"\n",
"ai.train(file_name,\n",
" output_dir=temp_gpu_path,\n",
" line_by_line=False,\n",
" from_cache=False,\n",
" num_steps=75000, # takes about 5 hours on 16 gb GPU for 75000\n",
" generate_every=1500,\n",
" max_grad_norm=0.8,\n",
" save_every=1000,\n",
" gradient_accumulation_steps=1,\n",
" save_gdrive=False,\n",
" learning_rate=1e-3,\n",
" # fp16=True,\n",
" batch_size=1, \n",
" # fp16_opt_level=\"O1\",\n",
" )"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "_DLJJolCYQQH",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 17
},
"outputId": "c5ba0dd1-f0e8-4bb7-fd8f-10c68bf600b3"
},
"source": [
"save_path = \"/content/drive/MyDrive/Programming/AI_peter/gpt2_dailydialogue_gpu_{}\".format(model_size)"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "IgUz5m0i1pbj",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 17
},
"outputId": "f71623bc-7c99-494b-b03f-49c303390daa"
},
"source": [
"import os\n",
"os.makedirs(save_path, exist_ok=True)\n",
"ai.save(save_path)\n"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "qQJgV_b4bmzd"
},
"source": [
"You're done! Feel free to go to the **Generate Text From The Trained Model** section to generate text based on your retrained model."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "pel-uBULXO2L"
},
"source": [
"\n",
"# Use a Train Model for Generation\n",
"\n",
"If you already had a trained model from this notebook, running the next cell will copy the `pytorch_model.bin` and the `config.json`file from the specified folder in Google Drive into the Colaboratory VM. (If no `from_folder` is specified, it assumes the two files are located at the root level of your Google Drive)"
]
},
{
"cell_type": "code",
"metadata": {
"id": "oeznI_VeaDQn",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 364
},
"outputId": "61b2b01b-a23c-44b6-f297-aacc0491bc4a"
},
"source": [
"!nvidia-smi"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Fri Oct 22 06:48:47 2021 \n",
"+-----------------------------------------------------------------------------+\n",
"| NVIDIA-SMI 470.74 Driver Version: 460.32.03 CUDA Version: 11.2 |\n",
"|-------------------------------+----------------------+----------------------+\n",
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n",
"| | | MIG M. |\n",
"|===============================+======================+======================|\n",
"| 0 Tesla V100-SXM2... Off | 00000000:00:04.0 Off | 0 |\n",
"| N/A 42C P0 50W / 300W | 4491MiB / 16160MiB | 0% Default |\n",
"| | | N/A |\n",
"+-------------------------------+----------------------+----------------------+\n",
" \n",
"+-----------------------------------------------------------------------------+\n",
"| Processes: |\n",
"| GPU GI CI PID Type Process name GPU Memory |\n",
"| ID ID Usage |\n",
"|=============================================================================|\n",
"| No running processes found |\n",
"+-----------------------------------------------------------------------------+\n"
]
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "alooLLyx1ZGu",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"outputId": "f1c5372c-7193-47ca-cf2e-4570d03740f9"
},
"source": [
"mount_gdrive()\n"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"
]
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "DCcx5u7sbPTD",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 121
},
"outputId": "3824ee28-ee6a-43a9-8e38-fe75bac1d926"
},
"source": [
"# best model thus far @ 1.3B parameters and tuned for 50k steps\n",
"# from_folder = \"/content/drive/MyDrive/Programming/AI_peter/GPT-Neo-1B-V1\"\n",
"\n",
"from_folder = save_path\n",
"\n",
"if len(from_folder) > 2:\n",
"\n",
" for file in [\"pytorch_model.bin\", \"config.json\"]:\n",
" if from_folder:\n",
" copy_file_from_gdrive(file, from_folder)\n",
" else:\n",
" copy_file_from_gdrive(file)\n",
"\n",
" ai = aitextgen(model_folder=from_folder, to_gpu=True)\n",
"else:\n",
" ai = aitextgen(model_folder=\".\", to_gpu=True)\n"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"10/22/2021 06:49:03 — INFO — aitextgen — Loading model from provided weights and config in //content/drive/MyDrive/Programming/AI_peter/gpt2_dailydialogue_gpu_355M.\n",
"/usr/local/lib/python3.7/dist-packages/transformers/configuration_utils.py:337: UserWarning: Passing `gradient_checkpointing` to a config initialization is deprecated and will be removed in v5 Transformers. Using `model.gradient_checkpointing_enable()` instead, or if you are using the `Trainer` API, pass `gradient_checkpointing=True` in your `TrainingArguments`.\n",
" \"Passing `gradient_checkpointing` to a config initialization is deprecated and will be removed in v5 \"\n",
"10/22/2021 06:49:09 — INFO — aitextgen — GPT2 loaded with 354M parameters.\n",
"10/22/2021 06:49:09 — INFO — aitextgen — Using the default GPT-2 Tokenizer.\n"
]
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ClJwpF_ACONp"
},
"source": [
"## Generate Text From The Trained Model\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "3cd0RGDbJiDp"
},
"source": [
"`generate()` without any parameters generates a single text from the loaded model to the console."
]
},
{
"cell_type": "code",
"metadata": {
"id": "4RNY6RBI9LmL",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"outputId": "e4246907-b241-46fb-8c06-6ddaf4699553"
},
"source": [
"ai.generate(n=3, max_length=256, \n",
" temperature=1.0, top_p=0.9)"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
". the first thing we do is make sure that our quality is high.\n",
"\n",
"nancy sellers:\n",
"do you think it's that way to stop wrinkles our also have to trim the invasion.\n",
"\n",
"john smith:\n",
"what! you've got to cut out about this mess! you won't believe what it can do.\n",
"\n",
"nancy sellers:\n",
"for instance?\n",
"\n",
"john smith:\n",
"it has a built-in camera unit that takes digital color stills. it also plays mp3 files, which i can save on media cards and then transfer to my hard drive of my computer.\n",
"\n",
"nancy sellers:\n",
"wow! anything else?\n",
"\n",
"john smith:\n",
"this one comes with its own folding keyboard. it has a pre-installed handwriting recognition program and a training program.\n",
"\n",
"nancy sellers:\n",
"what training program are you going to have to get?\n",
"\n",
"john smith:\n",
"i want to start training.\n",
"\n",
"nancy sellers:\n",
"me too.\n",
"\n",
"john smith:\n",
"yes, but do you have any experience?\n",
"\n",
"nancy sellers:\n",
"yes. i have a tefl certificate and a ticket. can you name it?\n",
"\n",
"john smith:\n",
"\n",
"==========\n",
"salary that you succeed in salary.\n",
"\n",
"nancy sellers:\n",
"yes, i guess i thought i would just wasn't expecting to give the performance review on that.\n",
"\n",
"john smith:\n",
"yes, we have many subjects.\n",
"\n",
"nancy sellers:\n",
"hi! so, you heard me for a new position. how are you?\n",
"\n",
"john smith:\n",
"good evening. i'm an engineer. i'm here to ask whether they're free or not?\n",
"\n",
"nancy sellers:\n",
"they're awesome. what about having a formal interview on monday next friday. i have to go to the national history museum.\n",
"\n",
"john smith:\n",
"that's the envy thing! i don't have the passport with me! i'm going to have to attach up my business card.\n",
"\n",
"nancy sellers:\n",
"are you a new student?\n",
"\n",
"john smith:\n",
"yes, i just moved here next month.\n",
"\n",
"nancy sellers:\n",
"i see that you'll have a first day.\n",
"\n",
"john smith:\n",
"should i reserve a hotel room?\n",
"\n",
"nancy sellers:\n",
"no, i didn't appreciate it. i gave theit to me.\n",
"\n",
"john smith:\n",
"\n",
"==========\n",
"salary is 3,000 yuan a month, i e-mailed the offer to you as well. you can say it is more convenient.\n",
"\n",
"john smith:\n",
"that's great. with a 3.2 % reduction, we can accept that.\n",
"\n",
"nancy sellers:\n",
"did you accept this?\n",
"\n",
"john smith:\n",
" commission is going to be on your counter.\n",
"\n",
"nancy sellers:\n",
"it's a problem. i make business in your offer and i think you'll be able to work with this report for us.\n",
"\n",
"john smith:\n",
"ok. i will do it when you is in my office.\n",
"\n",
"nancy sellers:\n",
"hi, and welcome to look for it.\n",
"\n",
"john smith:\n",
"good morning. i saw the manager in a cheat.\n",
"\n",
"nancy sellers:\n",
"no, i'm sorry, mr. baker.\n",
"\n",
"john smith:\n",
"but didn't you tell me his wife was offering baby-a-a-taranteed?\n",
"\n",
"nancy sellers:\n",
"yes, i did. but there's none in the flesh.\n",
"\n",
"john smith:\n",
"could i put the famous 10sign?\n",
"\n",
"nancy sellers:\n",
"\n"
]
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "2fSH7QgiiGi7",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 763
},
"outputId": "fe4cf520-ecc7-4f2c-fc4a-efd54a80da00"
},
"source": [
"ai.generate(prompt=\"give me a good pickup line!\", temperature=1,\n",
" min_length=10, batch_size =20)"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"\u001b[1mgive me a good pickup line!\u001b[0m\n",
"\n",
"nancy sellers:\n",
"okay, let's go!\n",
"\n",
"john smith:\n",
"till, you're going to quit!\n",
"\n",
"nancy sellers:\n",
"i'll try to quit my job.\n",
"\n",
"john smith:\n",
"i can stay longer, because i agree.\n",
"\n",
"nancy sellers:\n",
"is my boss going to get off from me?\n",
"\n",
"john smith:\n",
"yes, he'll be there.\n",
"\n",
"nancy sellers:\n",
"please turn the good news for him.\n",
"\n",
"john smith:\n",
"ok! can you tell me he's locked?\n",
"\n",
"nancy sellers:\n",
"i'm afraid not. he's no. michael probably forgot to assign a locker to you.\n",
"\n",
"john smith:\n",
"no problem. i think i'll let you know.\n",
"\n",
"nancy sellers:\n",
"did you use your understanding of responsibility in the trade market?\n",
"\n",
"john smith:\n",
"yes, i noticed it was not very complicated. it's a good idea to work as a public banker.\n",
"\n",
"nancy sellers:\n",
"we should be able to finish our work and complete our request.\n",
"\n",
"john smith:\n",
"yes, i want to\n"
]
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "oF4-PqF0Fl7R"
},
"source": [
"If you're creating an API based on your model and need to pass the generated text elsewhere, you can do `text = ai.generate_one()`\n",
"\n",
"You can also pass in a `prompt` to the generate function to force the text to start with a given character sequence and generate text from there (good if you add an indicator when the text starts).\n",
"\n",
"You can also generate multiple texts at a time by specifing `n`. You can pass a `batch_size` to generate multiple samples in parallel, giving a massive speedup (in Colaboratory, set a maximum of 50 for `batch_size` to avoid going OOM).\n",
"\n",
"Other optional-but-helpful parameters for `ai.generate()` and friends:\n",
"\n",
"* **`min length`**: The minimum length of the generated text: if the text is shorter than this value after cleanup, aitextgen will generate another one.\n",
"* **`max_length`**: Number of tokens to generate (default 256, you can generate up to 1024 tokens with GPT-2 and 2048 with GPT Neo)\n",
"* **`temperature`**: The higher the temperature, the crazier the text (default 0.7, recommended to keep between 0.7 and 1.0)\n",
"* **`top_k`**: Limits the generated guesses to the top *k* guesses (default 0 which disables the behavior; if the generated output is super crazy, you may want to set `top_k=40`)\n",
"* **`top_p`**: Nucleus sampling: limits the generated guesses to a cumulative probability. (gets good results on a dataset with `top_p=0.9`)"
]
},
{
"cell_type": "code",
"metadata": {
"id": "8DKMc0fiej4N",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"outputId": "cedfc61b-d3c4-461b-84b6-dc6fc7114cd8"
},
"source": [
"ai.generate(\n",
" n=3, batch_size=25, prompt=\"i just\", max_length=256, \n",
" temperature=1.0, top_p=0.9\n",
")"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"\u001b[1mi just\u001b[0m wanted to let you to know that we had decided to offer the position to someone else.we considered you are a good candidate.\n",
"\n",
"john smith:\n",
"you are a great attitude, but vane is not worth it.\n",
"\n",
"nancy sellers:\n",
"that's because you are not responsible for anyone starting salary.\n",
"\n",
"john smith:\n",
"i don't know what to do.\n",
"\n",
"nancy sellers:\n",
"have you thought about what you are going to do now?\n",
"\n",
"john smith:\n",
"i'm not going to pay anything.\n",
"\n",
"nancy sellers:\n",
"you get a pair of questions. but remember to incorporate a little things up.\n",
"\n",
"john smith:\n",
"first, you should check the schedule and see which trains go to suzhou. make sure which train you want to take and book a ticket.\n",
"\n",
"nancy sellers:\n",
"it can take me a minute to suzhou by train.\n",
"\n",
"john smith:\n",
"i heard it is a very good job.\n",
"\n",
"nancy sellers:\n",
"it's true, isn't it?\n",
"\n",
"john smith:\n",
"yes, it's true.\n",
"\n",
"nancy sellers:\n",
"ok. let's ask. first you should be\n",
"==========\n",
"\u001b[1mi just\u001b[0m wanted to let you to know that we had decided to offer the position to someone else.we considered you very carefully the way we did.we were the same position a great team.\n",
"\n",
"nancy sellers:\n",
"that's a little too bad. how'd it work treating to be paid?\n",
"\n",
"john smith:\n",
"it'll be hard and say that it is considered really great.\n",
"\n",
"nancy sellers:\n",
"so, john, you must be stoked. you should enjoy it.\n",
"\n",
"john smith:\n",
"maybe you're right.\n",
"\n",
"nancy sellers:\n",
"i just wanted to give the chance to get into the weekend.\n",
"\n",
"john smith:\n",
"it turned out to be a little trouble between us.\n",
"\n",
"nancy sellers:\n",
"it is said to be done.\n",
"\n",
"john smith:\n",
"i don't think the weatherman should be more intelligent.\n",
"\n",
"nancy sellers:\n",
"maybe we should start looking around.\n",
"\n",
"john smith:\n",
"that's a good idea.\n",
"\n",
"nancy sellers:\n",
"i think we'll let you know.\n",
"\n",
"john smith:\n",
"so why did you want to quit this position?\n",
"\n",
"nancy sellers:\n",
"i'm sorry to\n",
"==========\n",
"\u001b[1mi just\u001b[0m wanted to let you to know that we had decided to offer the sales position to someone else.we considered you are the bestwe can do.we'll give you a chance.\n",
"\n",
"john smith:\n",
"that sounds great, but i'm sorry i think it was worth it.\n",
"\n",
"nancy sellers:\n",
"congratulations! you really won a lot of this.\n",
"\n",
"john smith:\n",
"it's a lot of work running a campaign, isn't it!\n",
"\n",
"nancy sellers:\n",
"yes, i have finished. i won a formal campaign, working conditions and inspiration.\n",
"\n",
"john smith:\n",
"so what does your family do now?\n",
"\n",
"nancy sellers:\n",
"my family gives me a big wedding, and my father is a member of the yan hilton. he was born in the united states and have a huge son.\n",
"\n",
"john smith:\n",
"we have a lot to live together this weekend.\n",
"\n",
"nancy sellers:\n",
"no problem. it may be difficult, but under the circumstances, i can not own spare to do anything.\n",
"\n",
"john smith:\n",
"how does your friend zoe ask you?\n",
"\n",
"nancy sellers:\n",
"my wife isbetter now.\n",
"\n",
"\n"
]
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "zjjEN2Tafhl2"
},
"source": [
"For bulk generation, you can generate a large amount of texts to a file and sort out the samples locally on your computer. The next cell will generate `num_files` files, each with `n` texts and whatever other parameters you would pass to `generate()`. The files can then be downloaded from the Files sidebar!\n",
"\n",
"You can rerun the cells as many times as you want for even more generated texts!"
]
},
{
"cell_type": "code",
"metadata": {
"cellView": "form",
"id": "rKp18dTTj402",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 17
},
"outputId": "1871434c-8d85-4fa4-f3e7-ab3fb236097f"
},
"source": [
"save_loc = \"/content/drive/MyDrive/Programming/AI_peter/output_files\" #@param {type:\"string\"}\n"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "Fa6p6arifSL0",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 17
},
"outputId": "ca951328-5648-486a-ddf0-c98ca1ce9183"
},
"source": [
"p_list = [[\"nancy powell:\"+\"\\n\", \n",
" \"how are you doing?\"+\"\\n\", \"\\n\", \n",
" \"john smith:\" + \"\\n\"], \n",
" [\"nancy powell:\"+\"\\n\", \"why is \"],\n",
" [\"can you help me with my homework?\"+\"\\n\", \"\\n\", \n",
" \"john smith:\" + \"\\n\"],\n",
" [\"john smith:\" + \"\\n\"],\n",
" [\"Hey I’m meeting the astrophysics professor via zoom after school any tips?\"+\"\\n\",\n",
" \"\\n\", \"john smith:\" + \"\\n\"], \n",
"]\n",
"\n",
"\n",
"prompts = [\"\".join(line) for line in p_list]"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "_8et1WHilo_A",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 295
},
"outputId": "40ee1e2e-bb35-428e-987f-c58edfd1bc07"
},
"source": [
"from datetime import datetime\n",
"import pprint as pp\n",
"\n",
"ds_date_time = datetime.now().strftime(\"%m.%d.%Y\")\n",
"\n",
"base_header = \"gpt-dailydialogue-textgen-{}\".format(ds_date_time)\n",
"prompt_IDs = [base_header + \"_file-{}.txt\".format(i+1) for i in range(5, len(prompts)+11)]\n",
"\n",
"prompt_mng = {}\n",
"for pid, text in zip(prompt_IDs, prompts):\n",
" prompt_mng[pid] = text\n",
"pp.pprint(prompt_mng)"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"{'gpt-dailydialogue-textgen-10.22.2021_file-10.txt': 'Hey I’m meeting the '\n",
" 'astrophysics professor '\n",
" 'via zoom after school '\n",
" 'any tips?\\n'\n",
" '\\n'\n",
" 'john smith:\\n',\n",
" 'gpt-dailydialogue-textgen-10.22.2021_file-6.txt': 'nancy powell:\\n'\n",
" 'how are you doing?\\n'\n",
" '\\n'\n",
" 'john smith:\\n',\n",
" 'gpt-dailydialogue-textgen-10.22.2021_file-7.txt': 'nancy powell:\\nwhy is ',\n",
" 'gpt-dailydialogue-textgen-10.22.2021_file-8.txt': 'can you help me with my '\n",
" 'homework?\\n'\n",
" '\\n'\n",
" 'john smith:\\n',\n",
" 'gpt-dailydialogue-textgen-10.22.2021_file-9.txt': 'john smith:\\n'}\n"
]
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "HPnqt-UVlEPR",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 264,
"referenced_widgets": [
"4bbc1e389df847ebbf1bd8fffcc7ff14",
"acb9d987da394257a48f60ac39f344c1",
"bd937d21823d449ebf4a5a3e24f41d69",
"556377a09cc74bec9f183d7458fe0733",
"597cd87c3b464f58b38c477e759719da",
"39fddd7e8c20410990b87235b4f5cbf1",
"b5a67da5cd7446b6bcabab22ee64c0e2",
"b6d12f71d5a741529de496f91cdec0e0",
"0e6058357d2e4f34a8a1082bd018342d",
"c49b0e4e164b438bbefb00cd002d9bdb",
"af0143ab76c244788b9663be849b2194",
"29dfe106b8334f5181e3cffce65c6943",
"cf832eb20b524aabad57f115727c96a6",
"be7073f8181946c08f1259fa674aa267",
"985f08b647a7431da0a38e999155ecf3",
"e4681291ca3d45839f3a781ce3209c34",
"407dc22fab8c424b8ad5f148884c0cd0",
"c55efbb8143e4eb6bd56a61bad4bbc83",
"9a4050d8862d4e98b0febf2d6b8548ec",
"749fa54d83cc43a2803cd06bdb1d4707",
"700b93e7589646f99556494bf0e998ce",
"dcdd8cde42824ebfb7bb4fb6e608ace1",
"008e7448840845f98466f6153216d2b6",
"8e7c900ebef044008fa1c6efa83dc0bd",
"528a35eaec2144efb62fc42bb1ae1be4",
"66bd0256064f4c7e80083ada370c8ecb",
"cb7ac963d1ce428b96e7647a2432c9e3",
"125c4bfded16435e906eb9bcc40bf630",
"1c1064016c6f4c02bb404dd92602ac30",
"cf372e32f2c34a7d954aff392a5309f2",
"6872b987fd604c7b8967236a236619a7",
"5f555482f3ac475e9da89d5a16a94ea3",
"6ffc0e2ef884490e8e92b5e6ff3f77e4",
"43bcf41ce318410c996ac8c5694e75d9",
"2f79f95c687545a1820e92fc7df1330d",
"9d5f98d28c4f4523b0d512d05bcb1a0a",
"37a135c212474b5e8dadd58e66577d2c",
"961643cbf71e40f29ba071a03e3022a6",
"c9a36e89a8f046b4b21d23bd21f9bff5",
"704f3c9661714c35ac5c65fb6b8f0ee2",
"05bb0964d57c47099e3424f69d210f8f",
"2e5c7d395e144cf896f9c995440b23bb",
"b4e32a35d24b42a3a2ce182b04a8681d",
"e630d959cd1c4ab792726f1d45f1c306",
"d5ce783d64474b3cb86369b792ed637b",
"b7100f97a2d74632bf08db45a4f54d59",
"e9b6ea50013145d4a28dfaa0271ff3ec",
"f427497ef9d54d69a2dd59bae89b74b8",
"bb1201c9ace44c00930e2ea7419dbfe2",
"b9ea1fd0717c4bd2acdaca68c690426a",
"457a85a847c24117a598b0504a299840",
"7554f5c2ccd7416d9a5a093ee8f4b616",
"497121a49f1c43b9a53ede1dd13353b1",
"337fe6983dbf4e498abdca60bca7e7af",
"729c1ccdf39c4a1e8446fbb6d862ec3d"
]
},
"outputId": "34b999de-4011-4ba3-d187-4bdcbc42150a"
},
"source": [
"from os.path import join\n",
"\n",
"for pfile, my_prompt in prompt_mng.items():\n",
" ai.generate_to_file(\n",
" n=50,\n",
" batch_size=5,\n",
" prompt=my_prompt,\n",
" max_length=512,\n",
" temperature=0.8,\n",
" top_p=0.9,\n",
" destination_path=join(save_loc, pfile)\n",
" )\n"
],
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": [
"\n",
" <style>\n",
" pre {\n",
" white-space: pre-wrap;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"10/22/2021 06:49:32 — INFO — aitextgen — Generating 50 texts to /content/drive/MyDrive/Programming/AI_peter/output_files/gpt-dailydialogue-textgen-10.22.2021_file-6.txt\n"
]
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4bbc1e389df847ebbf1bd8fffcc7ff14",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
" 0%| | 0/50 [00:00<?, ?it/s]"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"10/22/2021 06:51:51 — INFO — aitextgen — Generating 50 texts to /content/drive/MyDrive/Programming/AI_peter/output_files/gpt-dailydialogue-textgen-10.22.2021_file-7.txt\n"
]
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "29dfe106b8334f5181e3cffce65c6943",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
" 0%| | 0/50 [00:00<?, ?it/s]"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"10/22/2021 06:54:11 — INFO — aitextgen — Generating 50 texts to /content/drive/MyDrive/Programming/AI_peter/output_files/gpt-dailydialogue-textgen-10.22.2021_file-8.txt\n"
]
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "008e7448840845f98466f6153216d2b6",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
" 0%| | 0/50 [00:00<?, ?it/s]"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"10/22/2021 06:56:28 — INFO — aitextgen — Generating 50 texts to /content/drive/MyDrive/Programming/AI_peter/output_files/gpt-dailydialogue-textgen-10.22.2021_file-9.txt\n"
]
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "43bcf41ce318410c996ac8c5694e75d9",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
" 0%| | 0/50 [00:00<?, ?it/s]"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"10/22/2021 06:58:48 — INFO — aitextgen — Generating 50 texts to /content/drive/MyDrive/Programming/AI_peter/output_files/gpt-dailydialogue-textgen-10.22.2021_file-10.txt\n"
]
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d5ce783d64474b3cb86369b792ed637b",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
" 0%| | 0/50 [00:00<?, ?it/s]"
]
},
"metadata": {}
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment