Przetwarzanie_tekstu/projekt/GPT2_custom_sms_spam.ipynb

5359 lines
285 KiB
Plaintext
Raw Normal View History

2023-02-18 10:25:07 +01:00
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"gpuClass": "standard",
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"562b2df63fee469eab344732405d0341": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_f90233e79de4458fb6e5e4414d1f319f",
"IPY_MODEL_da72fb505ad3414680bd29008dc8a285",
"IPY_MODEL_6318027214494b38a5145e1fc2dded91"
],
"layout": "IPY_MODEL_b96a09347ffe417da8bf8161b4d35c3b"
}
},
"f90233e79de4458fb6e5e4414d1f319f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_c96b32196ffe4fb78199fa8c856ecda0",
"placeholder": "",
"style": "IPY_MODEL_e02dd4691fcb4fd7a38db769acd9e675",
"value": "Downloading builder script: 100%"
}
},
"da72fb505ad3414680bd29008dc8a285": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_f1cdfa643b024356909426c57e6c7f6c",
"max": 3208,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_70162009566c46f5ac4680cc13907e8b",
"value": 3208
}
},
"6318027214494b38a5145e1fc2dded91": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_28f4807f01df47fc86c2e1bf3f12848a",
"placeholder": "",
"style": "IPY_MODEL_d653b1742fbc40e28fc1a0390c4392c8",
"value": " 3.21k/3.21k [00:00<00:00, 121kB/s]"
}
},
"b96a09347ffe417da8bf8161b4d35c3b": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"c96b32196ffe4fb78199fa8c856ecda0": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"e02dd4691fcb4fd7a38db769acd9e675": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"f1cdfa643b024356909426c57e6c7f6c": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"70162009566c46f5ac4680cc13907e8b": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"28f4807f01df47fc86c2e1bf3f12848a": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"d653b1742fbc40e28fc1a0390c4392c8": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"5d658fd2b4ca452981f37d78e5a839ac": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_a08f108560f445389475c3c9816053dc",
"IPY_MODEL_ed00365457a8496385e99d3b8545e71f",
"IPY_MODEL_179a41119493452c9af8bd4a2591d47c"
],
"layout": "IPY_MODEL_615083b133e84ea0abc862c2945b0a4c"
}
},
"a08f108560f445389475c3c9816053dc": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_2220b6b5230447018481fd546a0f8c30",
"placeholder": "",
"style": "IPY_MODEL_1a35f271378e4d8f84147a39dc311cb5",
"value": "Downloading metadata: 100%"
}
},
"ed00365457a8496385e99d3b8545e71f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_e20d4fbfae75456da6c44ab2f4834ddf",
"max": 1687,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_d074053ea5d14c58a1209ce99688178d",
"value": 1687
}
},
"179a41119493452c9af8bd4a2591d47c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_eb3237ab419c44ee8b9a56543cdc1186",
"placeholder": "",
"style": "IPY_MODEL_e4d702bd0e074d009d4a86f0d872fa97",
"value": " 1.69k/1.69k [00:00<00:00, 117kB/s]"
}
},
"615083b133e84ea0abc862c2945b0a4c": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"2220b6b5230447018481fd546a0f8c30": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"1a35f271378e4d8f84147a39dc311cb5": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"e20d4fbfae75456da6c44ab2f4834ddf": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"d074053ea5d14c58a1209ce99688178d": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"eb3237ab419c44ee8b9a56543cdc1186": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"e4d702bd0e074d009d4a86f0d872fa97": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"1a84c9f0d4c34ab9bfb8e6c1632e1aab": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_4d1fbcd786ea4724a8302f6fa373a4c5",
"IPY_MODEL_c4262c9d665c43fc95f5d651272e05ac",
"IPY_MODEL_eaa840ba44e5468d863d701b7a887cb0"
],
"layout": "IPY_MODEL_836cc5fb2aac4814975222e4cb3eb509"
}
},
"4d1fbcd786ea4724a8302f6fa373a4c5": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_cc0ff055c7e348bfb7442e1da9c2d283",
"placeholder": "",
"style": "IPY_MODEL_453451afd5a041cf8bd7b9bebae95e1a",
"value": "Downloading readme: 100%"
}
},
"c4262c9d665c43fc95f5d651272e05ac": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_e377724de4ea48dcb3a35d35100f77c2",
"max": 4872,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_2fa10546eb11424eb1376773fd6ce8c3",
"value": 4872
}
},
"eaa840ba44e5468d863d701b7a887cb0": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_0b03f0f260f142b6a6333f234ba7b64a",
"placeholder": "",
"style": "IPY_MODEL_21e668a45d514c51b87d5888bc0d3f04",
"value": " 4.87k/4.87k [00:00<00:00, 264kB/s]"
}
},
"836cc5fb2aac4814975222e4cb3eb509": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"cc0ff055c7e348bfb7442e1da9c2d283": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"453451afd5a041cf8bd7b9bebae95e1a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"e377724de4ea48dcb3a35d35100f77c2": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"2fa10546eb11424eb1376773fd6ce8c3": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"0b03f0f260f142b6a6333f234ba7b64a": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"21e668a45d514c51b87d5888bc0d3f04": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"94bed16fdbbe42ab89e2417d0bc2f6be": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_ea9d739338bc46e7b6aa9edfc90db7ee",
"IPY_MODEL_cc4d58df01594e258fede64937001ccc",
"IPY_MODEL_bdf2b2471bec4a519b62171990b90751"
],
"layout": "IPY_MODEL_49298f7943c2412f891932c2a62598b3"
}
},
"ea9d739338bc46e7b6aa9edfc90db7ee": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_f92d4941bc304dbfbaec3a15954a2216",
"placeholder": "",
"style": "IPY_MODEL_17fad956c06a43a7bb57313168431b2f",
"value": "Downloading data: 100%"
}
},
"cc4d58df01594e258fede64937001ccc": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_5ab0d18b923d4918ba0a3d9de7398235",
"max": 203415,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_9838107a69dc444084a8cbc5a97c69b5",
"value": 203415
}
},
"bdf2b2471bec4a519b62171990b90751": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_0f52a0bf45bf4840b74f50ef0e1ed104",
"placeholder": "",
"style": "IPY_MODEL_a7669275b5474a45b79e810a51fa773c",
"value": " 203k/203k [00:00<00:00, 375kB/s]"
}
},
"49298f7943c2412f891932c2a62598b3": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"f92d4941bc304dbfbaec3a15954a2216": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"17fad956c06a43a7bb57313168431b2f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"5ab0d18b923d4918ba0a3d9de7398235": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"9838107a69dc444084a8cbc5a97c69b5": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"0f52a0bf45bf4840b74f50ef0e1ed104": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"a7669275b5474a45b79e810a51fa773c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"98405dc577ee4a5e8827123916074b67": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_19b3e634059f478986f5dfb4ab34875e",
"IPY_MODEL_4a3004ebe922475d9476d91e50ddb0c4",
"IPY_MODEL_00ccecda328f47408f98dfbb498c241a"
],
"layout": "IPY_MODEL_50a6f2294627414f80816e08c425d997"
}
},
"19b3e634059f478986f5dfb4ab34875e": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_1d994423cee14277899cf0e2e21252a4",
"placeholder": "",
"style": "IPY_MODEL_7a1a268464a5405bb96d2cd7f1f4a411",
"value": "Generating train split: 100%"
}
},
"4a3004ebe922475d9476d91e50ddb0c4": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_c8390fdbd4824593a5ca3505b3ff7481",
"max": 5574,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_fb35b00db49e4fb49199ffd6c5b1c1f0",
"value": 5574
}
},
"00ccecda328f47408f98dfbb498c241a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_e82ebc90a3884176a59c903e746b6728",
"placeholder": "",
"style": "IPY_MODEL_ba525ced60344562922dfcd1563b295e",
"value": " 5574/5574 [00:11<00:00, 14535.59 examples/s]"
}
},
"50a6f2294627414f80816e08c425d997": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"1d994423cee14277899cf0e2e21252a4": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"7a1a268464a5405bb96d2cd7f1f4a411": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"c8390fdbd4824593a5ca3505b3ff7481": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"fb35b00db49e4fb49199ffd6c5b1c1f0": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"e82ebc90a3884176a59c903e746b6728": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"ba525ced60344562922dfcd1563b295e": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"dcb1f03aab3e47bcaef73337578e90aa": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_00c77aa4d05c46939141db3fc8ec4e0c",
"IPY_MODEL_81e81ff88979470190cbf98ad198fded",
"IPY_MODEL_4a2a80e4c40c49d383472d2161b8397f"
],
"layout": "IPY_MODEL_7f1c2ba12eba4f94b6b763701c7b83fc"
}
},
"00c77aa4d05c46939141db3fc8ec4e0c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_3cfc5529a1e844a5876336436c787062",
"placeholder": "",
"style": "IPY_MODEL_bbaf7eb0bfdc47bea197e32ede2bd5df",
"value": "100%"
}
},
"81e81ff88979470190cbf98ad198fded": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_7040bba8c540494d8fd3eb09e4aa87f4",
"max": 1,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_7b645af074de4ce89e521c4e32aaf790",
"value": 1
}
},
"4a2a80e4c40c49d383472d2161b8397f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_049cd54da01a47d29fcbfadcb31e1122",
"placeholder": "",
"style": "IPY_MODEL_707d4cadc9ae45a998d4db6f022b860e",
"value": " 1/1 [00:00<00:00, 15.24it/s]"
}
},
"7f1c2ba12eba4f94b6b763701c7b83fc": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"3cfc5529a1e844a5876336436c787062": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"bbaf7eb0bfdc47bea197e32ede2bd5df": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"7040bba8c540494d8fd3eb09e4aa87f4": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"7b645af074de4ce89e521c4e32aaf790": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"049cd54da01a47d29fcbfadcb31e1122": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"707d4cadc9ae45a998d4db6f022b860e": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"c975281b288e4eb580cf5f97c44759f8": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_8aa4e156456648b89e1d198edf848cab",
"IPY_MODEL_0e4014a5797c4dd4b9cef7a415784fb7",
"IPY_MODEL_5deddfa5ec384b999a406cd9761c5b15"
],
"layout": "IPY_MODEL_ccb20b15603d4adb977d436a04b7f22f"
}
},
"8aa4e156456648b89e1d198edf848cab": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_abca5ac8660749c3a85f0cf4231f7e3a",
"placeholder": "",
"style": "IPY_MODEL_e2b8031555b743ad86f1b3292e8be6a7",
"value": "Downloading (…)olve/main/vocab.json: 100%"
}
},
"0e4014a5797c4dd4b9cef7a415784fb7": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_0f1a0ff8193c4bcf8a5a4f855c7cdef9",
"max": 1042301,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_b12a405cb522492f97ce1b300328bd24",
"value": 1042301
}
},
"5deddfa5ec384b999a406cd9761c5b15": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_84f46d78887b4b0982de0b6c0f208d78",
"placeholder": "",
"style": "IPY_MODEL_663b9294d4b54a969afbfbe5eb9e27c6",
"value": " 1.04M/1.04M [00:00<00:00, 2.01MB/s]"
}
},
"ccb20b15603d4adb977d436a04b7f22f": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"abca5ac8660749c3a85f0cf4231f7e3a": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"e2b8031555b743ad86f1b3292e8be6a7": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"0f1a0ff8193c4bcf8a5a4f855c7cdef9": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"b12a405cb522492f97ce1b300328bd24": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"84f46d78887b4b0982de0b6c0f208d78": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"663b9294d4b54a969afbfbe5eb9e27c6": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"97d18f182fa24bf79709aaaa319bc386": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_1bf36407ad944361aed5439377339ddf",
"IPY_MODEL_2a00cb65c14b4ad3b58a035abd74c08b",
"IPY_MODEL_15ed7e2f50ee4bb4ac08754c07a9e703"
],
"layout": "IPY_MODEL_0074ea0bdbdd42e48d71395cf489db75"
}
},
"1bf36407ad944361aed5439377339ddf": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_8d976387182945da82a6b88268f04c2e",
"placeholder": "",
"style": "IPY_MODEL_3b7e5bbeba9a4fe6a72541478c2b3233",
"value": "Downloading (…)olve/main/merges.txt: 100%"
}
},
"2a00cb65c14b4ad3b58a035abd74c08b": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_f0dcd590e27a474895fa9dde14cfb585",
"max": 456318,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_4ab6997444d04a37b491c90af229d9d3",
"value": 456318
}
},
"15ed7e2f50ee4bb4ac08754c07a9e703": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_165e45626e594a7f9bceeaac7c757eb6",
"placeholder": "",
"style": "IPY_MODEL_ab158071f37645799c948471957cb5d5",
"value": " 456k/456k [00:00<00:00, 1.07MB/s]"
}
},
"0074ea0bdbdd42e48d71395cf489db75": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"8d976387182945da82a6b88268f04c2e": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"3b7e5bbeba9a4fe6a72541478c2b3233": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"f0dcd590e27a474895fa9dde14cfb585": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"4ab6997444d04a37b491c90af229d9d3": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"165e45626e594a7f9bceeaac7c757eb6": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"ab158071f37645799c948471957cb5d5": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"3e1c6fd0adc642209160f8d0787cc119": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_cd06d7c3bd3e49c9a54f8d26767ac83f",
"IPY_MODEL_00b32d689601497ba083d89d482f8bc0",
"IPY_MODEL_55c24dad2d274095a9dea608b81fe08e"
],
"layout": "IPY_MODEL_c0dfcfb6e20a4ea1b233ff8d643d75f0"
}
},
"cd06d7c3bd3e49c9a54f8d26767ac83f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_86f28cc51d2b453e8635e5459eee023c",
"placeholder": "",
"style": "IPY_MODEL_67cf3e6850f243479962aa7339861798",
"value": "Downloading (…)lve/main/config.json: 100%"
}
},
"00b32d689601497ba083d89d482f8bc0": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_310e98af244f41d3a7cdb61f8288568b",
"max": 665,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_debee430506e4c29878250bd9143ae31",
"value": 665
}
},
"55c24dad2d274095a9dea608b81fe08e": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_a6e553a2b36b42eb843149ab3614f1e8",
"placeholder": "",
"style": "IPY_MODEL_4b0c3d9ca62b4aa9ab79710b28dbaca1",
"value": " 665/665 [00:00<00:00, 9.78kB/s]"
}
},
"c0dfcfb6e20a4ea1b233ff8d643d75f0": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"86f28cc51d2b453e8635e5459eee023c": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"67cf3e6850f243479962aa7339861798": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"310e98af244f41d3a7cdb61f8288568b": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"debee430506e4c29878250bd9143ae31": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"a6e553a2b36b42eb843149ab3614f1e8": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"4b0c3d9ca62b4aa9ab79710b28dbaca1": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"e18707f0d4be4cf1bf2fd448c465a49a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_8f9ca17cef4b491fab0ba086eddeee06",
"IPY_MODEL_291394dabaf4461abc7d116c34a62972",
"IPY_MODEL_79d4d0a4e6914963988862a457fe5004"
],
"layout": "IPY_MODEL_3fb7ae428a654adb9639dca54c8487ca"
}
},
"8f9ca17cef4b491fab0ba086eddeee06": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_c5a0d019aa454525b975be7b8125af52",
"placeholder": "",
"style": "IPY_MODEL_bd2d006b7df94f52be982c93e6591ed9",
"value": "Downloading (…)"pytorch_model.bin";: 100%"
}
},
"291394dabaf4461abc7d116c34a62972": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_8cf28f0e3d22453f9b1293f7309373a1",
"max": 548118077,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_2ffeb0a10a69433689ca87de39f760b6",
"value": 548118077
}
},
"79d4d0a4e6914963988862a457fe5004": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_d2183878e1b343abb962b16a2615c0a5",
"placeholder": "",
"style": "IPY_MODEL_68e1e4d6f5ce456398f333041eb00151",
"value": " 548M/548M [00:02<00:00, 284MB/s]"
}
},
"3fb7ae428a654adb9639dca54c8487ca": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"c5a0d019aa454525b975be7b8125af52": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"bd2d006b7df94f52be982c93e6591ed9": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"8cf28f0e3d22453f9b1293f7309373a1": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"2ffeb0a10a69433689ca87de39f760b6": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"d2183878e1b343abb962b16a2615c0a5": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"68e1e4d6f5ce456398f333041eb00151": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
}
}
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"source": [
"# Instalacja pakietów"
],
"metadata": {
"id": "t2xXKpOpcZg_"
}
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "fdpN7ugfauLD",
"outputId": "ebd6755e-3403-4922-98a8-c2006b210152"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
"Collecting transformers\n",
" Downloading transformers-4.26.1-py3-none-any.whl (6.3 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.3/6.3 MB\u001b[0m \u001b[31m57.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting datasets\n",
" Downloading datasets-2.9.0-py3-none-any.whl (462 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m462.8/462.8 KB\u001b[0m \u001b[31m5.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: torch in /usr/local/lib/python3.8/dist-packages (1.13.1+cu116)\n",
"Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.8/dist-packages (from transformers) (2022.6.2)\n",
"Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.8/dist-packages (from transformers) (1.21.6)\n",
"Requirement already satisfied: filelock in /usr/local/lib/python3.8/dist-packages (from transformers) (3.9.0)\n",
"Requirement already satisfied: requests in /usr/local/lib/python3.8/dist-packages (from transformers) (2.25.1)\n",
"Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.8/dist-packages (from transformers) (4.64.1)\n",
"Collecting tokenizers!=0.11.3,<0.14,>=0.11.1\n",
" Downloading tokenizers-0.13.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.6 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m7.6/7.6 MB\u001b[0m \u001b[31m31.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.8/dist-packages (from transformers) (6.0)\n",
"Collecting huggingface-hub<1.0,>=0.11.0\n",
" Downloading huggingface_hub-0.12.1-py3-none-any.whl (190 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m190.3/190.3 KB\u001b[0m \u001b[31m9.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.8/dist-packages (from transformers) (23.0)\n",
"Requirement already satisfied: dill<0.3.7 in /usr/local/lib/python3.8/dist-packages (from datasets) (0.3.6)\n",
"Requirement already satisfied: pandas in /usr/local/lib/python3.8/dist-packages (from datasets) (1.3.5)\n",
"Collecting responses<0.19\n",
" Downloading responses-0.18.0-py3-none-any.whl (38 kB)\n",
"Requirement already satisfied: pyarrow>=6.0.0 in /usr/local/lib/python3.8/dist-packages (from datasets) (9.0.0)\n",
"Collecting xxhash\n",
" Downloading xxhash-3.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (213 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m213.0/213.0 KB\u001b[0m \u001b[31m9.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: aiohttp in /usr/local/lib/python3.8/dist-packages (from datasets) (3.8.4)\n",
"Requirement already satisfied: fsspec[http]>=2021.11.1 in /usr/local/lib/python3.8/dist-packages (from datasets) (2023.1.0)\n",
"Collecting multiprocess\n",
" Downloading multiprocess-0.70.14-py38-none-any.whl (132 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m132.0/132.0 KB\u001b[0m \u001b[31m10.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: typing-extensions in /usr/local/lib/python3.8/dist-packages (from torch) (4.5.0)\n",
"Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.8/dist-packages (from aiohttp->datasets) (1.3.1)\n",
"Requirement already satisfied: charset-normalizer<4.0,>=2.0 in /usr/local/lib/python3.8/dist-packages (from aiohttp->datasets) (3.0.1)\n",
"Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.8/dist-packages (from aiohttp->datasets) (1.8.2)\n",
"Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.8/dist-packages (from aiohttp->datasets) (1.3.3)\n",
"Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.8/dist-packages (from aiohttp->datasets) (22.2.0)\n",
"Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.8/dist-packages (from aiohttp->datasets) (6.0.4)\n",
"Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.8/dist-packages (from aiohttp->datasets) (4.0.2)\n",
"Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.8/dist-packages (from requests->transformers) (1.24.3)\n",
"Requirement already satisfied: chardet<5,>=3.0.2 in /usr/local/lib/python3.8/dist-packages (from requests->transformers) (4.0.0)\n",
"Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.8/dist-packages (from requests->transformers) (2.10)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/dist-packages (from requests->transformers) (2022.12.7)\n",
"Collecting urllib3<1.27,>=1.21.1\n",
" Downloading urllib3-1.26.14-py2.py3-none-any.whl (140 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m140.6/140.6 KB\u001b[0m \u001b[31m6.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.8/dist-packages (from pandas->datasets) (2.8.2)\n",
"Requirement already satisfied: pytz>=2017.3 in /usr/local/lib/python3.8/dist-packages (from pandas->datasets) (2022.7.1)\n",
"Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.8/dist-packages (from python-dateutil>=2.7.3->pandas->datasets) (1.15.0)\n",
"Installing collected packages: tokenizers, xxhash, urllib3, multiprocess, responses, huggingface-hub, transformers, datasets\n",
" Attempting uninstall: urllib3\n",
" Found existing installation: urllib3 1.24.3\n",
" Uninstalling urllib3-1.24.3:\n",
" Successfully uninstalled urllib3-1.24.3\n",
"Successfully installed datasets-2.9.0 huggingface-hub-0.12.1 multiprocess-0.70.14 responses-0.18.0 tokenizers-0.13.2 transformers-4.26.1 urllib3-1.26.14 xxhash-3.2.0\n"
]
}
],
"source": [
"!pip install transformers datasets torch"
]
},
{
"cell_type": "markdown",
"source": [
"# Załadowanie pakietów"
],
"metadata": {
"id": "s8cfdy_6ldCn"
}
},
{
"cell_type": "code",
"source": [
"from datasets import load_dataset\n",
"from transformers import GPT2Tokenizer\n",
"import torch\n",
"from torch.utils.data import TensorDataset, random_split\n",
"from torch.utils.data import DataLoader, RandomSampler, SequentialSampler\n",
"from transformers import get_linear_schedule_with_warmup\n",
"import numpy as np\n",
"import time\n",
"import datetime\n",
"import random"
],
"metadata": {
"id": "yLS_x9DIlgSs"
},
"execution_count": 2,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Załadowanie datasetu\n",
"sms_spam"
],
"metadata": {
"id": "fPwDyJd5cdaE"
}
},
{
"cell_type": "code",
"source": [
"dataset = load_dataset(\"sms_spam\")"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 263,
"referenced_widgets": [
"562b2df63fee469eab344732405d0341",
"f90233e79de4458fb6e5e4414d1f319f",
"da72fb505ad3414680bd29008dc8a285",
"6318027214494b38a5145e1fc2dded91",
"b96a09347ffe417da8bf8161b4d35c3b",
"c96b32196ffe4fb78199fa8c856ecda0",
"e02dd4691fcb4fd7a38db769acd9e675",
"f1cdfa643b024356909426c57e6c7f6c",
"70162009566c46f5ac4680cc13907e8b",
"28f4807f01df47fc86c2e1bf3f12848a",
"d653b1742fbc40e28fc1a0390c4392c8",
"5d658fd2b4ca452981f37d78e5a839ac",
"a08f108560f445389475c3c9816053dc",
"ed00365457a8496385e99d3b8545e71f",
"179a41119493452c9af8bd4a2591d47c",
"615083b133e84ea0abc862c2945b0a4c",
"2220b6b5230447018481fd546a0f8c30",
"1a35f271378e4d8f84147a39dc311cb5",
"e20d4fbfae75456da6c44ab2f4834ddf",
"d074053ea5d14c58a1209ce99688178d",
"eb3237ab419c44ee8b9a56543cdc1186",
"e4d702bd0e074d009d4a86f0d872fa97",
"1a84c9f0d4c34ab9bfb8e6c1632e1aab",
"4d1fbcd786ea4724a8302f6fa373a4c5",
"c4262c9d665c43fc95f5d651272e05ac",
"eaa840ba44e5468d863d701b7a887cb0",
"836cc5fb2aac4814975222e4cb3eb509",
"cc0ff055c7e348bfb7442e1da9c2d283",
"453451afd5a041cf8bd7b9bebae95e1a",
"e377724de4ea48dcb3a35d35100f77c2",
"2fa10546eb11424eb1376773fd6ce8c3",
"0b03f0f260f142b6a6333f234ba7b64a",
"21e668a45d514c51b87d5888bc0d3f04",
"94bed16fdbbe42ab89e2417d0bc2f6be",
"ea9d739338bc46e7b6aa9edfc90db7ee",
"cc4d58df01594e258fede64937001ccc",
"bdf2b2471bec4a519b62171990b90751",
"49298f7943c2412f891932c2a62598b3",
"f92d4941bc304dbfbaec3a15954a2216",
"17fad956c06a43a7bb57313168431b2f",
"5ab0d18b923d4918ba0a3d9de7398235",
"9838107a69dc444084a8cbc5a97c69b5",
"0f52a0bf45bf4840b74f50ef0e1ed104",
"a7669275b5474a45b79e810a51fa773c",
"98405dc577ee4a5e8827123916074b67",
"19b3e634059f478986f5dfb4ab34875e",
"4a3004ebe922475d9476d91e50ddb0c4",
"00ccecda328f47408f98dfbb498c241a",
"50a6f2294627414f80816e08c425d997",
"1d994423cee14277899cf0e2e21252a4",
"7a1a268464a5405bb96d2cd7f1f4a411",
"c8390fdbd4824593a5ca3505b3ff7481",
"fb35b00db49e4fb49199ffd6c5b1c1f0",
"e82ebc90a3884176a59c903e746b6728",
"ba525ced60344562922dfcd1563b295e",
"dcb1f03aab3e47bcaef73337578e90aa",
"00c77aa4d05c46939141db3fc8ec4e0c",
"81e81ff88979470190cbf98ad198fded",
"4a2a80e4c40c49d383472d2161b8397f",
"7f1c2ba12eba4f94b6b763701c7b83fc",
"3cfc5529a1e844a5876336436c787062",
"bbaf7eb0bfdc47bea197e32ede2bd5df",
"7040bba8c540494d8fd3eb09e4aa87f4",
"7b645af074de4ce89e521c4e32aaf790",
"049cd54da01a47d29fcbfadcb31e1122",
"707d4cadc9ae45a998d4db6f022b860e"
]
},
"id": "N1EWeM0KcYtO",
"outputId": "2b89ef33-01b2-4bc2-b217-fcd1464c1da9"
},
"execution_count": 3,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading builder script: 0%| | 0.00/3.21k [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "562b2df63fee469eab344732405d0341"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading metadata: 0%| | 0.00/1.69k [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "5d658fd2b4ca452981f37d78e5a839ac"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading readme: 0%| | 0.00/4.87k [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "1a84c9f0d4c34ab9bfb8e6c1632e1aab"
}
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Downloading and preparing dataset sms_spam/plain_text to /root/.cache/huggingface/datasets/sms_spam/plain_text/1.0.0/53f051d3b5f62d99d61792c91acefe4f1577ad3e4c216fb0ad39e30b9f20019c...\n"
]
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading data: 0%| | 0.00/203k [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "94bed16fdbbe42ab89e2417d0bc2f6be"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Generating train split: 0%| | 0/5574 [00:00<?, ? examples/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "98405dc577ee4a5e8827123916074b67"
}
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Dataset sms_spam downloaded and prepared to /root/.cache/huggingface/datasets/sms_spam/plain_text/1.0.0/53f051d3b5f62d99d61792c91acefe4f1577ad3e4c216fb0ad39e30b9f20019c. Subsequent calls will reuse this data.\n"
]
},
{
"output_type": "display_data",
"data": {
"text/plain": [
" 0%| | 0/1 [00:00<?, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "dcb1f03aab3e47bcaef73337578e90aa"
}
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"dataset['train'][0]"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Mf1QIM_dlp2x",
"outputId": "b337a395-eef0-421c-b299-ef148397b0a0"
},
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'sms': 'Go until jurong point, crazy.. Available only in bugis n great world la e buffet... Cine there got amore wat...\\n',\n",
" 'label': 0}"
]
},
"metadata": {},
"execution_count": 4
}
]
},
{
"cell_type": "markdown",
"source": [
"# Tokenizer GPT2"
],
"metadata": {
"id": "Qc7CIjSOchir"
}
},
{
"cell_type": "code",
"source": [
"tokenizer = GPT2Tokenizer.from_pretrained('gpt2')\n",
"tokenizer.pad_token = tokenizer.eos_token\n"
],
"metadata": {
"id": "hmnlC_hubLmP",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 113,
"referenced_widgets": [
"c975281b288e4eb580cf5f97c44759f8",
"8aa4e156456648b89e1d198edf848cab",
"0e4014a5797c4dd4b9cef7a415784fb7",
"5deddfa5ec384b999a406cd9761c5b15",
"ccb20b15603d4adb977d436a04b7f22f",
"abca5ac8660749c3a85f0cf4231f7e3a",
"e2b8031555b743ad86f1b3292e8be6a7",
"0f1a0ff8193c4bcf8a5a4f855c7cdef9",
"b12a405cb522492f97ce1b300328bd24",
"84f46d78887b4b0982de0b6c0f208d78",
"663b9294d4b54a969afbfbe5eb9e27c6",
"97d18f182fa24bf79709aaaa319bc386",
"1bf36407ad944361aed5439377339ddf",
"2a00cb65c14b4ad3b58a035abd74c08b",
"15ed7e2f50ee4bb4ac08754c07a9e703",
"0074ea0bdbdd42e48d71395cf489db75",
"8d976387182945da82a6b88268f04c2e",
"3b7e5bbeba9a4fe6a72541478c2b3233",
"f0dcd590e27a474895fa9dde14cfb585",
"4ab6997444d04a37b491c90af229d9d3",
"165e45626e594a7f9bceeaac7c757eb6",
"ab158071f37645799c948471957cb5d5",
"3e1c6fd0adc642209160f8d0787cc119",
"cd06d7c3bd3e49c9a54f8d26767ac83f",
"00b32d689601497ba083d89d482f8bc0",
"55c24dad2d274095a9dea608b81fe08e",
"c0dfcfb6e20a4ea1b233ff8d643d75f0",
"86f28cc51d2b453e8635e5459eee023c",
"67cf3e6850f243479962aa7339861798",
"310e98af244f41d3a7cdb61f8288568b",
"debee430506e4c29878250bd9143ae31",
"a6e553a2b36b42eb843149ab3614f1e8",
"4b0c3d9ca62b4aa9ab79710b28dbaca1"
]
},
"outputId": "64c5b671-d14e-4e89-beb3-1605d7c65a36"
},
"execution_count": 5,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading (…)olve/main/vocab.json: 0%| | 0.00/1.04M [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "c975281b288e4eb580cf5f97c44759f8"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading (…)olve/main/merges.txt: 0%| | 0.00/456k [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "97d18f182fa24bf79709aaaa319bc386"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading (…)lve/main/config.json: 0%| | 0.00/665 [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "3e1c6fd0adc642209160f8d0787cc119"
}
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"sms = dataset['train'][0]['sms']\n",
"print('Original: ', sms)\n",
"print('Tokenized: ', tokenizer.tokenize(sms))\n",
"print('Token IDs: ', tokenizer.convert_tokens_to_ids(tokenizer.tokenize(sms)))"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "ZxigrpcQdWCF",
"outputId": "8b456584-5f74-471f-b57a-193dea12322d"
},
"execution_count": 6,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Original: Go until jurong point, crazy.. Available only in bugis n great world la e buffet... Cine there got amore wat...\n",
"\n",
"Tokenized: ['Go', 'Ġuntil', 'Ġjur', 'ong', 'Ġpoint', ',', 'Ġcrazy', '..', 'ĠAvailable', 'Ġonly', 'Ġin', 'Ġbug', 'is', 'Ġn', 'Ġgreat', 'Ġworld', 'Ġla', 'Ġe', 'Ġbuffet', '...', 'ĠC', 'ine', 'Ġthere', 'Ġgot', 'Ġam', 'ore', 'Ġwat', '...', 'Ċ']\n",
"Token IDs: [5247, 1566, 8174, 506, 966, 11, 7165, 492, 14898, 691, 287, 5434, 271, 299, 1049, 995, 8591, 304, 44703, 986, 327, 500, 612, 1392, 716, 382, 4383, 986, 198]\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Check maximum length of a sentence"
],
"metadata": {
"id": "wVT0m8T7evoz"
}
},
{
"cell_type": "code",
"source": [
"max_len = 0\n",
"\n",
"for sentence in dataset['train']:\n",
" input_ids = tokenizer.encode(sentence['sms'], add_special_tokens=True)\n",
" max_len = max(max_len, len(input_ids))\n",
"\n",
"print('Max sentence length: ', max_len)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "cmUVPrQYez3J",
"outputId": "a84aacee-574c-490b-9b98-97922f2834e8"
},
"execution_count": 7,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Max sentence length: 258\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Special tokenization"
],
"metadata": {
"id": "2NfXDfYifX5S"
}
},
{
"cell_type": "code",
"source": [
"input_ids = []\n",
"attention_masks = []\n",
"\n",
"for sentence in dataset['train']:\n",
" encoded_dict = tokenizer.encode_plus(\n",
" sentence['sms'],\n",
" add_special_tokens = True,\n",
" max_length = 260,\n",
" padding = 'max_length',\n",
" truncation=True,\n",
" return_attention_mask = True,\n",
" return_tensors = 'pt',\n",
" )\n",
" \n",
" input_ids.append(encoded_dict['input_ids'])\n",
" attention_masks.append(encoded_dict['attention_mask'])\n",
"\n",
"input_ids = torch.cat(input_ids, dim=0)\n",
"attention_masks = torch.cat(attention_masks, dim=0)\n",
"labels = torch.tensor([sentence['label'] for sentence in dataset['train']])\n",
"\n",
"print('Original: ', dataset['train'][0])\n",
"print('Token IDs:', input_ids[0])"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "4u03dIS1fbKU",
"outputId": "c0228fb7-fd51-4476-9bb1-32f09554f783"
},
"execution_count": 8,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Original: {'sms': 'Go until jurong point, crazy.. Available only in bugis n great world la e buffet... Cine there got amore wat...\\n', 'label': 0}\n",
"Token IDs: tensor([ 5247, 1566, 8174, 506, 966, 11, 7165, 492, 14898, 691,\n",
" 287, 5434, 271, 299, 1049, 995, 8591, 304, 44703, 986,\n",
" 327, 500, 612, 1392, 716, 382, 4383, 986, 198, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256,\n",
" 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256])\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Split dataset\n",
"Class balance ratio should be similar to base dataset ratio."
],
"metadata": {
"id": "Z6cC0YjAhmw_"
}
},
{
"cell_type": "code",
"source": [
"def check_class_balance(dataset):\n",
" spam_count = 0.0\n",
" not_spam_count = 0.0\n",
" for row in dataset:\n",
" if row[2].item() == 1:\n",
" spam_count += 1.0\n",
" else:\n",
" not_spam_count += 1.0\n",
" return spam_count / not_spam_count "
],
"metadata": {
"id": "v83dr5SQsI0B"
},
"execution_count": 9,
"outputs": []
},
{
"cell_type": "code",
"source": [
"dataset = TensorDataset(input_ids, attention_masks, labels)\n",
"print(\"Spam to not spam messages ratio: {}\\n\".format(check_class_balance(dataset)))\n",
"\n",
"test_size = 1000\n",
"dataset_len = len(dataset)\n",
"train_size = int(0.9 * (dataset_len-test_size))\n",
"val_size = (dataset_len-test_size) - train_size\n",
"\n",
"test_dataset, train_dataset, val_dataset = random_split(dataset, [test_size, train_size, val_size])\n",
"\n",
"print('{:>5,} test samples'.format(test_size))\n",
"print(\"Ratio: {}\\n\".format(check_class_balance(test_dataset)))\n",
"print('{:>5,} training samples'.format(train_size))\n",
"print(\"Ratio: {}\\n\".format(check_class_balance(train_dataset)))\n",
"print('{:>5,} validation samples'.format(val_size))\n",
"print(\"Ratio: {}\\n\".format(check_class_balance(val_dataset)))"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "vH3yXhA0hT3n",
"outputId": "0ec353c2-39c6-4581-9a9c-375709ed7b14"
},
"execution_count": 10,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Spam to not spam messages ratio: 0.15475450590428838\n",
"\n",
"1,000 test samples\n",
"Ratio: 0.13895216400911162\n",
"\n",
"4,116 training samples\n",
"Ratio: 0.16074450084602368\n",
"\n",
" 458 validation samples\n",
"Ratio: 0.13647642679900746\n",
"\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Create train and validation loaders"
],
"metadata": {
"id": "z1hVsejihpO2"
}
},
{
"cell_type": "code",
"source": [
"batch_size = 8\n",
"\n",
"train_dataloader = DataLoader(\n",
" train_dataset,\n",
" sampler = RandomSampler(train_dataset),\n",
" batch_size = batch_size\n",
" )\n",
"\n",
"validation_dataloader = DataLoader(\n",
" val_dataset,\n",
" sampler = SequentialSampler(val_dataset),\n",
" batch_size = batch_size\n",
" )"
],
"metadata": {
"id": "k4pXght6hre3"
},
"execution_count": 11,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Device check"
],
"metadata": {
"id": "MnErwHAbl_rF"
}
},
{
"cell_type": "code",
"source": [
"if torch.cuda.is_available(): \n",
" device = torch.device(\"cuda\")\n",
"\n",
" print('There are %d GPU(s) available.' % torch.cuda.device_count())\n",
" print('We will use the GPU:', torch.cuda.get_device_name(0))\n",
"\n",
"else:\n",
" print('No GPU available, using the CPU instead.')\n",
" device = torch.device(\"cpu\")"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "aUvyBFxzmBUy",
"outputId": "dff6ae93-d79c-4d97-e6f1-91bd533cc167"
},
"execution_count": 12,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"There are 1 GPU(s) available.\n",
"We will use the GPU: Tesla T4\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Create custom GPT2 model\n",
"Compared to GPT2ForSeqienceClassification - 2 additional linear layers.\n",
"https://github.com/huggingface/transformers/blob/bd469c40659ce76c81f69c7726759d249b4aef49/src/transformers/models/gpt2/modeling_gpt2.py#L1328"
],
"metadata": {
"id": "o-YrojT-iIfY"
}
},
{
"cell_type": "code",
"source": [
"from transformers import GPT2ForSequenceClassification, GPT2Config, GPT2Model\n",
"from torch import nn"
],
"metadata": {
"id": "QxEE2YTIr7L0"
},
"execution_count": 13,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# in original model - no custom head just linear layer\n",
"# self.score = nn.Linear(config.n_embd, self.num_labels, bias=False)\n",
"\n",
"class GPT2ClassificationHeadCustom(nn.Module):\n",
" def __init__(self, config):\n",
" super().__init__()\n",
" self.dense_1 = nn.Linear(config.n_embd, config.n_embd)\n",
" self.dense_2 = nn.Linear(config.n_embd, config.n_embd)\n",
" self.dense_3 = nn.Linear(config.n_embd, config.num_labels)\n",
"\n",
" def forward(self, x):\n",
" x = self.dense_1(x)\n",
" x = torch.relu(x)\n",
"\n",
" x = self.dense_2(x)\n",
" x = torch.relu(x)\n",
"\n",
" x = self.dense_3(x)\n",
" x = torch.relu(x)\n",
" return x\n",
"\n",
"class GPT2ForSequenceClassificationCustom(GPT2ForSequenceClassification):\n",
" def __init__(self, config):\n",
" super().__init__(config)\n",
" self.num_labels = config.num_labels\n",
" self.transformer = GPT2Model(config)\n",
" self.score = GPT2ClassificationHeadCustom(config)\n",
"\n",
" self.init_weights()\n",
"\n",
" # Model parallel\n",
" self.model_parallel = False\n",
" self.device_map = None\n",
"\n",
"model = GPT2ForSequenceClassificationCustom.from_pretrained(\n",
" 'gpt2',\n",
" num_labels = 2,\n",
")"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 103,
"referenced_widgets": [
"e18707f0d4be4cf1bf2fd448c465a49a",
"8f9ca17cef4b491fab0ba086eddeee06",
"291394dabaf4461abc7d116c34a62972",
"79d4d0a4e6914963988862a457fe5004",
"3fb7ae428a654adb9639dca54c8487ca",
"c5a0d019aa454525b975be7b8125af52",
"bd2d006b7df94f52be982c93e6591ed9",
"8cf28f0e3d22453f9b1293f7309373a1",
"2ffeb0a10a69433689ca87de39f760b6",
"d2183878e1b343abb962b16a2615c0a5",
"68e1e4d6f5ce456398f333041eb00151"
]
},
"id": "sIP3VGZmiK9s",
"outputId": "e944fc5f-2abb-4c2f-d201-cbc8fc98e976"
},
"execution_count": 14,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading (…)\"pytorch_model.bin\";: 0%| | 0.00/548M [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "e18707f0d4be4cf1bf2fd448c465a49a"
}
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"Some weights of GPT2ForSequenceClassificationCustom were not initialized from the model checkpoint at gpt2 and are newly initialized: ['score.dense_3.bias', 'score.dense_2.bias', 'score.dense_1.bias', 'score.dense_3.weight', 'score.dense_2.weight', 'score.dense_1.weight']\n",
"You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"model.resize_token_embeddings(len(tokenizer))\n",
"model.config.pad_token_id = model.config.eos_token_id\n",
"\n",
"model.cuda()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "LhpRR5YEeU1S",
"outputId": "2a4fff45-0d1e-4a21-dd66-8f8038ba80da"
},
"execution_count": 15,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"GPT2ForSequenceClassificationCustom(\n",
" (transformer): GPT2Model(\n",
" (wte): Embedding(50257, 768)\n",
" (wpe): Embedding(1024, 768)\n",
" (drop): Dropout(p=0.1, inplace=False)\n",
" (h): ModuleList(\n",
" (0): GPT2Block(\n",
" (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (attn): GPT2Attention(\n",
" (c_attn): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (attn_dropout): Dropout(p=0.1, inplace=False)\n",
" (resid_dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (mlp): GPT2MLP(\n",
" (c_fc): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (act): NewGELUActivation()\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (1): GPT2Block(\n",
" (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (attn): GPT2Attention(\n",
" (c_attn): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (attn_dropout): Dropout(p=0.1, inplace=False)\n",
" (resid_dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (mlp): GPT2MLP(\n",
" (c_fc): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (act): NewGELUActivation()\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (2): GPT2Block(\n",
" (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (attn): GPT2Attention(\n",
" (c_attn): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (attn_dropout): Dropout(p=0.1, inplace=False)\n",
" (resid_dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (mlp): GPT2MLP(\n",
" (c_fc): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (act): NewGELUActivation()\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (3): GPT2Block(\n",
" (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (attn): GPT2Attention(\n",
" (c_attn): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (attn_dropout): Dropout(p=0.1, inplace=False)\n",
" (resid_dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (mlp): GPT2MLP(\n",
" (c_fc): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (act): NewGELUActivation()\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (4): GPT2Block(\n",
" (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (attn): GPT2Attention(\n",
" (c_attn): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (attn_dropout): Dropout(p=0.1, inplace=False)\n",
" (resid_dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (mlp): GPT2MLP(\n",
" (c_fc): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (act): NewGELUActivation()\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (5): GPT2Block(\n",
" (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (attn): GPT2Attention(\n",
" (c_attn): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (attn_dropout): Dropout(p=0.1, inplace=False)\n",
" (resid_dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (mlp): GPT2MLP(\n",
" (c_fc): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (act): NewGELUActivation()\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (6): GPT2Block(\n",
" (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (attn): GPT2Attention(\n",
" (c_attn): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (attn_dropout): Dropout(p=0.1, inplace=False)\n",
" (resid_dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (mlp): GPT2MLP(\n",
" (c_fc): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (act): NewGELUActivation()\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (7): GPT2Block(\n",
" (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (attn): GPT2Attention(\n",
" (c_attn): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (attn_dropout): Dropout(p=0.1, inplace=False)\n",
" (resid_dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (mlp): GPT2MLP(\n",
" (c_fc): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (act): NewGELUActivation()\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (8): GPT2Block(\n",
" (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (attn): GPT2Attention(\n",
" (c_attn): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (attn_dropout): Dropout(p=0.1, inplace=False)\n",
" (resid_dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (mlp): GPT2MLP(\n",
" (c_fc): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (act): NewGELUActivation()\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (9): GPT2Block(\n",
" (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (attn): GPT2Attention(\n",
" (c_attn): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (attn_dropout): Dropout(p=0.1, inplace=False)\n",
" (resid_dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (mlp): GPT2MLP(\n",
" (c_fc): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (act): NewGELUActivation()\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (10): GPT2Block(\n",
" (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (attn): GPT2Attention(\n",
" (c_attn): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (attn_dropout): Dropout(p=0.1, inplace=False)\n",
" (resid_dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (mlp): GPT2MLP(\n",
" (c_fc): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (act): NewGELUActivation()\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (11): GPT2Block(\n",
" (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (attn): GPT2Attention(\n",
" (c_attn): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (attn_dropout): Dropout(p=0.1, inplace=False)\n",
" (resid_dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" (mlp): GPT2MLP(\n",
" (c_fc): Conv1D()\n",
" (c_proj): Conv1D()\n",
" (act): NewGELUActivation()\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" )\n",
" (ln_f): LayerNorm((768,), eps=1e-05, elementwise_affine=True)\n",
" )\n",
" (score): GPT2ClassificationHeadCustom(\n",
" (dense_1): Linear(in_features=768, out_features=768, bias=True)\n",
" (dense_2): Linear(in_features=768, out_features=768, bias=True)\n",
" (dense_3): Linear(in_features=768, out_features=2, bias=True)\n",
" )\n",
")"
]
},
"metadata": {},
"execution_count": 15
}
]
},
{
"cell_type": "markdown",
"source": [
"# Init training parameters"
],
"metadata": {
"id": "NZDC4iiQizdX"
}
},
{
"cell_type": "code",
"source": [
"optimizer = torch.optim.AdamW(model.parameters(),\n",
" lr = 2e-5,\n",
" eps = 1e-8\n",
" )\n",
"\n",
"epochs = 4\n",
"total_steps = len(train_dataloader) * epochs\n",
"\n",
"scheduler = get_linear_schedule_with_warmup(optimizer, \n",
" num_warmup_steps = 0,\n",
" num_training_steps = total_steps)"
],
"metadata": {
"id": "_uffUPNEi3S5"
},
"execution_count": 16,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Helper functions"
],
"metadata": {
"id": "bnAwgfZekeYD"
}
},
{
"cell_type": "code",
"source": [
"def flat_accuracy(preds, labels):\n",
" pred_flat = np.argmax(preds, axis=1).flatten()\n",
" labels_flat = labels.flatten()\n",
" return np.sum(pred_flat == labels_flat) / len(labels_flat)\n",
"\n",
"def format_time(elapsed):\n",
" '''\n",
" Takes a time in seconds and returns a string hh:mm:ss\n",
" '''\n",
" elapsed_rounded = int(round((elapsed)))\n",
" return str(datetime.timedelta(seconds=elapsed_rounded))"
],
"metadata": {
"id": "Z3XSZuFmkgVr"
},
"execution_count": 17,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Training"
],
"metadata": {
"id": "L-ZeLPfbkqy9"
}
},
{
"cell_type": "code",
"source": [
"# This training code is based on the `run_glue.py` script here:\n",
"# https://github.com/huggingface/transformers/blob/5bfcd0485ece086ebcbed2d008813037968a9e58/examples/run_glue.py#L128\n",
"\n",
"seed_val = 42\n",
"\n",
"random.seed(seed_val)\n",
"np.random.seed(seed_val)\n",
"torch.manual_seed(seed_val)\n",
"torch.cuda.manual_seed_all(seed_val)\n",
"\n",
"training_stats = []\n",
"total_t0 = time.time()\n",
"\n",
"for epoch_i in range(0, epochs):\n",
" \n",
" # ========================================\n",
" # Training\n",
" # ========================================\n",
"\n",
" print(\"\")\n",
" print('======== Epoch {:} / {:} ========'.format(epoch_i + 1, epochs))\n",
" print('Training...')\n",
"\n",
" t0 = time.time()\n",
" total_train_loss = 0\n",
"\n",
" model.train()\n",
"\n",
" for step, batch in enumerate(train_dataloader):\n",
" if step % 40 == 0 and not step == 0:\n",
" elapsed = format_time(time.time() - t0)\n",
" print(' Batch {:>5,} of {:>5,}. Elapsed: {:}.'.format(step, len(train_dataloader), elapsed))\n",
"\n",
" b_input_ids = batch[0].to(device)\n",
" b_input_mask = batch[1].to(device)\n",
" b_labels = batch[2].to(device)\n",
"\n",
" model.zero_grad() \n",
"\n",
" outputs = model(b_input_ids, \n",
" token_type_ids=None, \n",
" attention_mask=b_input_mask, \n",
" labels=b_labels)\n",
"\n",
" loss = outputs['loss']\n",
" total_train_loss += loss.item()\n",
"\n",
" loss.backward()\n",
" torch.nn.utils.clip_grad_norm_(model.parameters(), 1.0)\n",
"\n",
" optimizer.step()\n",
" scheduler.step()\n",
"\n",
" avg_train_loss = total_train_loss / len(train_dataloader) \n",
" training_time = format_time(time.time() - t0)\n",
"\n",
" print(\"\")\n",
" print(\" Average training loss: {0:.2f}\".format(avg_train_loss))\n",
" print(\" Training epcoh took: {:}\".format(training_time))\n",
" \n",
" # ========================================\n",
" # Validation\n",
" # ========================================\n",
"\n",
" print(\"\")\n",
" print(\"Running Validation...\")\n",
"\n",
" t0 = time.time()\n",
" model.eval()\n",
"\n",
" total_eval_accuracy = 0\n",
" total_eval_loss = 0\n",
" nb_eval_steps = 0\n",
"\n",
" for batch in validation_dataloader:\n",
" b_input_ids = batch[0].to(device)\n",
" b_input_mask = batch[1].to(device)\n",
" b_labels = batch[2].to(device)\n",
" \n",
" with torch.no_grad(): \n",
" outputs = model(b_input_ids, \n",
" token_type_ids=None, \n",
" attention_mask=b_input_mask,\n",
" labels=b_labels)\n",
" loss = outputs['loss']\n",
" logits = outputs['logits']\n",
" \n",
" total_eval_loss += loss.item()\n",
"\n",
" logits = logits.detach().cpu().numpy()\n",
" label_ids = b_labels.to('cpu').numpy()\n",
"\n",
" total_eval_accuracy += flat_accuracy(logits, label_ids)\n",
" \n",
" avg_val_accuracy = total_eval_accuracy / len(validation_dataloader)\n",
" print(\" Accuracy: {0:.2f}\".format(avg_val_accuracy))\n",
"\n",
" avg_val_loss = total_eval_loss / len(validation_dataloader)\n",
" validation_time = format_time(time.time() - t0)\n",
" \n",
" print(\" Validation Loss: {0:.2f}\".format(avg_val_loss))\n",
" print(\" Validation took: {:}\".format(validation_time))\n",
"\n",
" training_stats.append(\n",
" {\n",
" 'epoch': epoch_i + 1,\n",
" 'Training Loss': avg_train_loss,\n",
" 'Valid. Loss': avg_val_loss,\n",
" 'Valid. Accur.': avg_val_accuracy,\n",
" 'Training Time': training_time,\n",
" 'Validation Time': validation_time\n",
" }\n",
" )\n",
"\n",
"print(\"\")\n",
"print(\"Training complete!\")\n",
"\n",
"print(\"Total training took {:} (h:mm:ss)\".format(format_time(time.time()-total_t0)))"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "hnq-2iztdYie",
"outputId": "36eeffb8-2aaa-4db8-c2d3-17e7addaa693"
},
"execution_count": 18,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\n",
"======== Epoch 1 / 4 ========\n",
"Training...\n",
" Batch 40 of 515. Elapsed: 0:00:19.\n",
" Batch 80 of 515. Elapsed: 0:00:36.\n",
" Batch 120 of 515. Elapsed: 0:00:53.\n",
" Batch 160 of 515. Elapsed: 0:01:11.\n",
" Batch 200 of 515. Elapsed: 0:01:28.\n",
" Batch 240 of 515. Elapsed: 0:01:45.\n",
" Batch 280 of 515. Elapsed: 0:02:02.\n",
" Batch 320 of 515. Elapsed: 0:02:19.\n",
" Batch 360 of 515. Elapsed: 0:02:36.\n",
" Batch 400 of 515. Elapsed: 0:02:53.\n",
" Batch 440 of 515. Elapsed: 0:03:10.\n",
" Batch 480 of 515. Elapsed: 0:03:27.\n",
"\n",
" Average training loss: 0.09\n",
" Training epcoh took: 0:03:42\n",
"\n",
"Running Validation...\n",
" Accuracy: 0.99\n",
" Validation Loss: 0.03\n",
" Validation took: 0:00:08\n",
"\n",
"======== Epoch 2 / 4 ========\n",
"Training...\n",
" Batch 40 of 515. Elapsed: 0:00:17.\n",
" Batch 80 of 515. Elapsed: 0:00:34.\n",
" Batch 120 of 515. Elapsed: 0:00:51.\n",
" Batch 160 of 515. Elapsed: 0:01:08.\n",
" Batch 200 of 515. Elapsed: 0:01:25.\n",
" Batch 240 of 515. Elapsed: 0:01:42.\n",
" Batch 280 of 515. Elapsed: 0:01:59.\n",
" Batch 320 of 515. Elapsed: 0:02:16.\n",
" Batch 360 of 515. Elapsed: 0:02:33.\n",
" Batch 400 of 515. Elapsed: 0:02:50.\n",
" Batch 440 of 515. Elapsed: 0:03:07.\n",
" Batch 480 of 515. Elapsed: 0:03:24.\n",
"\n",
" Average training loss: 0.04\n",
" Training epcoh took: 0:03:39\n",
"\n",
"Running Validation...\n",
" Accuracy: 0.99\n",
" Validation Loss: 0.04\n",
" Validation took: 0:00:08\n",
"\n",
"======== Epoch 3 / 4 ========\n",
"Training...\n",
" Batch 40 of 515. Elapsed: 0:00:17.\n",
" Batch 80 of 515. Elapsed: 0:00:34.\n",
" Batch 120 of 515. Elapsed: 0:00:51.\n",
" Batch 160 of 515. Elapsed: 0:01:08.\n",
" Batch 200 of 515. Elapsed: 0:01:25.\n",
" Batch 240 of 515. Elapsed: 0:01:42.\n",
" Batch 280 of 515. Elapsed: 0:01:59.\n",
" Batch 320 of 515. Elapsed: 0:02:16.\n",
" Batch 360 of 515. Elapsed: 0:02:33.\n",
" Batch 400 of 515. Elapsed: 0:02:50.\n",
" Batch 440 of 515. Elapsed: 0:03:07.\n",
" Batch 480 of 515. Elapsed: 0:03:24.\n",
"\n",
" Average training loss: 0.02\n",
" Training epcoh took: 0:03:39\n",
"\n",
"Running Validation...\n",
" Accuracy: 0.99\n",
" Validation Loss: 0.04\n",
" Validation took: 0:00:08\n",
"\n",
"======== Epoch 4 / 4 ========\n",
"Training...\n",
" Batch 40 of 515. Elapsed: 0:00:17.\n",
" Batch 80 of 515. Elapsed: 0:00:34.\n",
" Batch 120 of 515. Elapsed: 0:00:51.\n",
" Batch 160 of 515. Elapsed: 0:01:08.\n",
" Batch 200 of 515. Elapsed: 0:01:25.\n",
" Batch 240 of 515. Elapsed: 0:01:42.\n",
" Batch 280 of 515. Elapsed: 0:01:59.\n",
" Batch 320 of 515. Elapsed: 0:02:16.\n",
" Batch 360 of 515. Elapsed: 0:02:33.\n",
" Batch 400 of 515. Elapsed: 0:02:50.\n",
" Batch 440 of 515. Elapsed: 0:03:07.\n",
" Batch 480 of 515. Elapsed: 0:03:24.\n",
"\n",
" Average training loss: 0.01\n",
" Training epcoh took: 0:03:39\n",
"\n",
"Running Validation...\n",
" Accuracy: 0.99\n",
" Validation Loss: 0.04\n",
" Validation took: 0:00:08\n",
"\n",
"Training complete!\n",
"Total training took 0:15:09 (h:mm:ss)\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Train summary"
],
"metadata": {
"id": "z3nngo5DgZe4"
}
},
{
"cell_type": "code",
"source": [
"import pandas as pd\n",
"\n",
"pd.set_option('precision', 2)\n",
"df_stats = pd.DataFrame(data=training_stats)\n",
"\n",
"df_stats = df_stats.set_index('epoch')\n",
"df_stats"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 204
},
"id": "qVSGSZ5-gbnV",
"outputId": "ecc3e8b1-e4cb-4f36-c90b-2802f4ce31a1"
},
"execution_count": 19,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" Training Loss Valid. Loss Valid. Accur. Training Time Validation Time\n",
"epoch \n",
"1 9.19e-02 0.03 0.99 0:03:42 0:00:08\n",
"2 3.62e-02 0.04 0.99 0:03:39 0:00:08\n",
"3 1.78e-02 0.04 0.99 0:03:39 0:00:08\n",
"4 8.69e-03 0.04 0.99 0:03:39 0:00:08"
],
"text/html": [
"\n",
" <div id=\"df-7a5470ea-c0bc-4371-a6f4-6086ac7be93f\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Training Loss</th>\n",
" <th>Valid. Loss</th>\n",
" <th>Valid. Accur.</th>\n",
" <th>Training Time</th>\n",
" <th>Validation Time</th>\n",
" </tr>\n",
" <tr>\n",
" <th>epoch</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>9.19e-02</td>\n",
" <td>0.03</td>\n",
" <td>0.99</td>\n",
" <td>0:03:42</td>\n",
" <td>0:00:08</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3.62e-02</td>\n",
" <td>0.04</td>\n",
" <td>0.99</td>\n",
" <td>0:03:39</td>\n",
" <td>0:00:08</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1.78e-02</td>\n",
" <td>0.04</td>\n",
" <td>0.99</td>\n",
" <td>0:03:39</td>\n",
" <td>0:00:08</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>8.69e-03</td>\n",
" <td>0.04</td>\n",
" <td>0.99</td>\n",
" <td>0:03:39</td>\n",
" <td>0:00:08</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-7a5470ea-c0bc-4371-a6f4-6086ac7be93f')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-7a5470ea-c0bc-4371-a6f4-6086ac7be93f button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-7a5470ea-c0bc-4371-a6f4-6086ac7be93f');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 19
}
]
},
{
"cell_type": "code",
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"\n",
"import seaborn as sns\n",
"\n",
"sns.set(style='darkgrid')\n",
"\n",
"sns.set(font_scale=1.5)\n",
"plt.rcParams[\"figure.figsize\"] = (12,6)\n",
"\n",
"plt.plot(df_stats['Training Loss'], 'b-o', label=\"Training\")\n",
"plt.plot(df_stats['Valid. Loss'], 'g-o', label=\"Validation\")\n",
"\n",
"plt.title(\"Training & Validation Loss\")\n",
"plt.xlabel(\"Epoch\")\n",
"plt.ylabel(\"Loss\")\n",
"plt.legend()\n",
"plt.xticks([1, 2, 3, 4])\n",
"\n",
"plt.show()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 427
},
"id": "qhDALEePhHp1",
"outputId": "b3b86c25-2525-47ff-a65c-37abc3080da3"
},
"execution_count": 20,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"<Figure size 864x432 with 1 Axes>"
],
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAvAAAAGaCAYAAABpIXfbAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdd1gU1/4G8HcLS28iiL0DSscWFWOsoGJHsVxbTNTEFo31anJTfsmNvWsSTWJiEAugsWBFU0wsURBEUSOWiCIgHaRsmd8fXjaugC7Nobyf58mT7Jk5M99dmfhy9swZiSAIAoiIiIiIqFqQil0AERERERHpjwGeiIiIiKgaYYAnIiIiIqpGGOCJiIiIiKoRBngiIiIiomqEAZ6IiIiIqBphgCeiWi8+Ph6Ojo7YsGFDmY+xaNEiODo6VmBVNVdJn7ejoyMWLVqk1zE2bNgAR0dHxMfHV3h9oaGhcHR0xPnz5yv82EREFUEudgFERM8rTRAODw9Ho0aNKrGa6ufJkyf48ssvERYWhqSkJNSpUwft2rXDu+++i5YtW+p1jFmzZuHYsWPYv38/2rRpU+w+giCgV69eyMzMxJkzZ2BkZFSRb6NSnT9/HhcuXMCECRNgYWEhdjlFxMfHo1evXhg7diw+/PBDscshoiqGAZ6Iqpzly5frvL506RJ2796NgIAAtGvXTmdbnTp1yn2+hg0bIjo6GjKZrMzH+PTTT/Hxxx+Xu5aKsHTpUhw+fBh+fn7o2LEjkpOTcerUKURFRekd4P39/XHs2DGEhIRg6dKlxe5z7tw5PHjwAAEBARUS3qOjoyGVvpovhi9cuICNGzdi6NChRQL84MGDMWDAABgYGLySWoiISosBnoiqnMGDB+u8VqvV2L17Nzw8PIpse152djbMzMxKdT6JRAJDQ8NS1/msqhL2cnNzcfToUXh7e2PVqlXa9hkzZqCgoEDv43h7e6N+/fo4ePAgFixYAIVCUWSf0NBQAE/DfkUo759BRZHJZOX6ZY6IqLJxDjwRVVs9e/bEuHHjcO3aNUyePBnt2rXDoEGDADwN8mvWrMGIESPQqVMnuLi4oE+fPli5ciVyc3N1jlPcnOxn206fPo3hw4fD1dUV3t7eWLZsGVQqlc4xipsDX9iWlZWF//znP+jcuTNcXV0xatQoREVFFXk/aWlpWLx4MTp16gRPT0+MHz8e165dw7hx49CzZ0+9PhOJRAKJRFLsLxTFhfCSSKVSDB06FOnp6Th16lSR7dnZ2Th+/DgcHBzg5uZWqs+7JMXNgddoNPjqq6/Qs2dPuLq6ws/PDwcOHCi2f1xcHD766CMMGDAAnp6ecHd3x7Bhw7B3716d/RYtWoSNGzcCAHr16gVHR0edP/+S5sCnpqbi448/Rvfu3eHi4oLu3bvj448/Rlpams5+hf3Pnj2Lb775Br1794aLiwt8fHywb98+vT6L0rh+/TqmT5+OTp06wdXVFf3798fWrVuhVqt19ktISMDixYvRo0cPuLi4oHPnzhg1apROTRqNBtu3b8fAgQPh6ekJLy8v+Pj44N///jeUSmWF105EZcMReCKq1h4+fIgJEybA19cXffv2xZMnTwAAiYmJCA4ORt++feHn5we5XI4LFy5g27ZtiI2NxTfffKPX8X/55Rfs3LkTo0aNwvDhwxEeHo5vv/0WlpaWmDZtml7HmDx5MurUqYPp06cjPT0d3333HaZMmYLw8HDttwUFBQWYNGkSYmNjMWzYMLi6uuLGjRuYNGkSLC0t9f48jIyMMGTIEISEhODQoUPw8/PTu+/zhg0bhi1btiA0NBS+vr462w4fPoy8vDwMHz4cQMV93s/773//ix9++AEdOnTAxIkTkZKSgk8++QSNGzcusu+FCxdw8eJFvPHGG2jUqJH224ilS5ciNTUVU6dOBQAEBAQgOzsbJ06cwOLFi2FtbQ3gxfdeZGVlYfTo0bh37x6GDx+Otm3bIjY2FkFBQTh37hz27t1b5JufNWvWIC8vDwEBAVAoFAgKCsKiRYvQpEmTIlPByurKlSsYN24c5HI5xo4di7p16+L06dNYuXIlrl+/rv0WRqVSYdKkSUhMTMSYMWPQrFkzZGdn48aNG7h48SKGDh0KANiyZQvWr1+PHj16YNSoUZDJZIiPj8epU6dQUFBQZb5pIqr1BCKiKi4kJERwcHAQQkJCdNp79OghODg4CHv27CnSJz8/XygoKCjSvmbNGsHBwUGIiorStt2/f19wcHAQ1q9fX6TN3d1duH//vrZdo9EIAwYMELp27apz3IULFwoODg7Ftv3nP//RaQ8LCxMcHByEoKAgbduPP/4oODg4CJs3b9bZt7C9R48eRd5LcbKysoS3335bcHFxEdq2bSscPnxYr34lGT9+vNCmTRshMTFRp33kyJGCs7OzkJKSIghC+T9vQRAEBwcHYeHChdrXcXFxgqOjozB+/HhBpVJp22NiYgRHR0fBwcFB588mJyenyPnVarXwr3/9S/Dy8tKpb/369UX6Fyr8eTt37py2bfXq1YKDg4Pw448/6uxb+OezZs2aIv0HDx4s5Ofna9sfPXokODs7C3PmzClyzucVfkYff/zxC/cLCAgQ2rRpI8TGxmrbNBqNMGvWLMHBwUH4448/BEEQhNjYWMHBwUH4+uuvX3i8IUOGCP369XtpfUQkLk6hIaJqzcrKCsOGDSvSrlAotKOFKpUKGRkZSE1NRZcuXQCg2CksxenVq5fOKjcSiQSdOnVCcnIycnJy9DrGxIkTdV6/9tprAIB79+5p206fPg2ZTIbx48fr7DtixAiYm5vrdR6NRoPZs2fj+vXrOHLkCF5//XXMmzcPBw8e1Nnvgw8+gLOzs15z4v39/aFWq7F//35tW1xcHC5fvoyePXtqbyKuqM/7WeHh4RAEAZMmTdKZk+7s7IyuXbsW2d/ExET73/n5+UhLS0N6ejq6du2K7Oxs3L59u9Q1FDpx4gTq1KmDgIAAnfaAgADUqVMHJ0+eLNJnzJgxOtOW6tWrh+bNm+Pu3btlruNZKSkpiIyMRM+ePeHk5KRtl0gkeOedd7R1A9D+DJ0/fx4pKSklHtPMzAyJiYm4ePFihdRIRJWDU2iIqFpr3LhxiTccBgYGYteuXbh16xY0Go3OtoyMDL2P/zwrKysAQHp6OkxNTUt9jMIpG+np6dq2+Ph42NnZFTmeQqFAo0aNkJmZ+dLzhIeH48yZM1ixYgUaNWqEdevWYcaMGViwYAFUKpV2msSNGzfg6uqq15z4vn37wsLCAqGhoZgyZQoAICQkBAC002cKVcTn/az79+8DAFq0aFFkW8uWLXHmzBmdtpycHGzcuBFHjhxBQkJCkT76fIYliY+Ph4uLC+Ry3b825XI5mjVrhmvXrhXpU9LPzoMHD8pcx/M1AUCrVq2KbGvRogWkUqn2M2zYsCGmTZuGr7/+Gt7e3mjTpg1ee+01+Pr6ws3NTdtv7ty5mD59OsaOHQs7Ozt07NgRb7zxBnx8fEp1DwURVS4GeCKq1oyNjYtt/+677/DFF1/A29sb48ePh52dHQwMDJCYmIhFixZBEAS9jv+i1UjKewx9++ur8KbLDh06AHga/jdu3Ih33nkHixcvhkqlgpOTE6KiovDZZ5/pdUxDQ0P4+flh586diIiIgLu7Ow4cOAB7e3t069ZNu19Ffd7l8f777+Pnn3/GyJEj0aFDB1hZWUEmk+GXX37B9u3bi/xSUdle1ZKY+pozZw78/f3x888/4+LFiwgODsY333yDt956C/PnzwcAeHp64sSJEzhz5gzOnz+P8+fP49ChQ9iyZQt27typ/eWViMTFAE9ENdJPP/2Ehg0bYuvWrTpB6tdffxWxqpI1bNgQZ8+eRU5Ojs4ovFKpRHx8vF4PGyp8nw8ePED9+vUBPA3xmzdvxrRp0/DBBx+gYcOGcHBwwJAhQ/Suzd/fHzt37kRoaCgyMjKQnJyMadOm6XyulfF5F45g3759G02aNNHZFhcXp/M6MzMTP//8MwYPHoxPPvlEZ9sff/xR5NgSiaTUtdy5cwcql
},
"metadata": {}
}
]
},
{
"cell_type": "markdown",
"source": [
"# Create test loader"
],
"metadata": {
"id": "7gwWvjFwhJen"
}
},
{
"cell_type": "code",
"source": [
"prediction_dataloader = DataLoader(\n",
" test_dataset,\n",
" sampler = SequentialSampler(test_dataset),\n",
" batch_size = batch_size\n",
" )"
],
"metadata": {
"id": "du6qCdHyhMms"
},
"execution_count": 21,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Evaluate on test dataset"
],
"metadata": {
"id": "n9E84sH2hOt7"
}
},
{
"cell_type": "code",
"source": [
"print('Predicting labels for {:,} test sentences...'.format(len(test_dataset)))\n",
"\n",
"model.eval()\n",
"predictions , true_labels = [], []\n",
"\n",
"for batch in prediction_dataloader:\n",
" batch = tuple(t.to(device) for t in batch)\n",
" \n",
" b_input_ids, b_input_mask, b_labels = batch\n",
" \n",
" with torch.no_grad():\n",
" outputs = model(b_input_ids, token_type_ids=None, \n",
" attention_mask=b_input_mask)\n",
"\n",
" logits = outputs['logits']\n",
"\n",
" logits = logits.detach().cpu().numpy()\n",
" label_ids = b_labels.to('cpu').numpy()\n",
"\n",
" predictions.append(logits)\n",
" true_labels.append(label_ids)\n",
"\n",
"print(' DONE.')"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "s3nFSXgbhRs1",
"outputId": "81c4eefb-1d2a-4007-8a91-797578e496a8"
},
"execution_count": 22,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Predicting labels for 1,000 test sentences...\n",
" DONE.\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"results_ok = 0\n",
"results_false = 0\n",
"for idx, true_labels_batch in enumerate(true_labels):\n",
" predictions_i = np.argmax(predictions[idx], axis=1).flatten()\n",
" for bidx, true_label in enumerate(true_labels_batch):\n",
" if true_label == predictions_i[bidx]:\n",
" results_ok += 1\n",
" else:\n",
" results_false += 1\n",
"\n",
"print(\"Correct predictions: {}, incorrect results: {}, accuracy: {}\".format(results_ok, results_false, float(results_ok) / (results_ok + results_false)))"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "eNMYIt7RhWYM",
"outputId": "08ce9721-edd9-41e0-dd15-2b9620283f37"
},
"execution_count": 23,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Correct predictions: 991, incorrect results: 9, accuracy: 0.991\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# MCC Score"
],
"metadata": {
"id": "SwHJwpqKhZ51"
}
},
{
"cell_type": "code",
"source": [
"from sklearn.metrics import matthews_corrcoef\n",
"\n",
"matthews_set = []\n",
"print('Calculating Matthews Corr. Coef. for each batch...')\n",
"\n",
"for i in range(len(true_labels)):\n",
" pred_labels_i = np.argmax(predictions[i], axis=1).flatten()\n",
" \n",
" matthews = matthews_corrcoef(true_labels[i], pred_labels_i) \n",
" matthews_set.append(matthews)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "oqfHjUXThb2J",
"outputId": "c74b1bfe-1c97-4cc5-f0c4-e9a8cc45da28"
},
"execution_count": 24,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Calculating Matthews Corr. Coef. for each batch...\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"ax = sns.barplot(x=list(range(len(matthews_set))), y=matthews_set, ci=None)\n",
"\n",
"plt.title('MCC Score per Batch')\n",
"plt.ylabel('MCC Score (-1 to +1)')\n",
"plt.xlabel('Batch #')\n",
"\n",
"plt.show()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 427
},
"id": "JJoRzvr0hePf",
"outputId": "38fe5dad-17bb-4e0b-839b-2d69d42a9e1c"
},
"execution_count": 25,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"<Figure size 864x432 with 1 Axes>"
],
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAvIAAAGaCAYAAABt1KfmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdf3zN9f//8fvZb7ax0YYwCfN7fqaIRGjl5xgR5kch0rv00Xu8+9b7/e7dOyWV3n7kRyVGCdssvEnUux8IybuRERLT3nGKYWM22/n+sRyO88M5ds62o9v1cnF5v1+P1/PH4/U657w8vHqe1zGYTCaTAAAAAHgVn7JOAAAAAIDrKOQBAAAAL0QhDwAAAHghCnkAAADAC1HIAwAAAF6IQh4AAADwQhTyAACUE8OHD1fXrl3LOg0AXsKvrBMAgJLavn27EhISJElDhw7V888/b9Xmt99+U+fOnVVQUKB27dopKSnJqs2ePXu0bNky7dy5U0ajUT4+PqpVq5bat2+vwYMHq169ehbtL1y4oA8//FAbN27UoUOHlJubq8qVK6tp06Z64IEH1KdPH/n5Ob7Mnjt3TklJSfr444/1888/q7CwUOHh4WrUqJG6dOmigQMHluDM4Fpdu3bVzz//bN42GAyqWrWq6tatqyFDhqhnz543PPamTZuUkZGhJ554wh2pAsB1UcgDuGkEBgZq7dq1mjJligICAiz2paWlyWQy2S2sZ8+erdmzZys8PFy9evVS/fr1VVRUpEOHDmn9+vVatmyZduzYoZCQEEnS0aNHNXbsWP3000/q0KGDxo4dq/DwcP3222/atm2bpk6dqkOHDunPf/6z3XxzcnIUHx+vzMxM3X///RowYID8/f2VmZmpb7/9VkuWLKGQ94Dq1avr6aefliQVFRXpxIkTSk1N1dNPPy2j0aiRI0fe0LibNm1SamoqhTyAUkMhD+Cm0b17d61du1abNm3Sgw8+aLEvJSVF99xzj77++murfqtWrdKsWbN05513as6cOQoNDbXY/8wzz2j27Nnm7by8PI0bN07Hjx/XrFmz1KNHD4v2Y8eOVXp6uvbs2eMw3xUrVuinn37SX/7yF40YMcJqv9FovO4xe0JOTo75HyzexGQy6fz58woODnbYLjQ0VH379rWIPfTQQ+rUqZNSUlJuuJAHgNLGGnkAN40mTZqoYcOGSklJsYinp6fr4MGDGjBggFWf/Px8zZw5UxUrVtTMmTOtinhJCgoK0uTJk83F7cqVK3XkyBGNGjXKqoi/LCYmRkOHDnWY708//SRJat++vc39ERERVrGjR49q6tSpuueee9SsWTN17NhR48eP1969ey3abdq0SYMHD1bLli3VqlUrDR48WJs2bbIar2vXrho+fLj27dunRx55RG3atFGfPn0scnzmmWfUsWNHNWvWTF27dtUrr7yi8+fPOzy2a8f//vvvlZCQoFatWqldu3ZKTEzUb7/9ZtU+Pz9f8+bNU8+ePdW8eXO1bdtWjz32mPbt22fRbvv27ebXetmyZXrwwQfVvHlzvfvuu07lda3KlSsrICBA/v7+FvH09HRNmTJF999/v1q0aGE+l5988olFu+HDhys1NVWS1LBhQ/Ofq9+LRqNRL774ou677z41a9ZM7du316hRo7RlyxarfE6cOKGnn35ad9xxh1q0aKFHHnlER44cuaFjA3Dz4o48gJvKgAED9PLLL+vEiROqVq2apOI77lWrVtW9995r1f7bb7+V0WhU3759VaVKFafm+PjjjyUV38UtiaioKEnF/7Vg8uTJ111Pv2fPHo0cOVKXLl1SfHy8GjRooDNnzmjHjh3avXu3mjVrJklatmyZXnjhBd1+++2aMGGCJCk1NVWPP/64XnjhBau8s7KyNGLECMXGxqpHjx7mIn3v3r0aMWKEKlWqpIceekjVqlXT/v37lZSUpN27dyspKcmq8LXll19+0ciRI9WjRw/df//92rdvn5KTk7V3716tWrVKFSpUkCQVFBTokUce0e7du9W3b18NHTpUOTk5WrFihYYMGaKlS5eqefPmFmMvXrxY2dnZGjhwoCIiIlS9evXr5lNYWKhTp05JKl5aYzQatWTJEuXm5mrw4MEWbT/55BP9+OOPio2NVc2aNZWdna3U1FRNnDhRM2bMUO/evSVJjz32mIqKivTNN99o+vTp5v6tW7eWJB0/flxDhgzRb7/9pr59+6pZs2a6cOGCvvvuO23dulV33323uc/58+c1bNgwtWjRQpMmTdLx48e1ZMkSTZgwQWvXrpWvr+91jxHAH4QJALzc119/bYqOjja9/fbbplOnTpmaNm1qeuutt0wmk8l04cIFU5s2bUwvv/yyyWQymVq2bGkaNmyYue+SJUtM0dHRpnfffdfp+dq1a2dq3bp1ifPOzs42de7c2RQdHW1q37696YknnjDNnz/ftHPnTlNhYaFF26KiIlPPnj1NzZo1M2VkZFiNdbl9dna2qWXLlqZu3bqZzp07Z95/7tw503333Wdq2bKl6cyZM+Z4ly5dTNHR0aYVK1ZYjdm7d2/T/fffbzGOyWQybdy40RQdHW1KTk6+7jFeHn/RokUW8UWLFpmio6NN8+fPt4p98cUXFm3PnTtn6ty5s8Xrdvk1v+OOO0y//vrrdfO4Np9r/zRv3ty0fPlyq/a5ublWsfPnz5t69OhheuCBByziiYmJpujoaJvzPvroozaPzWQyWbzWw4YNM0VHR5sWLFhg0WbhwoV2+wP442JpDYCbSnh4uLp27Wpe5rBx40adO3fO5rIaqXg9uCSX1oTn5ORcdx22MypXrqyUlBSNGTNGoaGh+vjjj/Xaa69p6NCh6tatm7766itz24yMDB08eFD9+/dXo0aNrMby8Sm+nG/ZskXnz5/X8OHDLY4pJCREw4cP1/nz57V161aLvmFhYerfv79F7MCBAzpw4IB69eql/Px8nTp1yvynTZs2qlixos0lIbaEhITo4Ycftog9/PDDCgkJsVii8tFHH+n2229X06ZNLebLz89Xhw4dtGvXLuXl5VmM07dvX1WtWtWpPC6rWbOmFi1apEWLFundd9/Vyy+/rBYtWuhvf/ubkpOTLdpWrFjR/P8vXLig06dP68KFC7rrrrt0+PBh8/vHkezsbH355Zfq1KmTOnXqZLX/8mt39fblpzBddtddd0kqXloFAJextAbATWfAgAEaO3asvvnmGyUnJysmJkb169e32fZysZubm+v0+CEhIS61d6RKlSqaPHmyJk+erNOnT+u///2v1q9fr48++kgTJ05UWlqa6tSpY15P36RJE4fjHT9+XJLUoEEDq32XY5mZmRbx2rVrWy3XOHz4sCRp1qxZmjVrls25fv311+sf4O/jX/sUoYCAANWuXdsil8OHDysvL8/udwYk6fTp06pRo4Z5+7bbbnMqh6tVrFhRHTp0sIj17t1bcXFxevHFF9W1a1eFh4dLKn5s6cyZM7V582aba/rPnj173X8EHjt2TCaT6bqv3WWRkZEKDAy0iIWFhUkq/kcBAFxGIQ/gptOxY0dVq1ZNc+bM0fbt2/W3v/3NbtvLxe21X6Z0pEGDBtq5c6cyMzNVu3btkqZrFh4eri5duqhLly6qUaOG5s2bp3Xr1pnXuXvK5TXqtowePdrmXWRJqlSpklvzMJlMio6O1tSpU+22ufZ7DI5yd4Wfn5/uuusuLVmyROnp6ercubNMJpNGjx6tw4cPKyEhQc2aNVNoaKh8fX2VnJystWvXqqioyC3zX83RGniTyeT2+QB4Lwp5ADcdX19f9evXT/Pnz1dQUJB69eplt23r1q0VERGhTZs26fTp0+Y7sY706NFDO3fu1MqVK83PI3e3Fi1aSCp+eokk1a1bV1LxEhtHLv/D4uDBg1Z3tg8dOmTRxpE6depIKl7mce3da1dlZmYqPz/f4q58fn6+MjMzdfvtt1vMefr0ad11111Wy01Kw6VLlyRd+a8zBw4c0P79+/X444/rT3/6k0XblStXWvU3GAw2x42KipLBYLjuawcArmKNPICb0uDBg
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"flat_predictions = np.concatenate(predictions, axis=0)\n",
"flat_predictions = np.argmax(flat_predictions, axis=1).flatten()\n",
"\n",
"flat_true_labels = np.concatenate(true_labels, axis=0)\n",
"\n",
"mcc = matthews_corrcoef(flat_true_labels, flat_predictions)\n",
"\n",
"print('Total MCC: %.3f' % mcc)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "8XER3sOFhfny",
"outputId": "b59467dc-3459-42a4-da12-f8abc5be4f95"
},
"execution_count": 26,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Total MCC: 0.958\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Save model"
],
"metadata": {
"id": "ZTd3f1yKhhkP"
}
},
{
"cell_type": "code",
"source": [
"from google.colab import drive\n",
"\n",
"drive.mount('/content/gdrive/', force_remount=True)\n",
"\n",
"output_dir = '/content/gdrive/My Drive/UAM/Przetwarzanie-tekstu/GPT2_custom_model'\n",
"print(\"Saving model to %s\" % output_dir)\n",
"\n",
"model_to_save = model.module if hasattr(model, 'module') else model\n",
"model_to_save.save_pretrained(output_dir)\n",
"tokenizer.save_pretrained(output_dir)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "gqSUWqCqhizx",
"outputId": "22b21cb7-8401-4b58-eb64-c33af55b9de7"
},
"execution_count": 27,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Mounted at /content/gdrive/\n",
"Saving model to /content/gdrive/My Drive/UAM/Przetwarzanie-tekstu/GPT2_custom_model\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"('/content/gdrive/My Drive/UAM/Przetwarzanie-tekstu/GPT2_custom_model/tokenizer_config.json',\n",
" '/content/gdrive/My Drive/UAM/Przetwarzanie-tekstu/GPT2_custom_model/special_tokens_map.json',\n",
" '/content/gdrive/My Drive/UAM/Przetwarzanie-tekstu/GPT2_custom_model/vocab.json',\n",
" '/content/gdrive/My Drive/UAM/Przetwarzanie-tekstu/GPT2_custom_model/merges.txt',\n",
" '/content/gdrive/My Drive/UAM/Przetwarzanie-tekstu/GPT2_custom_model/added_tokens.json')"
]
},
"metadata": {},
"execution_count": 27
}
]
},
{
"cell_type": "markdown",
"source": [
"# Bibliografia\n",
"- https://gmihaila.github.io/tutorial_notebooks/gpt2_finetune_classification/\n",
"- https://mccormickml.com/2019/07/22/BERT-fine-tuning/#a1-saving--loading-fine-tuned-model"
],
"metadata": {
"id": "Er-thm7dkbIW"
}
}
]
}