Przetwarzanie_tekstu/projekt/BERT_custom_sms_spam.ipynb

5417 lines
278 KiB
Plaintext
Raw Normal View History

2023-02-18 01:26:59 +01:00
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"gpuClass": "standard",
"accelerator": "GPU",
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"faaab551ac144913bdeb5a7d6f036285": {
"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_a663f1f2ef884ad7b2ef87281f50b07c",
"IPY_MODEL_9c7a0cd78fba490da413bc7083fc7a27",
"IPY_MODEL_04529b4a3714492cb6b2a6a388929c85"
],
"layout": "IPY_MODEL_3accb74af07c4fd6be92666a46bd9db9"
}
},
"a663f1f2ef884ad7b2ef87281f50b07c": {
"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_ec974fdfc4f940a895186ae129442ec0",
"placeholder": "",
"style": "IPY_MODEL_955da7fdb5ff4f539d707839110ad27a",
"value": "Downloading builder script: 100%"
}
},
"9c7a0cd78fba490da413bc7083fc7a27": {
"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_e3f2f4acb97540ba93fcb56cb658cb6b",
"max": 3208,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_b1fad0c4a8694b88b1a9a3998b120289",
"value": 3208
}
},
"04529b4a3714492cb6b2a6a388929c85": {
"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_90c3eca7bac44244b5ae12fe88d780dd",
"placeholder": "",
"style": "IPY_MODEL_b291cc3d759c485aa2e65afb1c91fbd7",
"value": " 3.21k/3.21k [00:00<00:00, 58.7kB/s]"
}
},
"3accb74af07c4fd6be92666a46bd9db9": {
"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
}
},
"ec974fdfc4f940a895186ae129442ec0": {
"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
}
},
"955da7fdb5ff4f539d707839110ad27a": {
"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": ""
}
},
"e3f2f4acb97540ba93fcb56cb658cb6b": {
"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
}
},
"b1fad0c4a8694b88b1a9a3998b120289": {
"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": ""
}
},
"90c3eca7bac44244b5ae12fe88d780dd": {
"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
}
},
"b291cc3d759c485aa2e65afb1c91fbd7": {
"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": ""
}
},
"659bfbe1501d45bcbfc2fd4c8b9b51f0": {
"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_d16034be81314b0ab22a57075520bd00",
"IPY_MODEL_110f9ceef95345cbbe9b1cc908414dd2",
"IPY_MODEL_c2fbae82bace49a59ef379157308e082"
],
"layout": "IPY_MODEL_dda5aaa2c75a4ade9088f21c2df614d9"
}
},
"d16034be81314b0ab22a57075520bd00": {
"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_912b150fa20a415c8d5e5d0f63ddeab5",
"placeholder": "",
"style": "IPY_MODEL_9633d2a01238445aaa787802680f666e",
"value": "Downloading metadata: 100%"
}
},
"110f9ceef95345cbbe9b1cc908414dd2": {
"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_e6b4768ffc4e43dc9e9978e3048e9560",
"max": 1687,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_7938719f380046a3afb64fdeb0e6f7b5",
"value": 1687
}
},
"c2fbae82bace49a59ef379157308e082": {
"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_f07575607b5142379c572b0d2859a01f",
"placeholder": "",
"style": "IPY_MODEL_8f0fc0909de4401d9277c7cd4d3d62fa",
"value": " 1.69k/1.69k [00:00<00:00, 72.0kB/s]"
}
},
"dda5aaa2c75a4ade9088f21c2df614d9": {
"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
}
},
"912b150fa20a415c8d5e5d0f63ddeab5": {
"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
}
},
"9633d2a01238445aaa787802680f666e": {
"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": ""
}
},
"e6b4768ffc4e43dc9e9978e3048e9560": {
"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
}
},
"7938719f380046a3afb64fdeb0e6f7b5": {
"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": ""
}
},
"f07575607b5142379c572b0d2859a01f": {
"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
}
},
"8f0fc0909de4401d9277c7cd4d3d62fa": {
"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": ""
}
},
"6e349bfc9f4643828f64b3835aa11e71": {
"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_5ae276dee6084ec794c8c54547c39875",
"IPY_MODEL_d862c64d967d4502b02ab57dc648474a",
"IPY_MODEL_4dadade114f649bb84bd3245db78829a"
],
"layout": "IPY_MODEL_1b228494ac544dc6ad10de7164e5cab9"
}
},
"5ae276dee6084ec794c8c54547c39875": {
"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_aa1136948401479988b355417b5afd3a",
"placeholder": "",
"style": "IPY_MODEL_ac57cf6d2ee94786be93c39bacd288c0",
"value": "Downloading readme: 100%"
}
},
"d862c64d967d4502b02ab57dc648474a": {
"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_101a9188bebf4997bdbd81a1ba3d49cf",
"max": 4872,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_14d5a610583743b6af98ff3a1d30d717",
"value": 4872
}
},
"4dadade114f649bb84bd3245db78829a": {
"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_f3f77136ea684efca4e0774bae1eb3f3",
"placeholder": "",
"style": "IPY_MODEL_f82c24b096ea402da6597ead02b2f6fe",
"value": " 4.87k/4.87k [00:00<00:00, 61.0kB/s]"
}
},
"1b228494ac544dc6ad10de7164e5cab9": {
"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
}
},
"aa1136948401479988b355417b5afd3a": {
"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
}
},
"ac57cf6d2ee94786be93c39bacd288c0": {
"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": ""
}
},
"101a9188bebf4997bdbd81a1ba3d49cf": {
"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
}
},
"14d5a610583743b6af98ff3a1d30d717": {
"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": ""
}
},
"f3f77136ea684efca4e0774bae1eb3f3": {
"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
}
},
"f82c24b096ea402da6597ead02b2f6fe": {
"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": ""
}
},
"a2c3c8977a9e4c8bb6c0fe5cdcd3ceac": {
"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_98d5729aa1674d239c286edd6bd75d4b",
"IPY_MODEL_3d20ff84da944f6fa1078228eee062ee",
"IPY_MODEL_6fcf5f5540bc419aa23fcb8be82bc777"
],
"layout": "IPY_MODEL_0573bfba71bc4742a47112f4a664d14f"
}
},
"98d5729aa1674d239c286edd6bd75d4b": {
"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_a2aa3e788e1b4a16b113256294436c71",
"placeholder": "",
"style": "IPY_MODEL_149a763e14f541d39d7153e1e1989921",
"value": "Downloading data: 100%"
}
},
"3d20ff84da944f6fa1078228eee062ee": {
"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_b44dbebc2aca42039964df60715022bd",
"max": 203415,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_0159df9cab8844a29232e00311fb8fd7",
"value": 203415
}
},
"6fcf5f5540bc419aa23fcb8be82bc777": {
"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_a1decedbe7f9411b97f27e76b1d5539a",
"placeholder": "",
"style": "IPY_MODEL_eeecf24c1ba64460a86c9dc141cf48c0",
"value": " 203k/203k [00:00<00:00, 948kB/s]"
}
},
"0573bfba71bc4742a47112f4a664d14f": {
"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
}
},
"a2aa3e788e1b4a16b113256294436c71": {
"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
}
},
"149a763e14f541d39d7153e1e1989921": {
"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": ""
}
},
"b44dbebc2aca42039964df60715022bd": {
"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
}
},
"0159df9cab8844a29232e00311fb8fd7": {
"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": ""
}
},
"a1decedbe7f9411b97f27e76b1d5539a": {
"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
}
},
"eeecf24c1ba64460a86c9dc141cf48c0": {
"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": ""
}
},
"d0e5525f045f409287c8873153ef495c": {
"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_9616f2fe8e4b4d59bb8e233089f18949",
"IPY_MODEL_84c8cdd28bb74cdca76b1aba43a326dc",
"IPY_MODEL_ac95b4de0957453e899fe3f461b4dfb9"
],
"layout": "IPY_MODEL_e127270bbb834fe09dac3638574a0eae"
}
},
"9616f2fe8e4b4d59bb8e233089f18949": {
"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_250c97757de64dc59dfede5ea1f9c1b8",
"placeholder": "",
"style": "IPY_MODEL_6f6e7f5c15bb4170bed7f1acedaa2868",
"value": "Generating train split: 100%"
}
},
"84c8cdd28bb74cdca76b1aba43a326dc": {
"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_061c430fc36c47929e02ece94720b377",
"max": 5574,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_f6f3e433ad6d46ed99a3a0cc26624760",
"value": 5574
}
},
"ac95b4de0957453e899fe3f461b4dfb9": {
"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_61039dd008c848bc91f67a11961236f2",
"placeholder": "",
"style": "IPY_MODEL_ac902e290cdb46e7a76a9202dfbfeea6",
"value": " 5574/5574 [00:18<00:00, 6599.81 examples/s]"
}
},
"e127270bbb834fe09dac3638574a0eae": {
"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
}
},
"250c97757de64dc59dfede5ea1f9c1b8": {
"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
}
},
"6f6e7f5c15bb4170bed7f1acedaa2868": {
"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": ""
}
},
"061c430fc36c47929e02ece94720b377": {
"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
}
},
"f6f3e433ad6d46ed99a3a0cc26624760": {
"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": ""
}
},
"61039dd008c848bc91f67a11961236f2": {
"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
}
},
"ac902e290cdb46e7a76a9202dfbfeea6": {
"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": ""
}
},
"00ff5a79c3474438b9a2d3d5a613c38a": {
"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_5b2a5d29ab18450990dff3d0038098e3",
"IPY_MODEL_586924ae3bed49f4bcc34b62b88015cc",
"IPY_MODEL_9185e41c357b4348a227a5dd2b02e17a"
],
"layout": "IPY_MODEL_32d8bb3c116842eeb4b08eec26fa2dbe"
}
},
"5b2a5d29ab18450990dff3d0038098e3": {
"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_dfeff42101544ba5830e9cb4bfa11204",
"placeholder": "",
"style": "IPY_MODEL_784b879d84b9412e933b4d1990991f52",
"value": "100%"
}
},
"586924ae3bed49f4bcc34b62b88015cc": {
"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_469c46e6825446b6b205ba1a9e9b7d97",
"max": 1,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_b103284a69f64cf6908e494ec3b88b0c",
"value": 1
}
},
"9185e41c357b4348a227a5dd2b02e17a": {
"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_cae316c7fd2b42b4901fe22cc07f6a28",
"placeholder": "",
"style": "IPY_MODEL_767a6eb624374e0fbf51bf257cccc53b",
"value": " 1/1 [00:00<00:00, 14.12it/s]"
}
},
"32d8bb3c116842eeb4b08eec26fa2dbe": {
"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
}
},
"dfeff42101544ba5830e9cb4bfa11204": {
"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
}
},
"784b879d84b9412e933b4d1990991f52": {
"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": ""
}
},
"469c46e6825446b6b205ba1a9e9b7d97": {
"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
}
},
"b103284a69f64cf6908e494ec3b88b0c": {
"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": ""
}
},
"cae316c7fd2b42b4901fe22cc07f6a28": {
"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
}
},
"767a6eb624374e0fbf51bf257cccc53b": {
"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": ""
}
},
"dd1ec83063aa42faacf6e996dee95a58": {
"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_563eb31845224d4093e9dc96cf57c445",
"IPY_MODEL_7ea724412ddf4fdaaf9c76f19c39ab34",
"IPY_MODEL_b1d74065386d454788fb573b7a01d73a"
],
"layout": "IPY_MODEL_16d7dfccfd0c4801ba14eaa3640ea231"
}
},
"563eb31845224d4093e9dc96cf57c445": {
"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_91a0abd03d494b2699e8eb645ed7eda7",
"placeholder": "",
"style": "IPY_MODEL_acfe963e793840f5af98d016c3a5be4d",
"value": "Downloading (…)solve/main/vocab.txt: 100%"
}
},
"7ea724412ddf4fdaaf9c76f19c39ab34": {
"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_12eecded77aa4c0b8270958c429c5e33",
"max": 231508,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_e7eb4aa69ede435e911ccb4f6bb27eca",
"value": 231508
}
},
"b1d74065386d454788fb573b7a01d73a": {
"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_7df4f48608fc4f3185771b93105584dc",
"placeholder": "",
"style": "IPY_MODEL_1e5ffcf81cc649c3b9beacb8a7ab70c8",
"value": " 232k/232k [00:00<00:00, 935kB/s]"
}
},
"16d7dfccfd0c4801ba14eaa3640ea231": {
"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
}
},
"91a0abd03d494b2699e8eb645ed7eda7": {
"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
}
},
"acfe963e793840f5af98d016c3a5be4d": {
"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": ""
}
},
"12eecded77aa4c0b8270958c429c5e33": {
"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
}
},
"e7eb4aa69ede435e911ccb4f6bb27eca": {
"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": ""
}
},
"7df4f48608fc4f3185771b93105584dc": {
"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
}
},
"1e5ffcf81cc649c3b9beacb8a7ab70c8": {
"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": ""
}
},
"1e464642d1a046eba08a6b5b94dfd060": {
"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_02f6d5269ce6403b93301e1cc0810c2e",
"IPY_MODEL_93d7c900c84b488ba7fc0e801e8db5a7",
"IPY_MODEL_a0bc131511d941189e834a4c6eab91ad"
],
"layout": "IPY_MODEL_585307a3684a47cc8f0bd1f92b682373"
}
},
"02f6d5269ce6403b93301e1cc0810c2e": {
"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_b2e8a810e8c54e6b99ef5f9597a20077",
"placeholder": "",
"style": "IPY_MODEL_c61939fef83c4cb987192a3aaccc64fe",
"value": "Downloading (…)okenizer_config.json: 100%"
}
},
"93d7c900c84b488ba7fc0e801e8db5a7": {
"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_412fe82e08214f89804c8d68a599ac78",
"max": 28,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_d0b28111954e4a2abba91a096c19f06c",
"value": 28
}
},
"a0bc131511d941189e834a4c6eab91ad": {
"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_d5b8ded6476744a3b935d167d44b3b56",
"placeholder": "",
"style": "IPY_MODEL_1f5be997bd8641afbd3e0534387fe378",
"value": " 28.0/28.0 [00:00<00:00, 895B/s]"
}
},
"585307a3684a47cc8f0bd1f92b682373": {
"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
}
},
"b2e8a810e8c54e6b99ef5f9597a20077": {
"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
}
},
"c61939fef83c4cb987192a3aaccc64fe": {
"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": ""
}
},
"412fe82e08214f89804c8d68a599ac78": {
"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
}
},
"d0b28111954e4a2abba91a096c19f06c": {
"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": ""
}
},
"d5b8ded6476744a3b935d167d44b3b56": {
"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
}
},
"1f5be997bd8641afbd3e0534387fe378": {
"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": ""
}
},
"99e4648ab3bb4068afabf5bb441dbd43": {
"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_52a54be01e8f48a180e966021b38a629",
"IPY_MODEL_c8c5f72bee734aeca1019c11bedf1b3b",
"IPY_MODEL_e302c57ba0a14ba8bed6825155dac372"
],
"layout": "IPY_MODEL_a4c5260f6e89479088a3e22e48e2dfe3"
}
},
"52a54be01e8f48a180e966021b38a629": {
"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_38a5be06cf344b1ba233bcb4b380ef40",
"placeholder": "",
"style": "IPY_MODEL_aebaeada4ced48058c2aeeb825b43d12",
"value": "Downloading (…)lve/main/config.json: 100%"
}
},
"c8c5f72bee734aeca1019c11bedf1b3b": {
"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_67dd29a08bb549dfb8515bbb55a83c63",
"max": 570,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_ca258a0856da4668a6efaae834984f1a",
"value": 570
}
},
"e302c57ba0a14ba8bed6825155dac372": {
"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_5b334b7e24224d0291c68a765bee7a83",
"placeholder": "",
"style": "IPY_MODEL_ef04044742d64af2becb6fd4561c871e",
"value": " 570/570 [00:00<00:00, 16.1kB/s]"
}
},
"a4c5260f6e89479088a3e22e48e2dfe3": {
"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
}
},
"38a5be06cf344b1ba233bcb4b380ef40": {
"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
}
},
"aebaeada4ced48058c2aeeb825b43d12": {
"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": ""
}
},
"67dd29a08bb549dfb8515bbb55a83c63": {
"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
}
},
"ca258a0856da4668a6efaae834984f1a": {
"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": ""
}
},
"5b334b7e24224d0291c68a765bee7a83": {
"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
}
},
"ef04044742d64af2becb6fd4561c871e": {
"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": ""
}
},
"d92c1e0371f44bf1a09ab322f66e37af": {
"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_9fb44ba6139b41849d40fb5ac20301da",
"IPY_MODEL_81efef51b9d245bba85c978f34b4b945",
"IPY_MODEL_4db1c74d5d5b4ea3a9bf298a30f69dfe"
],
"layout": "IPY_MODEL_9c1441d4a6594e1894af6554ea357453"
}
},
"9fb44ba6139b41849d40fb5ac20301da": {
"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_90fd9ee5752a498bb1fe1e85469c86f5",
"placeholder": "",
"style": "IPY_MODEL_ba8f4bb285154ca08194c4dc912b0d8f",
"value": "Downloading (…)"pytorch_model.bin";: 100%"
}
},
"81efef51b9d245bba85c978f34b4b945": {
"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_dd2a99f30f4e403e89cde06b1acab3d4",
"max": 440473133,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_018f52dd2214404c85a53593f0e2ebc3",
"value": 440473133
}
},
"4db1c74d5d5b4ea3a9bf298a30f69dfe": {
"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_d65dd677908d4e6c873291c59d94b729",
"placeholder": "",
"style": "IPY_MODEL_5a2347b2bca94f798434ec43fbd41028",
"value": " 440M/440M [00:02<00:00, 249MB/s]"
}
},
"9c1441d4a6594e1894af6554ea357453": {
"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
}
},
"90fd9ee5752a498bb1fe1e85469c86f5": {
"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
}
},
"ba8f4bb285154ca08194c4dc912b0d8f": {
"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": ""
}
},
"dd2a99f30f4e403e89cde06b1acab3d4": {
"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
}
},
"018f52dd2214404c85a53593f0e2ebc3": {
"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": ""
}
},
"d65dd677908d4e6c873291c59d94b729": {
"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
}
},
"5a2347b2bca94f798434ec43fbd41028": {
"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": ""
}
}
}
}
},
"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": "5140c905-6bcf-4a6c-979f-b927f224d1a5"
},
"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[31m64.5 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[31m41.5 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: tqdm>=4.27 in /usr/local/lib/python3.8/dist-packages (from transformers) (4.64.1)\n",
"Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.8/dist-packages (from transformers) (1.21.6)\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: requests in /usr/local/lib/python3.8/dist-packages (from transformers) (2.25.1)\n",
"Requirement 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[31m24.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: filelock in /usr/local/lib/python3.8/dist-packages (from transformers) (3.9.0)\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[31m101.8 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: pyarrow>=6.0.0 in /usr/local/lib/python3.8/dist-packages (from datasets) (9.0.0)\n",
"Requirement already satisfied: aiohttp in /usr/local/lib/python3.8/dist-packages (from datasets) (3.8.4)\n",
"Collecting responses<0.19\n",
" Downloading responses-0.18.0-py3-none-any.whl (38 kB)\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[31m26.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting 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[31m16.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: fsspec[http]>=2021.11.1 in /usr/local/lib/python3.8/dist-packages (from datasets) (2023.1.0)\n",
"Requirement already satisfied: pandas in /usr/local/lib/python3.8/dist-packages (from datasets) (1.3.5)\n",
"Requirement 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: 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: 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: attrs>=17.3.0 in /usr/local/lib/python3.8/dist-packages (from aiohttp->datasets) (22.2.0)\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: chardet<5,>=3.0.2 in /usr/local/lib/python3.8/dist-packages (from requests->transformers) (4.0.0)\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: 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[31m17.8 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 BertTokenizer\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": [
"faaab551ac144913bdeb5a7d6f036285",
"a663f1f2ef884ad7b2ef87281f50b07c",
"9c7a0cd78fba490da413bc7083fc7a27",
"04529b4a3714492cb6b2a6a388929c85",
"3accb74af07c4fd6be92666a46bd9db9",
"ec974fdfc4f940a895186ae129442ec0",
"955da7fdb5ff4f539d707839110ad27a",
"e3f2f4acb97540ba93fcb56cb658cb6b",
"b1fad0c4a8694b88b1a9a3998b120289",
"90c3eca7bac44244b5ae12fe88d780dd",
"b291cc3d759c485aa2e65afb1c91fbd7",
"659bfbe1501d45bcbfc2fd4c8b9b51f0",
"d16034be81314b0ab22a57075520bd00",
"110f9ceef95345cbbe9b1cc908414dd2",
"c2fbae82bace49a59ef379157308e082",
"dda5aaa2c75a4ade9088f21c2df614d9",
"912b150fa20a415c8d5e5d0f63ddeab5",
"9633d2a01238445aaa787802680f666e",
"e6b4768ffc4e43dc9e9978e3048e9560",
"7938719f380046a3afb64fdeb0e6f7b5",
"f07575607b5142379c572b0d2859a01f",
"8f0fc0909de4401d9277c7cd4d3d62fa",
"6e349bfc9f4643828f64b3835aa11e71",
"5ae276dee6084ec794c8c54547c39875",
"d862c64d967d4502b02ab57dc648474a",
"4dadade114f649bb84bd3245db78829a",
"1b228494ac544dc6ad10de7164e5cab9",
"aa1136948401479988b355417b5afd3a",
"ac57cf6d2ee94786be93c39bacd288c0",
"101a9188bebf4997bdbd81a1ba3d49cf",
"14d5a610583743b6af98ff3a1d30d717",
"f3f77136ea684efca4e0774bae1eb3f3",
"f82c24b096ea402da6597ead02b2f6fe",
"a2c3c8977a9e4c8bb6c0fe5cdcd3ceac",
"98d5729aa1674d239c286edd6bd75d4b",
"3d20ff84da944f6fa1078228eee062ee",
"6fcf5f5540bc419aa23fcb8be82bc777",
"0573bfba71bc4742a47112f4a664d14f",
"a2aa3e788e1b4a16b113256294436c71",
"149a763e14f541d39d7153e1e1989921",
"b44dbebc2aca42039964df60715022bd",
"0159df9cab8844a29232e00311fb8fd7",
"a1decedbe7f9411b97f27e76b1d5539a",
"eeecf24c1ba64460a86c9dc141cf48c0",
"d0e5525f045f409287c8873153ef495c",
"9616f2fe8e4b4d59bb8e233089f18949",
"84c8cdd28bb74cdca76b1aba43a326dc",
"ac95b4de0957453e899fe3f461b4dfb9",
"e127270bbb834fe09dac3638574a0eae",
"250c97757de64dc59dfede5ea1f9c1b8",
"6f6e7f5c15bb4170bed7f1acedaa2868",
"061c430fc36c47929e02ece94720b377",
"f6f3e433ad6d46ed99a3a0cc26624760",
"61039dd008c848bc91f67a11961236f2",
"ac902e290cdb46e7a76a9202dfbfeea6",
"00ff5a79c3474438b9a2d3d5a613c38a",
"5b2a5d29ab18450990dff3d0038098e3",
"586924ae3bed49f4bcc34b62b88015cc",
"9185e41c357b4348a227a5dd2b02e17a",
"32d8bb3c116842eeb4b08eec26fa2dbe",
"dfeff42101544ba5830e9cb4bfa11204",
"784b879d84b9412e933b4d1990991f52",
"469c46e6825446b6b205ba1a9e9b7d97",
"b103284a69f64cf6908e494ec3b88b0c",
"cae316c7fd2b42b4901fe22cc07f6a28",
"767a6eb624374e0fbf51bf257cccc53b"
]
},
"id": "N1EWeM0KcYtO",
"outputId": "9fc3f675-a80c-4869-cfb5-160a2a25b6e2"
},
"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": "faaab551ac144913bdeb5a7d6f036285"
}
},
"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": "659bfbe1501d45bcbfc2fd4c8b9b51f0"
}
},
"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": "6e349bfc9f4643828f64b3835aa11e71"
}
},
"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": "a2c3c8977a9e4c8bb6c0fe5cdcd3ceac"
}
},
"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": "d0e5525f045f409287c8873153ef495c"
}
},
"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": "00ff5a79c3474438b9a2d3d5a613c38a"
}
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"dataset['train'][0]"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Mf1QIM_dlp2x",
"outputId": "a36bc069-6dc5-47bb-eae8-302dd8dd15dd"
},
"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 BERT"
],
"metadata": {
"id": "Qc7CIjSOchir"
}
},
{
"cell_type": "code",
"source": [
"tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 113,
"referenced_widgets": [
"dd1ec83063aa42faacf6e996dee95a58",
"563eb31845224d4093e9dc96cf57c445",
"7ea724412ddf4fdaaf9c76f19c39ab34",
"b1d74065386d454788fb573b7a01d73a",
"16d7dfccfd0c4801ba14eaa3640ea231",
"91a0abd03d494b2699e8eb645ed7eda7",
"acfe963e793840f5af98d016c3a5be4d",
"12eecded77aa4c0b8270958c429c5e33",
"e7eb4aa69ede435e911ccb4f6bb27eca",
"7df4f48608fc4f3185771b93105584dc",
"1e5ffcf81cc649c3b9beacb8a7ab70c8",
"1e464642d1a046eba08a6b5b94dfd060",
"02f6d5269ce6403b93301e1cc0810c2e",
"93d7c900c84b488ba7fc0e801e8db5a7",
"a0bc131511d941189e834a4c6eab91ad",
"585307a3684a47cc8f0bd1f92b682373",
"b2e8a810e8c54e6b99ef5f9597a20077",
"c61939fef83c4cb987192a3aaccc64fe",
"412fe82e08214f89804c8d68a599ac78",
"d0b28111954e4a2abba91a096c19f06c",
"d5b8ded6476744a3b935d167d44b3b56",
"1f5be997bd8641afbd3e0534387fe378",
"99e4648ab3bb4068afabf5bb441dbd43",
"52a54be01e8f48a180e966021b38a629",
"c8c5f72bee734aeca1019c11bedf1b3b",
"e302c57ba0a14ba8bed6825155dac372",
"a4c5260f6e89479088a3e22e48e2dfe3",
"38a5be06cf344b1ba233bcb4b380ef40",
"aebaeada4ced48058c2aeeb825b43d12",
"67dd29a08bb549dfb8515bbb55a83c63",
"ca258a0856da4668a6efaae834984f1a",
"5b334b7e24224d0291c68a765bee7a83",
"ef04044742d64af2becb6fd4561c871e"
]
},
"id": "hmnlC_hubLmP",
"outputId": "b3f7d069-4987-4d61-bc02-cab0f8508af0"
},
"execution_count": 5,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading (…)solve/main/vocab.txt: 0%| | 0.00/232k [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "dd1ec83063aa42faacf6e996dee95a58"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading (…)okenizer_config.json: 0%| | 0.00/28.0 [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "1e464642d1a046eba08a6b5b94dfd060"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading (…)lve/main/config.json: 0%| | 0.00/570 [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "99e4648ab3bb4068afabf5bb441dbd43"
}
},
"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": "6db555e8-0670-48e0-e2af-f89c7e49a011"
},
"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', 'ju', '##rong', 'point', ',', 'crazy', '.', '.', 'available', 'only', 'in', 'bug', '##is', 'n', 'great', 'world', 'la', 'e', 'buffet', '.', '.', '.', 'ci', '##ne', 'there', 'got', 'amore', 'wat', '.', '.', '.']\n",
"Token IDs: [2175, 2127, 18414, 17583, 2391, 1010, 4689, 1012, 1012, 2800, 2069, 1999, 11829, 2483, 1050, 2307, 2088, 2474, 1041, 28305, 1012, 1012, 1012, 25022, 2638, 2045, 2288, 26297, 28194, 1012, 1012, 1012]\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/",
"height": 34
},
"id": "cmUVPrQYez3J",
"outputId": "511e415a-8544-441f-a650-89d5cb4b4115"
},
"execution_count": 7,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Max sentence length: 238\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 = 240,\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": "32ddbde0-eced-48b1-a78b-8d835236143f"
},
"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([ 101, 2175, 2127, 18414, 17583, 2391, 1010, 4689, 1012, 1012,\n",
" 2800, 2069, 1999, 11829, 2483, 1050, 2307, 2088, 2474, 1041,\n",
" 28305, 1012, 1012, 1012, 25022, 2638, 2045, 2288, 26297, 28194,\n",
" 1012, 1012, 1012, 102, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\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": "QrEm9LLfvaDq"
},
"execution_count": 16,
"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": "4fc01e6d-5f37-4fd0-f7d6-a6ba43e6875d"
},
"execution_count": 23,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Spam to not spam messages ratio: 0.15475450590428838\n",
"\n",
"1,000 test samples\n",
"Ratio: 0.1792452830188679\n",
"\n",
"4,116 training samples\n",
"Ratio: 0.15100671140939598\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 = 32\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": 24,
"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": "24abe05a-2dd4-46ae-90ed-b0b775aecfc2"
},
"execution_count": 25,
"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": [
"# Custom BERT for classification\n",
"Compared to default BertForSequenceClassification - additional linear layer.\n",
"https://github.com/huggingface/transformers/blob/bd469c40659ce76c81f69c7726759d249b4aef49/src/transformers/models/bert/modeling_bert.py#L1506"
],
"metadata": {
"id": "o-YrojT-iIfY"
}
},
{
"cell_type": "code",
"source": [
"from transformers import BertForSequenceClassification, BertConfig, BertModel\n",
"from torch import nn"
],
"metadata": {
"id": "GlTdPmbxtMPI"
},
"execution_count": 27,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# in original model - no custom head just linear layer\n",
"# self.classifier = nn.Linear(config.hidden_size, config.num_labels)\n",
"\n",
"class BertClassificationHeadCustom(nn.Module):\n",
" def __init__(self, config):\n",
" super().__init__()\n",
" self.dense_1 = nn.Linear(config.hidden_size, config.hidden_size)\n",
" self.dense_2 = nn.Linear(config.hidden_size, 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",
" return x\n",
"\n",
"\n",
"class BertForSequenceClassificationCustom(BertForSequenceClassification):\n",
" def __init__(self, config):\n",
" super().__init__(config)\n",
" self.num_labels = config.num_labels\n",
" self.config = config\n",
"\n",
" self.bert = BertModel(config)\n",
" classifier_dropout = (\n",
" config.classifier_dropout if config.classifier_dropout is not None else config.hidden_dropout_prob\n",
" )\n",
" self.dropout = nn.Dropout(classifier_dropout)\n",
" self.classifier = BertClassificationHeadCustom(config)\n",
"\n",
" # Initialize weights and apply final processing\n",
" self.post_init()\n",
"\n",
"\n",
"\n",
"model = BertForSequenceClassificationCustom.from_pretrained(\n",
" \"bert-base-uncased\",\n",
" num_labels = 2,\n",
" output_attentions = False,\n",
" output_hidden_states = False,\n",
")\n",
"\n",
"model.cuda()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000,
"referenced_widgets": [
"d92c1e0371f44bf1a09ab322f66e37af",
"9fb44ba6139b41849d40fb5ac20301da",
"81efef51b9d245bba85c978f34b4b945",
"4db1c74d5d5b4ea3a9bf298a30f69dfe",
"9c1441d4a6594e1894af6554ea357453",
"90fd9ee5752a498bb1fe1e85469c86f5",
"ba8f4bb285154ca08194c4dc912b0d8f",
"dd2a99f30f4e403e89cde06b1acab3d4",
"018f52dd2214404c85a53593f0e2ebc3",
"d65dd677908d4e6c873291c59d94b729",
"5a2347b2bca94f798434ec43fbd41028"
]
},
"id": "sIP3VGZmiK9s",
"outputId": "bc2ef8ba-1a9d-4d83-fc07-82d09d188630"
},
"execution_count": 28,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading (…)\"pytorch_model.bin\";: 0%| | 0.00/440M [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "d92c1e0371f44bf1a09ab322f66e37af"
}
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertForSequenceClassificationCustom: ['cls.seq_relationship.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.predictions.bias', 'cls.predictions.transform.dense.bias', 'cls.seq_relationship.weight', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.transform.dense.weight', 'cls.predictions.decoder.weight']\n",
"- This IS expected if you are initializing BertForSequenceClassificationCustom from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n",
"- This IS NOT expected if you are initializing BertForSequenceClassificationCustom from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n",
"Some weights of BertForSequenceClassificationCustom were not initialized from the model checkpoint at bert-base-uncased and are newly initialized: ['classifier.dense_1.weight', 'classifier.dense_2.weight', 'classifier.dense_2.bias', 'classifier.dense_1.bias']\n",
"You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"BertForSequenceClassificationCustom(\n",
" (bert): BertModel(\n",
" (embeddings): BertEmbeddings(\n",
" (word_embeddings): Embedding(30522, 768, padding_idx=0)\n",
" (position_embeddings): Embedding(512, 768)\n",
" (token_type_embeddings): Embedding(2, 768)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (encoder): BertEncoder(\n",
" (layer): ModuleList(\n",
" (0): BertLayer(\n",
" (attention): BertAttention(\n",
" (self): BertSelfAttention(\n",
" (query): Linear(in_features=768, out_features=768, bias=True)\n",
" (key): Linear(in_features=768, out_features=768, bias=True)\n",
" (value): Linear(in_features=768, out_features=768, bias=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (output): BertSelfOutput(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (intermediate): BertIntermediate(\n",
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
" (intermediate_act_fn): GELUActivation()\n",
" )\n",
" (output): BertOutput(\n",
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (1): BertLayer(\n",
" (attention): BertAttention(\n",
" (self): BertSelfAttention(\n",
" (query): Linear(in_features=768, out_features=768, bias=True)\n",
" (key): Linear(in_features=768, out_features=768, bias=True)\n",
" (value): Linear(in_features=768, out_features=768, bias=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (output): BertSelfOutput(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (intermediate): BertIntermediate(\n",
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
" (intermediate_act_fn): GELUActivation()\n",
" )\n",
" (output): BertOutput(\n",
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (2): BertLayer(\n",
" (attention): BertAttention(\n",
" (self): BertSelfAttention(\n",
" (query): Linear(in_features=768, out_features=768, bias=True)\n",
" (key): Linear(in_features=768, out_features=768, bias=True)\n",
" (value): Linear(in_features=768, out_features=768, bias=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (output): BertSelfOutput(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (intermediate): BertIntermediate(\n",
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
" (intermediate_act_fn): GELUActivation()\n",
" )\n",
" (output): BertOutput(\n",
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (3): BertLayer(\n",
" (attention): BertAttention(\n",
" (self): BertSelfAttention(\n",
" (query): Linear(in_features=768, out_features=768, bias=True)\n",
" (key): Linear(in_features=768, out_features=768, bias=True)\n",
" (value): Linear(in_features=768, out_features=768, bias=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (output): BertSelfOutput(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (intermediate): BertIntermediate(\n",
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
" (intermediate_act_fn): GELUActivation()\n",
" )\n",
" (output): BertOutput(\n",
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (4): BertLayer(\n",
" (attention): BertAttention(\n",
" (self): BertSelfAttention(\n",
" (query): Linear(in_features=768, out_features=768, bias=True)\n",
" (key): Linear(in_features=768, out_features=768, bias=True)\n",
" (value): Linear(in_features=768, out_features=768, bias=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (output): BertSelfOutput(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (intermediate): BertIntermediate(\n",
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
" (intermediate_act_fn): GELUActivation()\n",
" )\n",
" (output): BertOutput(\n",
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (5): BertLayer(\n",
" (attention): BertAttention(\n",
" (self): BertSelfAttention(\n",
" (query): Linear(in_features=768, out_features=768, bias=True)\n",
" (key): Linear(in_features=768, out_features=768, bias=True)\n",
" (value): Linear(in_features=768, out_features=768, bias=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (output): BertSelfOutput(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (intermediate): BertIntermediate(\n",
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
" (intermediate_act_fn): GELUActivation()\n",
" )\n",
" (output): BertOutput(\n",
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (6): BertLayer(\n",
" (attention): BertAttention(\n",
" (self): BertSelfAttention(\n",
" (query): Linear(in_features=768, out_features=768, bias=True)\n",
" (key): Linear(in_features=768, out_features=768, bias=True)\n",
" (value): Linear(in_features=768, out_features=768, bias=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (output): BertSelfOutput(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (intermediate): BertIntermediate(\n",
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
" (intermediate_act_fn): GELUActivation()\n",
" )\n",
" (output): BertOutput(\n",
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (7): BertLayer(\n",
" (attention): BertAttention(\n",
" (self): BertSelfAttention(\n",
" (query): Linear(in_features=768, out_features=768, bias=True)\n",
" (key): Linear(in_features=768, out_features=768, bias=True)\n",
" (value): Linear(in_features=768, out_features=768, bias=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (output): BertSelfOutput(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (intermediate): BertIntermediate(\n",
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
" (intermediate_act_fn): GELUActivation()\n",
" )\n",
" (output): BertOutput(\n",
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (8): BertLayer(\n",
" (attention): BertAttention(\n",
" (self): BertSelfAttention(\n",
" (query): Linear(in_features=768, out_features=768, bias=True)\n",
" (key): Linear(in_features=768, out_features=768, bias=True)\n",
" (value): Linear(in_features=768, out_features=768, bias=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (output): BertSelfOutput(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (intermediate): BertIntermediate(\n",
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
" (intermediate_act_fn): GELUActivation()\n",
" )\n",
" (output): BertOutput(\n",
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (9): BertLayer(\n",
" (attention): BertAttention(\n",
" (self): BertSelfAttention(\n",
" (query): Linear(in_features=768, out_features=768, bias=True)\n",
" (key): Linear(in_features=768, out_features=768, bias=True)\n",
" (value): Linear(in_features=768, out_features=768, bias=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (output): BertSelfOutput(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (intermediate): BertIntermediate(\n",
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
" (intermediate_act_fn): GELUActivation()\n",
" )\n",
" (output): BertOutput(\n",
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (10): BertLayer(\n",
" (attention): BertAttention(\n",
" (self): BertSelfAttention(\n",
" (query): Linear(in_features=768, out_features=768, bias=True)\n",
" (key): Linear(in_features=768, out_features=768, bias=True)\n",
" (value): Linear(in_features=768, out_features=768, bias=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (output): BertSelfOutput(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (intermediate): BertIntermediate(\n",
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
" (intermediate_act_fn): GELUActivation()\n",
" )\n",
" (output): BertOutput(\n",
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (11): BertLayer(\n",
" (attention): BertAttention(\n",
" (self): BertSelfAttention(\n",
" (query): Linear(in_features=768, out_features=768, bias=True)\n",
" (key): Linear(in_features=768, out_features=768, bias=True)\n",
" (value): Linear(in_features=768, out_features=768, bias=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" (output): BertSelfOutput(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (intermediate): BertIntermediate(\n",
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
" (intermediate_act_fn): GELUActivation()\n",
" )\n",
" (output): BertOutput(\n",
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
" (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" )\n",
" )\n",
" (pooler): BertPooler(\n",
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
" (activation): Tanh()\n",
" )\n",
" )\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" (classifier): BertClassificationHeadCustom(\n",
" (dense_1): Linear(in_features=768, out_features=768, bias=True)\n",
" (dense_2): Linear(in_features=768, out_features=2, bias=True)\n",
" )\n",
")"
]
},
"metadata": {},
"execution_count": 28
}
]
},
{
"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",
"\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": 29,
"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",
" \n",
" return str(datetime.timedelta(seconds=elapsed_rounded))"
],
"metadata": {
"id": "Z3XSZuFmkgVr"
},
"execution_count": 30,
"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",
"\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": "QZ9H2EJNksT_",
"outputId": "ad4bce2c-b443-4fe7-fdf2-99d678821d46"
},
"execution_count": 31,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\n",
"======== Epoch 1 / 4 ========\n",
"Training...\n",
" Batch 40 of 129. Elapsed: 0:00:48.\n",
" Batch 80 of 129. Elapsed: 0:01:35.\n",
" Batch 120 of 129. Elapsed: 0:02:23.\n",
"\n",
" Average training loss: 0.13\n",
" Training epcoh took: 0:02:34\n",
"\n",
"Running Validation...\n",
" Accuracy: 0.98\n",
" Validation Loss: 0.08\n",
" Validation took: 0:00:06\n",
"\n",
"======== Epoch 2 / 4 ========\n",
"Training...\n",
" Batch 40 of 129. Elapsed: 0:00:49.\n",
" Batch 80 of 129. Elapsed: 0:01:38.\n",
" Batch 120 of 129. Elapsed: 0:02:27.\n",
"\n",
" Average training loss: 0.03\n",
" Training epcoh took: 0:02:38\n",
"\n",
"Running Validation...\n",
" Accuracy: 0.99\n",
" Validation Loss: 0.06\n",
" Validation took: 0:00:06\n",
"\n",
"======== Epoch 3 / 4 ========\n",
"Training...\n",
" Batch 40 of 129. Elapsed: 0:00:49.\n",
" Batch 80 of 129. Elapsed: 0:01:37.\n",
" Batch 120 of 129. Elapsed: 0:02:26.\n",
"\n",
" Average training loss: 0.01\n",
" Training epcoh took: 0:02:37\n",
"\n",
"Running Validation...\n",
" Accuracy: 0.99\n",
" Validation Loss: 0.06\n",
" Validation took: 0:00:06\n",
"\n",
"======== Epoch 4 / 4 ========\n",
"Training...\n",
" Batch 40 of 129. Elapsed: 0:00:49.\n",
" Batch 80 of 129. Elapsed: 0:01:37.\n",
" Batch 120 of 129. Elapsed: 0:02:26.\n",
"\n",
" Average training loss: 0.01\n",
" Training epcoh took: 0:02:36\n",
"\n",
"Running Validation...\n",
" Accuracy: 0.99\n",
" Validation Loss: 0.06\n",
" Validation took: 0:00:06\n",
"\n",
"Training complete!\n",
"Total training took 0:10:50 (h:mm:ss)\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Train summary"
],
"metadata": {
"id": "eZ1fmJMjrRgc"
}
},
{
"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": "w4ov2mClrLGW",
"outputId": "b574eb2f-90ff-47b2-ac8f-99682c9b938d"
},
"execution_count": 32,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" Training Loss Valid. Loss Valid. Accur. Training Time Validation Time\n",
"epoch \n",
"1 1.26e-01 0.08 0.98 0:02:34 0:00:06\n",
"2 2.58e-02 0.06 0.99 0:02:38 0:00:06\n",
"3 1.26e-02 0.06 0.99 0:02:37 0:00:06\n",
"4 9.73e-03 0.06 0.99 0:02:36 0:00:06"
],
"text/html": [
"\n",
" <div id=\"df-e3d8028e-4cc3-459b-812f-23955d700883\">\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>1.26e-01</td>\n",
" <td>0.08</td>\n",
" <td>0.98</td>\n",
" <td>0:02:34</td>\n",
" <td>0:00:06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2.58e-02</td>\n",
" <td>0.06</td>\n",
" <td>0.99</td>\n",
" <td>0:02:38</td>\n",
" <td>0:00:06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1.26e-02</td>\n",
" <td>0.06</td>\n",
" <td>0.99</td>\n",
" <td>0:02:37</td>\n",
" <td>0:00:06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>9.73e-03</td>\n",
" <td>0.06</td>\n",
" <td>0.99</td>\n",
" <td>0:02:36</td>\n",
" <td>0:00:06</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-e3d8028e-4cc3-459b-812f-23955d700883')\"\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-e3d8028e-4cc3-459b-812f-23955d700883 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-e3d8028e-4cc3-459b-812f-23955d700883');\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": 32
}
]
},
{
"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": "4Jg3MOeZrTf9",
"outputId": "bb270a48-8d19-4854-a074-2845da4ee513"
},
"execution_count": 33,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"<Figure size 864x432 with 1 Axes>"
],
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAvAAAAGaCAYAAABpIXfbAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdd0BTV/sH8G9CCHsPQbYgQ5Zo3bRWXLgX7jpbR6u2P61vq6+127avtXXU6ttaW611Czhx4mi1jqLWyVBwoYAIMmUkJL8/KHmNoAYI3IDfzz9tzr3n3ieB0z65POcckVKpVIKIiIiIiBoEsdABEBERERGR5pjAExERERE1IEzgiYiIiIgaECbwREREREQNCBN4IiIiIqIGhAk8EREREVEDwgSeiF54qamp8PHxwXfffVfja8yZMwc+Pj5ajKrxetrn7ePjgzlz5mh0je+++w4+Pj5ITU3VenxRUVHw8fHB6dOntX5tIiJtkAgdABHRk6qTCMfGxsLZ2bkOo2l4Hj16hP/+97+IiYnB/fv3YW1tjdatW+Ott96Cp6enRtd4++23sX//fmzfvh1+fn5VnqNUKtG1a1fk5eXh+PHjMDQ01ObbqFOnT5/GmTNnMG7cOJibmwsdTiWpqano2rUrRo8ejQ8//FDocIhIxzCBJyKds3DhQrXXZ8+exebNmzF8+HC0bt1a7Zi1tXWt7+fk5ISLFy9CT0+vxtf47LPP8Mknn9Q6Fm344IMPsGfPHvTt2xdt27ZFZmYmDh8+jAsXLmicwEdERGD//v2IjIzEBx98UOU5p06dwt27dzF8+HCtJO8XL16EWFw/fxg+c+YMli9fjkGDBlVK4AcMGIA+ffpAX1+/XmIhIqouJvBEpHMGDBig9rqsrAybN29Gy5YtKx17UkFBAUxNTat1P5FIBAMDg2rH+ThdSfaKioqwb98+hIaG4ptvvlG1T58+HaWlpRpfJzQ0FI6Ojti1axfee+89SKXSSudERUUBKE/2taG2PwNt0dPTq9WXOSKiusYaeCJqsMLCwjBmzBhcvXoVr7/+Olq3bo3+/fsDKE/kFy9ejKFDh6Jdu3YICAhA9+7dsWjRIhQVFaldp6qa7Mfbjhw5giFDhiAwMBChoaH4z3/+A7lcrnaNqmrgK9ry8/Px0UcfoUOHDggMDMSIESNw4cKFSu/n4cOHmDt3Ltq1a4eQkBCMHTsWV69exZgxYxAWFqbRZyISiSASiar8QlFVEv40YrEYgwYNQk5ODg4fPlzpeEFBAQ4cOABvb28EBQVV6/N+mqpq4BUKBX744QeEhYUhMDAQffv2xc6dO6vsn5ycjI8//hh9+vRBSEgIgoODMXjwYGzdulXtvDlz5mD58uUAgK5du8LHx0ft5/+0Gvjs7Gx88skn6Ny5MwICAtC5c2d88sknePjwodp5Ff1PnjyJ1atXo1u3bggICEDPnj0RHR2t0WdRHQkJCZg2bRratWuHwMBA9O7dG6tWrUJZWZnaeWlpaZg7dy66dOmCgIAAdOjQASNGjFCLSaFQYM2aNejXrx9CQkLQqlUr9OzZE//+978hk8m0HjsR1QyfwBNRg3bv3j2MGzcO4eHh6NGjBx49egQAyMjIwLZt29CjRw/07dsXEokEZ86cwU8//YT4+HisXr1ao+sfO3YMGzZswIgRIzBkyBDExsbi559/hoWFBaZOnarRNV5//XVYW1tj2rRpyMnJwS+//ILJkycjNjZW9deC0tJSTJgwAfHx8Rg8eDACAwORmJiICRMmwMLCQuPPw9DQEAMHDkRkZCR2796Nvn37atz3SYMHD8bKlSsRFRWF8PBwtWN79uxBcXExhgwZAkB7n/eTvvzyS/z6669o06YNxo8fj6ysLHz66adwcXGpdO6ZM2cQFxeHV199Fc7Ozqq/RnzwwQfIzs7GlClTAADDhw9HQUEBDh48iLlz58LKygrAs+de5OfnY+TIkbh16xaGDBmCFi1aID4+Hhs3bsSpU6ewdevWSn/5Wbx4MYqLizF8+HBIpVJs3LgRc+bMgaura6VSsJq6dOkSxowZA4lEgtGjR8PW1hZHjhzBokWLkJCQoPorjFwux4QJE5CRkYFRo0bB3d0dBQUFSExMRFxcHAYNGgQAWLlyJZYtW4YuXbpgxIgR0NPTQ2pqKg4fPozS0lKd+UsT0QtPSUSk4yIjI5Xe3t7KyMhItfYuXboovb29lVu2bKnUp6SkRFlaWlqpffHixUpvb2/lhQsXVG137txRent7K5ctW1apLTg4WHnnzh1Vu0KhUPbp00fZqVMnteu+//77Sm9v7yrbPvroI7X2mJgYpbe3t3Ljxo2qtt9++03p7e2tXLFihdq5Fe1dunSp9F6qkp+fr5w0aZIyICBA2aJFC+WePXs06vc0Y8eOVfr5+SkzMjLU2ocNG6b09/dXZmVlKZXK2n/eSqVS6e3trXz//fdVr5OTk5U+Pj7KsWPHKuVyuar98uXLSh8fH6W3t7faz6awsLDS/cvKypSvvfaaslWrVmrxLVu2rFL/ChW/b6dOnVK1ffvtt0pvb2/lb7/9pnZuxc9n8eLFlfoPGDBAWVJSompPT09X+vv7K2fOnFnpnk+q+Iw++eSTZ543fPhwpZ+fnzI+Pl7VplAolG+//bbS29tb+eeffyqVSqUyPj5e6e3trfzxxx+feb2BAwcqe/Xq9dz4iEhYLKEhogbN0tISgwcPrtQulUpVTwvlcjlyc3ORnZ2Njh07AkCVJSxV6dq1q9oqNyKRCO3atUNmZiYKCws1usb48ePVXrdv3x4AcOvWLVXbkSNHoKenh7Fjx6qdO3ToUJiZmWl0H4VCgXfeeQcJCQnYu3cvXnnlFcyePRu7du1SO2/+/Pnw9/fXqCY+IiICZWVl2L59u6otOTkZf//9N8LCwlSTiLX1eT8uNjYWSqUSEyZMUKtJ9/f3R6dOnSqdb2xsrPr3kpISPHz4EDk5OejUqRMKCgqQkpJS7RgqHDx4ENbW1hg+fLha+/Dhw2FtbY1Dhw5V6jNq1Ci1sqUmTZrAw8MDN2/erHEcj8vKysL58+cRFhYGX19fVbtIJMKbb76pihuA6nfo9OnTyMrKeuo1TU1NkZGRgbi4OK3ESER1gyU0RNSgubi4PHXC4fr167Fp0yZcv34dCoVC7Vhubq7G13+SpaUlACAnJwcmJibVvkZFyUZOTo6qLTU1Ffb29pWuJ5VK4ezsjLy8vOfeJzY2FsePH8fXX38NZ2dnLF26FNOnT8d7770HuVyuKpNITExEYGCgRjXxPXr0gLm5OaKiojB58mQAQGRkJACoymcqaOPzftydO3cAAM2aNat0zNPTE8ePH1drKywsxPLly7F3716kpaVV6qPJZ/g0qampCAgIgESi/r9NiUQCd3d3XL16tVKfp/3u3L17t8ZxPBkTAHh5eVU61qxZM4jFYtVn6OTkhKlTp+LHH39EaGgo/Pz80L59e4SHhyMoKEjVb9asWZg2bRpGjx4Ne3t7tG3bFq+++ip69uxZrTkURFS3mMATUYNmZGRUZfsvv/yCr776CqGhoRg7dizs7e2hr6+PjIwMzJkzB0qlUqPrP2s1ktpeQ9P+mqqYdNmmTRsA5cn/8uXL8eabb2Lu3LmQy+Xw9fXFhQsXsGDBAo2uaWBggL59+2LDhg04d+4cgoODsXPnTjg4OODll19Wnaetz7s23n33XRw9ehTDhg1DmzZtYGlpCT09PRw7dgxr1qyp9KWirtXXkpiamjlzJiIiInD06FHExcVh27ZtWL16Nd544w3861//AgCEhITg4MGDOH78OE6fPo3Tp09j9+7dWLlyJTZs2KD68kpEwmICT0SN0o4dO+Dk5IRVq1apJVK///67gFE9nZOTE06ePInCwkK1p/AymQypqakabTZU8T7v3r0LR0dHAOVJ/IoVKzB16lTMnz8fTk5O8Pb2xsCBAzWOLSIiAhs2bEBUVBRyc3ORmZmJqVOnqn2udfF5VzzBTklJgaurq9qx5ORktdd5eXk4evQoBgwYgE8//VTt2J9//lnp2iKRq
},
"metadata": {}
}
]
},
{
"cell_type": "markdown",
"source": [
"# Create test loader"
],
"metadata": {
"id": "kn87qhtR9MP4"
}
},
{
"cell_type": "code",
"source": [
"prediction_dataloader = DataLoader(\n",
" test_dataset,\n",
" sampler = SequentialSampler(test_dataset),\n",
" batch_size = batch_size\n",
" )"
],
"metadata": {
"id": "ENqiBZio9a7a"
},
"execution_count": 34,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Evaluate on test dataset"
],
"metadata": {
"id": "dAF9Iqol-kAP"
}
},
{
"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": "XXCWIk8c9Oun",
"outputId": "6f187c3f-7a21-4cb8-b2c1-b738fdcf9cf9"
},
"execution_count": 35,
"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": "TVIFBFmFEwNv",
"outputId": "6e8909c3-9337-4de4-f268-c1fa957d3e81"
},
"execution_count": 36,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Correct predictions: 995, incorrect results: 5, accuracy: 0.995\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# MCC Score"
],
"metadata": {
"id": "6gTgKchs_OXY"
}
},
{
"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": "hOelDEdn_QDE",
"outputId": "a56f6011-7da3-43e0-98bb-d3193036d5e0"
},
"execution_count": 37,
"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": "cF34A88N_UgQ",
"outputId": "8922ba13-2295-481d-9e14-2b75fed302da"
},
"execution_count": 38,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"<Figure size 864x432 with 1 Axes>"
],
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAuUAAAGaCAYAAACopj13AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdeXyNZ/7/8ffJLgkSaaKKoIjYYi2lVKkl9i2UIpYWVTqtfnXCt792ZjqdUhQdtJa2SihFEinGUtrpYi8qVChqCZlyLAlJREjO7w9fmcZJjpPkxE3yej4eHpXrvq/P/Tk5SfrO7TrXMVksFosAAAAAGMbJ6AYAAACAko5QDgAAABiMUA4AAAAYjFAOAAAAGIxQDgAAABiMUA4AAAAYjFAOAMADYsiQIWrXrp3RbQAwgIvRDQBAYe3atUvh4eGSpEGDBuntt9+2OufSpUtq06aNbt68qWbNmikyMtLqnIMHD2rZsmXas2ePzGaznJycVKlSJbVo0UIDBgxQ9erVc5x//fp1ffnll9q8ebOOHz+u1NRUlS1bVnXr1lXnzp3Vo0cPubjY/jF77do1RUZGatOmTTp37pwyMzPl6+ur4OBgtW3bVv369SvEZwZ3a9eunc6dO5f9sclkkp+fn6pVq6aBAweqa9euBa69ZcsWxcfH65VXXnFEqwBKGEI5gGLD3d1d69at08SJE+Xm5pbjWGxsrCwWS54hec6cOZozZ458fX3VrVs31ahRQ1lZWTp+/Lg2bNigZcuWaffu3fL29pYknT59WqNGjdKpU6fUsmVLjRo1Sr6+vrp06ZJ27NihSZMm6fjx4/rzn/+cZ78pKSkKCwtTQkKCOnXqpL59+8rV1VUJCQnat2+flixZQigvAo8++qhef/11SVJWVpbOnz+vmJgYvf766zKbzRo2bFiB6m7ZskUxMTGEcgAFQigHUGx06NBB69at05YtW9SlS5ccx6Kjo/X0009r586dVvNWr16t2bNnq3nz5po7d65Kly6d4/gbb7yhOXPmZH+cnp6u0aNH6+zZs5o9e7Y6duyY4/xRo0YpLi5OBw8etNnvypUrderUKf3v//6vhg4danXcbDbf8zEXhZSUlOxfPh4mFotFaWlp8vLysnle6dKl1bNnzxxjzz33nFq3bq3o6OgCh3IAKAzWlAMoNurUqaNatWopOjo6x3hcXJyOHTumvn37Ws3JyMjQrFmz5OnpqVmzZlkFckny8PDQhAkTsoPqqlWrdPLkSQ0fPtwqkN8REhKiQYMG2ez31KlTkqQWLVrketzf399q7PTp05o0aZKefvpp1atXT61atdKYMWN06NChHOdt2bJFAwYMUMOGDdWoUSMNGDBAW7ZssarXrl07DRkyRIcPH9YLL7ygJk2aqEePHjl6fOONN9SqVSvVq1dP7dq10/vvv6+0tDSbj+3u+r/88ovCw8PVqFEjNWvWTBEREbp06ZLV+RkZGZo3b566du2q+vXrq2nTpnrppZd0+PDhHOft2rUr+7letmyZunTpovr16+uzzz6zq6+7lS1bVm5ubnJ1dc0xHhcXp4kTJ6pTp05q0KBB9ufy66+/znHekCFDFBMTI0mqVatW9p8/fi2azWa9++67evbZZ1WvXj21aNFCw4cP17Zt26z6OX/+vF5//XU98cQTatCggV544QWdPHmyQI8NwMOBO+UAipW+fftqypQpOn/+vMqXLy/p9p1wPz8/PfPMM1bn79u3T2azWT179lS5cuXsusamTZsk3b67WhiBgYGSbt/FnzBhwj3Xnx88eFDDhg3TrVu3FBYWppo1ayo5OVm7d+/W/v37Va9ePUnSsmXL9M477+jxxx/Xyy+/LEmKiYnR2LFj9c4771j1nZiYqKFDhyo0NFQdO3bMDtyHDh3S0KFDVaZMGT333HMqX768jhw5osjISO3fv1+RkZFWITY3v//+u4YNG6aOHTuqU6dOOnz4sKKionTo0CGtXr1apUqVkiTdvHlTL7zwgvbv36+ePXtq0KBBSklJ0cqVKzVw4EAtXbpU9evXz1F78eLFSkpKUr9+/eTv769HH330nv1kZmbq8uXLkm4vXzGbzVqyZIlSU1M1YMCAHOd+/fXX+u233xQaGqqKFSsqKSlJMTExGjdunKZPn67u3btLkl566SVlZWXpp59+0tSpU7PnN27cWJJ09uxZDRw4UJcuXVLPnj1Vr149Xb9+XQcOHND27dv11FNPZc9JS0vT4MGD1aBBA40fP15nz57VkiVL9PLLL2vdunVydna+52ME8BCyAMBDbufOnZagoCDLJ598Yrl8+bKlbt26lo8//thisVgs169ftzRp0sQyZcoUi8VisTRs2NAyePDg7LlLliyxBAUFWT777DO7r9esWTNL48aNC913UlKSpU2bNpagoCBLixYtLK+88opl/vz5lj179lgyMzNznJuVlWXp2rWrpV69epb4+HirWnfOT0pKsjRs2NDSvn17y7Vr17KPX7t2zfLss89aGjZsaElOTs4eb9u2rSUoKMiycuVKq5rdu3e3dOrUKUcdi8Vi2bx5syUoKMgSFRV1z8d4p/6iRYtyjC9atMgSFBRkmT9/vtXY999/n+Pca9euWdq0aZPjebvznD/xxBOWixcv3rOPu/u5+0/9+vUtK1assDo/NTXVaiwtLc3SsWNHS+fOnXOMR0REWIKCgnK97osvvpjrY7NYLDme68GDB1uCgoIsCxYsyHHOwoUL85wPoHhg+QqAYsXX11ft2rXLXkqwefNmXbt2LdelK9Lt9dOS8rWGOiUl5Z7rlu1RtmxZRUdHa+TIkSpdurQ2bdqkDz74QIMGDVL79u31448/Zp8bHx+vY8eOqU+fPgoODraq5eR0+8f5tm3blJaWpiFDhuR4TN7e3hoyZIjS0tK0ffv2HHN9fHzUp0+fHGNHjx7V0aNH1a1bN2VkZOjy5cvZf5o0aSJPT89cl13kxtvbW88//3yOseeff17e3t45loF89dVXevzxx1W3bt0c18vIyFDLli21d+9epaen56jTs2dP+fn52dXHHRUrVtSiRYu0aNEiffbZZ5oyZYoaNGigv/71r4qKispxrqenZ/bfr1+/ritXruj69et68skndeLEieyvH1uSkpL0ww8/qHXr1mrdurXV8TvP3R8/vrOb0B1PPvmkpNvLlwAUTyxfAVDs9O3bV6NGjdJPP/2kqKgohYSEqEaNGrmeeye4pqam2l3f29s7X+fbUq5cOU2YMEETJkzQlStX9PPPP2vDhg366quvNG7cOMXGxqpKlSrZ68/r1Kljs97Zs2clSTVr1rQ6dmcsISEhx3jlypWtlkScOHFCkjR79mzNnj0712tdvHjx3g/w/+rfvRuOm5ubKleunKOXEydOKD09Pc819pJ05coVVahQIfvjqlWr2tXDH3l6eqply5Y5xrp3767evXvr3XffVbt27eTr6yvp9laas2bN0tatW3NdA3/16tV7/kJ35swZWSyWez53dwQEBMjd3T3HmI+Pj6TbAR9A8UQoB1DstGrVSuXLl9fcuXO1a9cu/fWvf83z3DtB9e4XEtpSs2ZN7dmzRwkJCapcuXJh283m6+urtm3bqm3btqpQoYLmzZun9evXZ68LLyp31nTnZsSIEbne3ZWkMmXKOLQPi8WioKAgTZo0Kc9z7l73b6v3/HBxcdGTTz6pJUuWKC4uTm3atJHFYtGIESN04sQJhYeHq169eipdurScnZ0VFRWldevWKSsryyHX/yNba8YtFovDrwfgwUAoB1DsODs7q1evXpo/f748PDzUrVu3PM9t3Lix/P39tWXLFl25ciX7DqktHTt21J49e7Rq1ars/a4drUGDBpJu78IhSdWqVZN0exmLLXd+STh27JjVHefjx4/nOMeWKlWqSLq9lOLuu8r5lZCQoIyMjBx3yzMyMpSQkKDHH388xzWvXLmiJ5980mpJx/1w69YtSf/9V5OjR4/qyJEjGjt2rP70pz/lOHfVqlVW800mU651AwMDZTKZ7vncASjZWFMOoFgaMGCAxo0bp7/97
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"flat_predictions = np.concatenate(predictions, axis=0)\n",
"\n",
"flat_predictions = np.argmax(flat_predictions, axis=1).flatten()\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": "vx_SM19o_XqD",
"outputId": "692cc582-19fc-468e-8098-f2287a45b1d2"
},
"execution_count": 39,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Total MCC: 0.981\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Save model"
],
"metadata": {
"id": "ZE7xxmFJ-oBM"
}
},
{
"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/BERT_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)\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "fJAqcU8F-p2Z",
"outputId": "802ac1fd-b8de-4cec-b146-f3044a836c3f"
},
"execution_count": 40,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Mounted at /content/gdrive/\n",
"Saving model to /content/gdrive/My Drive/UAM/Przetwarzanie-tekstu/BERT_custom_model\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"('/content/gdrive/My Drive/UAM/Przetwarzanie-tekstu/BERT_custom_model/tokenizer_config.json',\n",
" '/content/gdrive/My Drive/UAM/Przetwarzanie-tekstu/BERT_custom_model/special_tokens_map.json',\n",
" '/content/gdrive/My Drive/UAM/Przetwarzanie-tekstu/BERT_custom_model/vocab.txt',\n",
" '/content/gdrive/My Drive/UAM/Przetwarzanie-tekstu/BERT_custom_model/added_tokens.json')"
]
},
"metadata": {},
"execution_count": 40
}
]
},
{
"cell_type": "markdown",
"source": [
"# Bibliografia\n",
"https://mccormickml.com/2019/07/22/BERT-fine-tuning/#a1-saving--loading-fine-tuned-model"
],
"metadata": {
"id": "6pFz8n_aHca9"
}
}
]
}