Skip to content

Instantly share code, notes, and snippets.

@AmalVijayan
Created December 3, 2019 10:03
Show Gist options
  • Save AmalVijayan/a6d89ca51a669406c88e9b4464a7a394 to your computer and use it in GitHub Desktop.
Save AmalVijayan/a6d89ca51a669406c88e9b4464a7a394 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Article-Transformers-2-Full.ipynb",
"provenance": [],
"collapsed_sections": [
"ldR92A8iambT"
]
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"accelerator": "GPU",
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"e4e8b97316194520a65dc913eed00ff3": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_ad9f3c2d611f443791dbfbf59f61a158",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_70a193772ae541738ea455db2caf053c",
"IPY_MODEL_b76f9f2555c14381b633916d86400c08"
]
}
},
"ad9f3c2d611f443791dbfbf59f61a158": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"70a193772ae541738ea455db2caf053c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_317984b6c85c42d7ba49fb99af479ee2",
"_dom_classes": [],
"description": "",
"_model_name": "IntProgressModel",
"bar_style": "success",
"max": 1220,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 1220,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_6038ff16f4d5471498ce1318c1fb6809"
}
},
"b76f9f2555c14381b633916d86400c08": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_475fdd29e518456f9c9ccff7698c2e07",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100% 1220/1220 [00:02<00:00, 522.07it/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_eef1818ed8b148ba8ac88db784f05d7f"
}
},
"317984b6c85c42d7ba49fb99af479ee2": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"6038ff16f4d5471498ce1318c1fb6809": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"475fdd29e518456f9c9ccff7698c2e07": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"eef1818ed8b148ba8ac88db784f05d7f": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"335749ca463f40c79371bd7cd7e0687c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_1510ff2c3845423aa5f98accd0ace8ff",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_94e55193d52442dc87fe66f9acd77784",
"IPY_MODEL_11060983edfd4a78957b3f9044fd0613"
]
}
},
"1510ff2c3845423aa5f98accd0ace8ff": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"94e55193d52442dc87fe66f9acd77784": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_51830891d2744e86b13fe88dada8e9e8",
"_dom_classes": [],
"description": "Epoch",
"_model_name": "IntProgressModel",
"bar_style": "success",
"max": 1,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 1,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_7b568fac3f3d423b8fb9e3f2ae3525e2"
}
},
"11060983edfd4a78957b3f9044fd0613": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_6631803c55514837ad31173708d700bc",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100% 1/1 [31:37<00:00, 1897.11s/it]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_10667ed382824fa98647c32a2a917262"
}
},
"51830891d2744e86b13fe88dada8e9e8": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "initial",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"7b568fac3f3d423b8fb9e3f2ae3525e2": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"6631803c55514837ad31173708d700bc": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"10667ed382824fa98647c32a2a917262": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"1eaa2c8e5ccc4265ab02ba3d410eb2df": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_142bfa4e30204d37b3cda6f858d111c3",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_41957ee1ce1c4499b6a9e1d28235ebe3",
"IPY_MODEL_11a9236309e34951ab6cec14fda22ca0"
]
}
},
"142bfa4e30204d37b3cda6f858d111c3": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"41957ee1ce1c4499b6a9e1d28235ebe3": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_864abf88549c4dd7a9ae3ea0b5eade82",
"_dom_classes": [],
"description": "Current iteration",
"_model_name": "IntProgressModel",
"bar_style": "success",
"max": 153,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 153,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_0594029c15394beb9a5a7f446a6d6502"
}
},
"11a9236309e34951ab6cec14fda22ca0": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_c6d2fbc87d584e40b1f74af90c0f6ab1",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100% 153/153 [31:37<00:00, 11.14s/it]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_9337de477b4e4fe6a433de25be9141dc"
}
},
"864abf88549c4dd7a9ae3ea0b5eade82": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "initial",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"0594029c15394beb9a5a7f446a6d6502": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"c6d2fbc87d584e40b1f74af90c0f6ab1": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"9337de477b4e4fe6a433de25be9141dc": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"323de9110ad345578ad7e8e1c284d127": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_bd00d2af01da43af903297deefd53826",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_f7a889c346a84708bc26151f91b76b2d",
"IPY_MODEL_1e21c90295944a1fbed3b7a9748ae117"
]
}
},
"bd00d2af01da43af903297deefd53826": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"f7a889c346a84708bc26151f91b76b2d": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_0574eb092a8c4f3e8c39afb7ae224d74",
"_dom_classes": [],
"description": "",
"_model_name": "IntProgressModel",
"bar_style": "success",
"max": 39,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 39,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_fd82986701324031b51acbdc8778a9e2"
}
},
"1e21c90295944a1fbed3b7a9748ae117": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_8b335c135a5241f99aa31c76b3433b0c",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100% 39/39 [02:00<00:00, 2.42s/it]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_63858c73d2364b5aa47d187a98672506"
}
},
"0574eb092a8c4f3e8c39afb7ae224d74": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"fd82986701324031b51acbdc8778a9e2": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"8b335c135a5241f99aa31c76b3433b0c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"63858c73d2364b5aa47d187a98672506": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"d8a96255ffd148ec95a98d65277c6c44": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_533f26d9e8874c588ad77c55dc96d239",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_82ad6017fd6a40589768e684d2dffad4",
"IPY_MODEL_1c97fab9c479447197c34debb2e7a734"
]
}
},
"533f26d9e8874c588ad77c55dc96d239": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"82ad6017fd6a40589768e684d2dffad4": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_297048966d254eea8f1b91036873f770",
"_dom_classes": [],
"description": "",
"_model_name": "IntProgressModel",
"bar_style": "success",
"max": 39,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 39,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_ae09005b8ddf40fe8520f9cb5f33cf4b"
}
},
"1c97fab9c479447197c34debb2e7a734": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_f3f480f6b2e848deb9e9ffdabac01b7c",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100% 39/39 [01:59<00:00, 2.40s/it]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_935571c90f14487b91056789d4a318b5"
}
},
"297048966d254eea8f1b91036873f770": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"ae09005b8ddf40fe8520f9cb5f33cf4b": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"f3f480f6b2e848deb9e9ffdabac01b7c": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"935571c90f14487b91056789d4a318b5": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"f00e2daaca2340d9b604d19a5a054efc": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_74c46e816d4c4b4ea617bcc981891f07",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_6366706d4ee544d49c650f072ec7b09a",
"IPY_MODEL_39ab01079c1945788d32ebc3d940b3c8"
]
}
},
"74c46e816d4c4b4ea617bcc981891f07": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"6366706d4ee544d49c650f072ec7b09a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_d2c86f0cb4704da9a65e3c5530ec0089",
"_dom_classes": [],
"description": "",
"_model_name": "IntProgressModel",
"bar_style": "success",
"max": 1,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 1,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_f15a59992056476e8b030749820dd5de"
}
},
"39ab01079c1945788d32ebc3d940b3c8": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_60f360abf76c493d9a750914f84b1771",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100% 1/1 [00:00<00:00, 9.50it/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_6e2a6e53d33c4de1897efe0f8f756d6a"
}
},
"d2c86f0cb4704da9a65e3c5530ec0089": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"f15a59992056476e8b030749820dd5de": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"60f360abf76c493d9a750914f84b1771": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"6e2a6e53d33c4de1897efe0f8f756d6a": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"413e17a3b372472c93a771b1f87d1af1": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_d7d787296ace4eb2a6130d82ef6f29e6",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_9caac6ef50f64e7792636ad62b916a71",
"IPY_MODEL_ecfe8bd01d1b4ee88f6a4e6ea47fda2f"
]
}
},
"d7d787296ace4eb2a6130d82ef6f29e6": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"9caac6ef50f64e7792636ad62b916a71": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_a2af0a80ac604ded851df699fde89fb0",
"_dom_classes": [],
"description": "",
"_model_name": "IntProgressModel",
"bar_style": "success",
"max": 1,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 1,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_82b95e619d02460ba7a09cac8e39bc33"
}
},
"ecfe8bd01d1b4ee88f6a4e6ea47fda2f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_6c641edbe63e496fa52c43f97629fe06",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100% 1/1 [00:00<00:00, 2.02it/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_7a18e294a9ae44e6a1d2a438280de740"
}
},
"a2af0a80ac604ded851df699fde89fb0": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"82b95e619d02460ba7a09cac8e39bc33": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"6c641edbe63e496fa52c43f97629fe06": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"7a18e294a9ae44e6a1d2a438280de740": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"0ddbc0b87f8f4fb59751d46dcac24606": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_71154ce4fd854056bb37c6eeff5aa28a",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_8b80b399024743ceaeba7a9eb82c2b6a",
"IPY_MODEL_e5f04daf2b124da8a8c8d56ba5f5e478"
]
}
},
"71154ce4fd854056bb37c6eeff5aa28a": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"8b80b399024743ceaeba7a9eb82c2b6a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_dc54f05812024b6db04166972bdbfc5f",
"_dom_classes": [],
"description": "",
"_model_name": "IntProgressModel",
"bar_style": "success",
"max": 1,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 1,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_e33e4c1cb77a487097afbe07e90fd68f"
}
},
"e5f04daf2b124da8a8c8d56ba5f5e478": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_f7799569aaf74d2da3a886a5bfae0bc1",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100% 1/1 [00:00<00:00, 10.14it/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_8d088d2649ac420fb0c84869b0593144"
}
},
"dc54f05812024b6db04166972bdbfc5f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"e33e4c1cb77a487097afbe07e90fd68f": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"f7799569aaf74d2da3a886a5bfae0bc1": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"8d088d2649ac420fb0c84869b0593144": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"69143d8cf8494e91b995bc8971c9dfbe": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_cbf28b3b9a794359bafd09e72aa9c2df",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_a88be4f1eb5a4171a6e451170ab2cbc4",
"IPY_MODEL_bb2194d933004220925fd1a2768544fa"
]
}
},
"cbf28b3b9a794359bafd09e72aa9c2df": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"a88be4f1eb5a4171a6e451170ab2cbc4": {
"model_module": "@jupyter-widgets/controls",
"model_name": "IntProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_8ffeadaf4e6941a08ed51132050210b2",
"_dom_classes": [],
"description": "",
"_model_name": "IntProgressModel",
"bar_style": "success",
"max": 1,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 1,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_0fd92e1085a0413788b541d47464e703"
}
},
"bb2194d933004220925fd1a2768544fa": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_8f34124f5ddb44b68b928f0ac270a59a",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100% 1/1 [00:00<00:00, 2.03it/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_baba703542a14a6996cf93de0d93fcb1"
}
},
"8ffeadaf4e6941a08ed51132050210b2": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"0fd92e1085a0413788b541d47464e703": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"8f34124f5ddb44b68b928f0ac270a59a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"state": {
"_view_name": "StyleView",
"_model_name": "DescriptionStyleModel",
"description_width": "",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"_model_module": "@jupyter-widgets/controls"
}
},
"baba703542a14a6996cf93de0d93fcb1": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
}
}
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "ldR92A8iambT",
"colab_type": "text"
},
"source": [
"#Multi-Class Classification Using Simple Transformers\n",
"\n",
"---\n",
"\n",
"In the past few years we have seen tremendous improvements in the ability of machines to deal with Natural languages. We saw algorithms breaking the state-of-the-art one after the other on a variety of language specific tasks, all thanks to transformers. In this article we will discuss and implement transformers in the simplest way possible using a library called Simple Transformers.\n",
"\n",
"##The Seq2Seq Model\n",
"\n",
"Before stepping into the transformers’ territory let's take a brief look at the Sequence-to-Sequence models.\n",
"\n",
"The Sequence-to-Sequence model (seq2seq) converts a given sequence of text of fixed length into another sequence of fixed length, which we can easily relate to machine translation. But Seq2seq is not just limited to translation, in fact it is quite efficient in tasks that require text generation.The model uses an encoder-decoder architecture and has been very successful in machine translation and question answering tasks.It uses a stack of Long Short Term Memory(LSTM) networks or Gated Recurrent Units(GRU) in encoders and decoders.\n",
"\n",
"Here is a simple demonstration of Seq2Seq model:\n",
"\n",
"![alt text](https://analyticsindiamag.com/wp-content/uploads/2019/12/seq-seq_aim.png)\n",
"\n",
"Image Source : [A ten-minute introduction to sequence-to-sequence learning in Keras](https://blog.keras.io/a-ten-minute-introduction-to-sequence-to-sequence-learning-in-keras.html)\n",
"\n",
"One major drawback of the Seq2Seq model comes from the limitation of it’s underlying RNNs. Though LSTMs are meant to deal with long term dependencies between the word vectors the performance drops as the distance increases. The model also restricts parallelization.\n",
"\n",
"##Transformer Architecture \n",
"\n",
"The transformer model introduces an architecture that is solely based on attention mechanism and does not use any Recurrent Networks but yet produces results superior in quality to Seq2Seq models.It addresses the long term dependency problem of the Seq2Seq model.The transformer architecture is also parallelizable and the training process is considerably faster.\n",
"\n",
"![alt text](https://analyticsindiamag.com/wp-content/uploads/2019/12/transformer_architecture_aim.png)\n",
"\n",
"Image Source : [Attention Is All You Need](https://arxiv.org/pdf/1706.03762.pdf)\n",
"\n",
"\n",
"Let's take a look at some of the important features :\n",
"\n",
"* Encoder: The encoder has 6 identical layers in which each layer consists of a multi-head self-attention mechanism and a fully connected feed-forward network. The multi head attention system and feed-forward network both has a residual connection and a normalization layer. \n",
"\n",
"* Decoder: The decoder also consists of 6 identical layers with an additional sublayer in each of the 6 layers. The additional sublayer performs multi-head attention over the output of the encoder stack.\n",
"\n",
"* Attention Mechanism: \n",
"\n",
"Attention is the mapping of a query and a set of key-value pairs to an output, where the query, keys, values, and output are all vectors.The attention mechanism allows the model to understand the context of a text. \n",
"\n",
"* Scaled Dot-Product Attention:\n",
"\n",
"![alt text](https://analyticsindiamag.com/wp-content/uploads/2019/12/scaled_dot_attention_aim.png)\n",
"\n",
"* Multi-Head Attention:\n",
"\n",
"![alt text](https://analyticsindiamag.com/wp-content/uploads/2019/12/multi-head-attention_aim.png)\n",
"\n",
"\n",
"![alt text](https://analyticsindiamag.com/wp-content/uploads/2019/12/self-attention_aim.png)\n",
"Image Source : [Attention Is All You Need](https://arxiv.org/pdf/1706.03762.pdf)\n",
"\n",
"The transformer architecture is a breakthrough in the NLP spectrum giving rise to many state-of-the-art algorithms such as Google’s BERT, RobertA, OpenGPT and many others.\n",
"\n",
"\n",
"---\n",
"\n",
"\n",
"In this hands-on session, you will be introduced to Simple Transformers library. The library is built on top of the popular huggingface transformers library which consists of implementations of various transformer based models and algorithms.\n",
"\n",
"The library makes it effortless to implement various language modeling tasks such as Simple Transformers currently supports tasks such as Sequence Classification, Token Classification (NER), and Question Answering. \n",
"\n",
"So without further ado let's get our hands dirty !\n",
"\n",
"##About The Dataset - [Predict The News Category Hackathon](https://www.machinehack.com/course/predict-the-news-category-hackathon/)\n",
"\n",
"From the beginning, since the first printed newspaper, every news that makes into a page has had a specific section allotted to it. Although pretty much everything changed in newspapers from the ink to the type of paper used, this proper categorization of news was carried over by generations and even to the digital versions of the newspaper. Newspaper articles are not limited to a few topics or subjects, it covers a wide range of interests from politics to sports to movies and so on. For long, this process of sectioning was done manually by people but now technology can do it without much effort. In this hackathon, Data Science and Machine Learning enthusiasts like you will use Natural Language Processing to predict which genre or category a piece of news will fall in to from the story.\n",
"\n",
"* Size of training set: 7,628 records\n",
"* Size of test set: 2,748 records\n",
"\n",
"FEATURES:\n",
"\n",
"* STORY: A part of the main content of the article to be published as a piece of news.\n",
"* SECTION: The genre/category the STORY falls in.\n",
"\n",
"There are four distinct sections where each story may fall in to. The Sections are labelled as follows :\n",
"\n",
"* Politics: 0\n",
"* Technology: 1\n",
"* Entertainment: 2\n",
"* Business: 3\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "bVhe4dBaa8Ln",
"colab_type": "text"
},
"source": [
"##Mounting Google Drive"
]
},
{
"cell_type": "code",
"metadata": {
"id": "hml6o8_YNYWq",
"colab_type": "code",
"outputId": "5fc10294-41d9-45b7-f99d-6306cbb50cdd",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 122
}
},
"source": [
"from google.colab import drive\n",
"drive.mount(\"/GD\")"
],
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": [
"Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&response_type=code&scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly\n",
"\n",
"Enter your authorization code:\n",
"··········\n",
"Mounted at /GD\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "0K-8JtuJa_1c",
"colab_type": "text"
},
"source": [
"##Importing Modules"
]
},
{
"cell_type": "code",
"metadata": {
"id": "SdAHqf6RNNa7",
"colab_type": "code",
"outputId": "85dd2223-f8ad-49ce-c30d-1e9455b4d049",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 102
}
},
"source": [
"try:\n",
" %tensorflow_version 2.x #gpu\n",
"except Exception:\n",
" pass\n",
"import tensorflow as tf"
],
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": [
"`%tensorflow_version` only switches the major version: `1.x` or `2.x`.\n",
"You set: `2.x #gpu`. This will be interpreted as: `2.x`.\n",
"\n",
"\n",
"TensorFlow 2.x selected.\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "aUcrjqy5bFCt",
"colab_type": "code",
"colab": {}
},
"source": [
"import os\n",
"import re\n",
"import pandas as pd"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "pmdGXxCQbQQ-",
"colab_type": "text"
},
"source": [
"##Loading & Splitting The Data"
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "WT-NB_yiWHj_",
"colab": {}
},
"source": [
"train = pd.read_excel(\"/GD/My Drive/Colab Notebooks/News_category/Datasets/Data_Train.xlsx\")\n",
"\n",
"#Reducing the training sample for fast execution\n",
"train = train.sample(frac = 0.2)\n",
"\n",
"#splitting the training set in to training and validation sets\n",
"from sklearn.model_selection import train_test_split\n",
"train, val = train_test_split(train, test_size = 0.2, random_state = 120)"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "wYKUQv-6t4xV",
"colab_type": "code",
"outputId": "856b7dbe-4679-4607-e223-2f1298583b6e",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 204
}
},
"source": [
"train.head()"
],
"execution_count": 48,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"<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>STORY</th>\n",
" <th>SECTION</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>7306</th>\n",
" <td>Pichai said that by offering a search engine i...</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6675</th>\n",
" <td>Meanwhile, an AAP release said on Tuesday that...</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>596</th>\n",
" <td>This coincided with Congress-NCP leaders doubl...</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5534</th>\n",
" <td>McIntosh said Perry’s character is an homage t...</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5691</th>\n",
" <td>Most phones have screen sizes in between 6.2 a...</td>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" STORY SECTION\n",
"7306 Pichai said that by offering a search engine i... 1\n",
"6675 Meanwhile, an AAP release said on Tuesday that... 0\n",
"596 This coincided with Congress-NCP leaders doubl... 0\n",
"5534 McIntosh said Perry’s character is an homage t... 2\n",
"5691 Most phones have screen sizes in between 6.2 a... 1"
]
},
"metadata": {
"tags": []
},
"execution_count": 48
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "ScYVQ-4_pAHU",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "d505668c-8447-42f8-fc05-19751c86fc64"
},
"source": [
"train.shape"
],
"execution_count": 6,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"(1220, 2)"
]
},
"metadata": {
"tags": []
},
"execution_count": 6
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "Sca1m-WKpB9L",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "7cd9a42c-3538-4dc2-d502-cf9fe4bcd664"
},
"source": [
"val.shape"
],
"execution_count": 7,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"(306, 2)"
]
},
"metadata": {
"tags": []
},
"execution_count": 7
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "OZdaq5kLcavW",
"colab_type": "text"
},
"source": [
"##Installing & Importing Simple Transformers"
]
},
{
"cell_type": "code",
"metadata": {
"id": "mBifgXJ9pCvh",
"colab_type": "code",
"outputId": "0cca7968-82bf-4d6b-bcd2-d4c8e9eef69e",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 952
}
},
"source": [
"!pip install simpletransformers"
],
"execution_count": 8,
"outputs": [
{
"output_type": "stream",
"text": [
"Collecting simpletransformers\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/34/58/eb37623d9671c123d21f1ed0b1f96fe0501586ae62f9d261dedde202a817/simpletransformers-0.10.2-py3-none-any.whl (93kB)\n",
"\r\u001b[K |███▌ | 10kB 24.5MB/s eta 0:00:01\r\u001b[K |███████ | 20kB 4.0MB/s eta 0:00:01\r\u001b[K |██████████▌ | 30kB 5.7MB/s eta 0:00:01\r\u001b[K |██████████████ | 40kB 7.2MB/s eta 0:00:01\r\u001b[K |█████████████████▋ | 51kB 4.8MB/s eta 0:00:01\r\u001b[K |█████████████████████ | 61kB 5.7MB/s eta 0:00:01\r\u001b[K |████████████████████████▋ | 71kB 6.5MB/s eta 0:00:01\r\u001b[K |████████████████████████████ | 81kB 7.2MB/s eta 0:00:01\r\u001b[K |███████████████████████████████▋| 92kB 8.0MB/s eta 0:00:01\r\u001b[K |████████████████████████████████| 102kB 5.5MB/s \n",
"\u001b[?25hRequirement already satisfied: scikit-learn in /usr/local/lib/python3.6/dist-packages (from simpletransformers) (0.21.3)\n",
"Collecting seqeval\n",
" Downloading https://files.pythonhosted.org/packages/34/91/068aca8d60ce56dd9ba4506850e876aba5e66a6f2f29aa223224b50df0de/seqeval-0.0.12.tar.gz\n",
"Requirement already satisfied: scipy in /usr/local/lib/python3.6/dist-packages (from simpletransformers) (1.3.2)\n",
"Requirement already satisfied: tqdm in /usr/local/lib/python3.6/dist-packages (from simpletransformers) (4.28.1)\n",
"Collecting regex\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/e3/8e/cbf2295643d7265e7883326fb4654e643bfc93b3a8a8274d8010a39d8804/regex-2019.11.1-cp36-cp36m-manylinux1_x86_64.whl (643kB)\n",
"\u001b[K |████████████████████████████████| 645kB 40.7MB/s \n",
"\u001b[?25hRequirement already satisfied: numpy in /tensorflow-2.0.0/python3.6 (from simpletransformers) (1.17.4)\n",
"Collecting tensorboardx\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/a6/5c/e918d9f190baab8d55bad52840d8091dd5114cc99f03eaa6d72d404503cc/tensorboardX-1.9-py2.py3-none-any.whl (190kB)\n",
"\u001b[K |████████████████████████████████| 194kB 53.1MB/s \n",
"\u001b[?25hRequirement already satisfied: requests in /tensorflow-2.0.0/python3.6 (from simpletransformers) (2.22.0)\n",
"Collecting transformers\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/ec/e7/0a1babead1b79afabb654fbec0a052e0d833ba4205a6dfd98b1aeda9c82e/transformers-2.2.0-py3-none-any.whl (360kB)\n",
"\u001b[K |████████████████████████████████| 368kB 51.7MB/s \n",
"\u001b[?25hRequirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn->simpletransformers) (0.14.0)\n",
"Requirement already satisfied: Keras>=2.2.4 in /usr/local/lib/python3.6/dist-packages (from seqeval->simpletransformers) (2.2.5)\n",
"Requirement already satisfied: protobuf>=3.8.0 in /tensorflow-2.0.0/python3.6 (from tensorboardx->simpletransformers) (3.10.0)\n",
"Requirement already satisfied: six in /tensorflow-2.0.0/python3.6 (from tensorboardx->simpletransformers) (1.13.0)\n",
"Requirement already satisfied: idna<2.9,>=2.5 in /tensorflow-2.0.0/python3.6 (from requests->simpletransformers) (2.8)\n",
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /tensorflow-2.0.0/python3.6 (from requests->simpletransformers) (1.25.7)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /tensorflow-2.0.0/python3.6 (from requests->simpletransformers) (2019.9.11)\n",
"Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /tensorflow-2.0.0/python3.6 (from requests->simpletransformers) (3.0.4)\n",
"Collecting sentencepiece\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/14/3d/efb655a670b98f62ec32d66954e1109f403db4d937c50d779a75b9763a29/sentencepiece-0.1.83-cp36-cp36m-manylinux1_x86_64.whl (1.0MB)\n",
"\u001b[K |████████████████████████████████| 1.0MB 48.3MB/s \n",
"\u001b[?25hCollecting sacremoses\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/1f/8e/ed5364a06a9ba720fddd9820155cc57300d28f5f43a6fd7b7e817177e642/sacremoses-0.0.35.tar.gz (859kB)\n",
"\u001b[K |████████████████████████████████| 860kB 16.4MB/s \n",
"\u001b[?25hRequirement already satisfied: boto3 in /usr/local/lib/python3.6/dist-packages (from transformers->simpletransformers) (1.10.18)\n",
"Requirement already satisfied: keras-preprocessing>=1.1.0 in /tensorflow-2.0.0/python3.6 (from Keras>=2.2.4->seqeval->simpletransformers) (1.1.0)\n",
"Requirement already satisfied: keras-applications>=1.0.8 in /tensorflow-2.0.0/python3.6 (from Keras>=2.2.4->seqeval->simpletransformers) (1.0.8)\n",
"Requirement already satisfied: h5py in /tensorflow-2.0.0/python3.6 (from Keras>=2.2.4->seqeval->simpletransformers) (2.10.0)\n",
"Requirement already satisfied: pyyaml in /usr/local/lib/python3.6/dist-packages (from Keras>=2.2.4->seqeval->simpletransformers) (3.13)\n",
"Requirement already satisfied: setuptools in /tensorflow-2.0.0/python3.6 (from protobuf>=3.8.0->tensorboardx->simpletransformers) (41.6.0)\n",
"Requirement already satisfied: click in /usr/local/lib/python3.6/dist-packages (from sacremoses->transformers->simpletransformers) (7.0)\n",
"Requirement already satisfied: botocore<1.14.0,>=1.13.18 in /usr/local/lib/python3.6/dist-packages (from boto3->transformers->simpletransformers) (1.13.18)\n",
"Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /usr/local/lib/python3.6/dist-packages (from boto3->transformers->simpletransformers) (0.9.4)\n",
"Requirement already satisfied: s3transfer<0.3.0,>=0.2.0 in /usr/local/lib/python3.6/dist-packages (from boto3->transformers->simpletransformers) (0.2.1)\n",
"Requirement already satisfied: docutils<0.16,>=0.10 in /usr/local/lib/python3.6/dist-packages (from botocore<1.14.0,>=1.13.18->boto3->transformers->simpletransformers) (0.15.2)\n",
"Requirement already satisfied: python-dateutil<2.8.1,>=2.1; python_version >= \"2.7\" in /usr/local/lib/python3.6/dist-packages (from botocore<1.14.0,>=1.13.18->boto3->transformers->simpletransformers) (2.6.1)\n",
"Building wheels for collected packages: seqeval, sacremoses\n",
" Building wheel for seqeval (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for seqeval: filename=seqeval-0.0.12-cp36-none-any.whl size=7424 sha256=94ab637c9059bfe4f9b233fee747bc16aa09b8d32ed94176a005511ec71f4efe\n",
" Stored in directory: /root/.cache/pip/wheels/4f/32/0a/df3b340a82583566975377d65e724895b3fad101a3fb729f68\n",
" Building wheel for sacremoses (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for sacremoses: filename=sacremoses-0.0.35-cp36-none-any.whl size=883999 sha256=1d96ee9a33e0e7714823caa0332e549d6e62d3d13ba164fad3013655902fd224\n",
" Stored in directory: /root/.cache/pip/wheels/63/2a/db/63e2909042c634ef551d0d9ac825b2b0b32dede4a6d87ddc94\n",
"Successfully built seqeval sacremoses\n",
"Installing collected packages: seqeval, regex, tensorboardx, sentencepiece, sacremoses, transformers, simpletransformers\n",
"Successfully installed regex-2019.11.1 sacremoses-0.0.35 sentencepiece-0.1.83 seqeval-0.0.12 simpletransformers-0.10.2 tensorboardx-1.9 transformers-2.2.0\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "-y6sK-KVcsZv",
"colab_type": "text"
},
"source": [
"## Creating A Classification Model"
]
},
{
"cell_type": "code",
"metadata": {
"id": "9MDW82YytO3J",
"colab_type": "code",
"outputId": "6f2b9966-d772-4232-d1aa-83933d652d21",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 85
}
},
"source": [
"from simpletransformers.classification import ClassificationModel\n",
"\n",
"#Create a ClassificationModel\n",
"model = ClassificationModel('roberta', 'roberta-base', num_labels=4, use_cuda = False)\n"
],
"execution_count": 9,
"outputs": [
{
"output_type": "stream",
"text": [
"100%|██████████| 473/473 [00:00<00:00, 133318.04B/s]\n",
"100%|██████████| 898823/898823 [00:00<00:00, 1833660.79B/s]\n",
"100%|██████████| 456318/456318 [00:00<00:00, 1114849.26B/s]\n",
"100%|██████████| 501200538/501200538 [00:18<00:00, 26839413.43B/s]\n"
],
"name": "stderr"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "X1zIbRdncwGl",
"colab_type": "text"
},
"source": [
"##Training the Classifier"
]
},
{
"cell_type": "code",
"metadata": {
"id": "9ZxK5prTssC7",
"colab_type": "code",
"outputId": "ab2ddeef-805e-4b85-b084-4471be07aca6",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 181,
"referenced_widgets": [
"e4e8b97316194520a65dc913eed00ff3",
"ad9f3c2d611f443791dbfbf59f61a158",
"70a193772ae541738ea455db2caf053c",
"b76f9f2555c14381b633916d86400c08",
"317984b6c85c42d7ba49fb99af479ee2",
"6038ff16f4d5471498ce1318c1fb6809",
"475fdd29e518456f9c9ccff7698c2e07",
"eef1818ed8b148ba8ac88db784f05d7f",
"335749ca463f40c79371bd7cd7e0687c",
"1510ff2c3845423aa5f98accd0ace8ff",
"94e55193d52442dc87fe66f9acd77784",
"11060983edfd4a78957b3f9044fd0613",
"51830891d2744e86b13fe88dada8e9e8",
"7b568fac3f3d423b8fb9e3f2ae3525e2",
"6631803c55514837ad31173708d700bc",
"10667ed382824fa98647c32a2a917262",
"1eaa2c8e5ccc4265ab02ba3d410eb2df",
"142bfa4e30204d37b3cda6f858d111c3",
"41957ee1ce1c4499b6a9e1d28235ebe3",
"11a9236309e34951ab6cec14fda22ca0",
"864abf88549c4dd7a9ae3ea0b5eade82",
"0594029c15394beb9a5a7f446a6d6502",
"c6d2fbc87d584e40b1f74af90c0f6ab1",
"9337de477b4e4fe6a433de25be9141dc"
]
}
},
"source": [
"model.train_model(train)"
],
"execution_count": 10,
"outputs": [
{
"output_type": "stream",
"text": [
"Converting to features started.\n"
],
"name": "stdout"
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e4e8b97316194520a65dc913eed00ff3",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(IntProgress(value=0, max=1220), HTML(value='')))"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "stream",
"text": [
"\n"
],
"name": "stdout"
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "335749ca463f40c79371bd7cd7e0687c",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(IntProgress(value=0, description='Epoch', max=1, style=ProgressStyle(description_width='initial…"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1eaa2c8e5ccc4265ab02ba3d410eb2df",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(IntProgress(value=0, description='Current iteration', max=153, style=ProgressStyle(description_…"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "stream",
"text": [
"Running loss: 0.003528\n",
"Training of roberta model complete. Saved to outputs/.\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "vgn4lEqQc3Vt",
"colab_type": "text"
},
"source": [
"##Evaluating The Classifier"
]
},
{
"cell_type": "code",
"metadata": {
"id": "VjYo29Jrsr-_",
"colab_type": "code",
"outputId": "7b26f5ca-2cd5-4386-eb5f-ddc398753e63",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 83,
"referenced_widgets": [
"323de9110ad345578ad7e8e1c284d127",
"bd00d2af01da43af903297deefd53826",
"f7a889c346a84708bc26151f91b76b2d",
"1e21c90295944a1fbed3b7a9748ae117",
"0574eb092a8c4f3e8c39afb7ae224d74",
"fd82986701324031b51acbdc8778a9e2",
"8b335c135a5241f99aa31c76b3433b0c",
"63858c73d2364b5aa47d187a98672506"
]
}
},
"source": [
"scores1, model_outputs, wrong_predictions = model.eval_model(val)"
],
"execution_count": 19,
"outputs": [
{
"output_type": "stream",
"text": [
"Features loaded from cache at cache_dir/cached_dev_roberta_128_4_306\n"
],
"name": "stdout"
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "323de9110ad345578ad7e8e1c284d127",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(IntProgress(value=0, max=39), HTML(value='')))"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "stream",
"text": [
"\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "bxABUxWN5eF8",
"colab_type": "code",
"outputId": "9285c16b-196f-4d3c-d877-f8a142299a1d",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
}
},
"source": [
"scores1"
],
"execution_count": 20,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'eval_loss': 0.20702565842881226, 'mcc': 0.9280285195386848}"
]
},
"metadata": {
"tags": []
},
"execution_count": 20
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "qQm-FYuisr4f",
"colab_type": "code",
"colab": {}
},
"source": [
"#Evaluating With F1 Score & Accuracy\n",
"\n",
"from sklearn.metrics import f1_score, accuracy_score\n",
"def f1_multiclass(labels, preds):\n",
" return f1_score(labels, preds, average='micro')"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "McGFccT_5sNl",
"colab_type": "code",
"outputId": "fd32a2f6-18f7-47af-e2cd-f7e689b87932",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 83,
"referenced_widgets": [
"d8a96255ffd148ec95a98d65277c6c44",
"533f26d9e8874c588ad77c55dc96d239",
"82ad6017fd6a40589768e684d2dffad4",
"1c97fab9c479447197c34debb2e7a734",
"297048966d254eea8f1b91036873f770",
"ae09005b8ddf40fe8520f9cb5f33cf4b",
"f3f480f6b2e848deb9e9ffdabac01b7c",
"935571c90f14487b91056789d4a318b5"
]
}
},
"source": [
"scores2, model_outputs, wrong_predictions = model.eval_model(val, f1=f1_multiclass, acc=accuracy_score)"
],
"execution_count": 22,
"outputs": [
{
"output_type": "stream",
"text": [
"Features loaded from cache at cache_dir/cached_dev_roberta_128_4_306\n"
],
"name": "stdout"
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d8a96255ffd148ec95a98d65277c6c44",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(IntProgress(value=0, max=39), HTML(value='')))"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "stream",
"text": [
"\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "8FCd7io_6j7Y",
"colab_type": "code",
"outputId": "301ee888-3f62-4cc3-9a02-9eecb4583dbe",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 85
}
},
"source": [
"scores2"
],
"execution_count": 23,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"{'acc': 0.9477124183006536,\n",
" 'eval_loss': 0.20702565842881226,\n",
" 'f1': 0.9477124183006536,\n",
" 'mcc': 0.9280285195386848}"
]
},
"metadata": {
"tags": []
},
"execution_count": 23
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "4hMwbLscdaWf",
"colab_type": "text"
},
"source": [
"##Predicting\n",
"---\n",
"\n",
"Classes & Labels\n",
"\n",
"* Politics: 0\n",
"* Technology: 1\n",
"* Entertainment: 2\n",
"* Business: 3\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "33FSh2HwtJRM",
"colab_type": "code",
"outputId": "923b5ce0-480b-47e2-d129-44b9dc8bf6bc",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 132,
"referenced_widgets": [
"f00e2daaca2340d9b604d19a5a054efc",
"74c46e816d4c4b4ea617bcc981891f07",
"6366706d4ee544d49c650f072ec7b09a",
"39ab01079c1945788d32ebc3d940b3c8",
"d2c86f0cb4704da9a65e3c5530ec0089",
"f15a59992056476e8b030749820dd5de",
"60f360abf76c493d9a750914f84b1771",
"6e2a6e53d33c4de1897efe0f8f756d6a",
"413e17a3b372472c93a771b1f87d1af1",
"d7d787296ace4eb2a6130d82ef6f29e6",
"9caac6ef50f64e7792636ad62b916a71",
"ecfe8bd01d1b4ee88f6a4e6ea47fda2f",
"a2af0a80ac604ded851df699fde89fb0",
"82b95e619d02460ba7a09cac8e39bc33",
"6c641edbe63e496fa52c43f97629fe06",
"7a18e294a9ae44e6a1d2a438280de740"
]
}
},
"source": [
"predictions, raw_output = model.predict(['Indian is lead by prime minister Modi '])"
],
"execution_count": 46,
"outputs": [
{
"output_type": "stream",
"text": [
"Converting to features started.\n"
],
"name": "stdout"
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f00e2daaca2340d9b604d19a5a054efc",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(IntProgress(value=0, max=1), HTML(value='')))"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "stream",
"text": [
"\n"
],
"name": "stdout"
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "413e17a3b372472c93a771b1f87d1af1",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(IntProgress(value=0, max=1), HTML(value='')))"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "stream",
"text": [
"\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "yjT02xcyGfVw",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "76ef3be5-796a-4bcb-88e1-513f5bb12358"
},
"source": [
"predictions"
],
"execution_count": 47,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([0])"
]
},
"metadata": {
"tags": []
},
"execution_count": 47
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "sqwrw9MoGeW9",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 51
},
"outputId": "f4e48c08-22f0-4c6a-9c16-31237d3c532b"
},
"source": [
"raw_output"
],
"execution_count": 38,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([[-1.2096044 , 0.51245356, 4.533729 , -2.7435937 ]],\n",
" dtype=float32)"
]
},
"metadata": {
"tags": []
},
"execution_count": 38
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "WCZdWPA77frP",
"colab_type": "code",
"outputId": "472014d6-e47e-462a-e664-89f14bd31ce7",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 132,
"referenced_widgets": [
"0ddbc0b87f8f4fb59751d46dcac24606",
"71154ce4fd854056bb37c6eeff5aa28a",
"8b80b399024743ceaeba7a9eb82c2b6a",
"e5f04daf2b124da8a8c8d56ba5f5e478",
"dc54f05812024b6db04166972bdbfc5f",
"e33e4c1cb77a487097afbe07e90fd68f",
"f7799569aaf74d2da3a886a5bfae0bc1",
"8d088d2649ac420fb0c84869b0593144",
"69143d8cf8494e91b995bc8971c9dfbe",
"cbf28b3b9a794359bafd09e72aa9c2df",
"a88be4f1eb5a4171a6e451170ab2cbc4",
"bb2194d933004220925fd1a2768544fa",
"8ffeadaf4e6941a08ed51132050210b2",
"0fd92e1085a0413788b541d47464e703",
"8f34124f5ddb44b68b928f0ac270a59a",
"baba703542a14a6996cf93de0d93fcb1"
]
}
},
"source": [
"predictions2, _ = model.predict(['my phone is soo dumb and slow'])"
],
"execution_count": 34,
"outputs": [
{
"output_type": "stream",
"text": [
"Converting to features started.\n"
],
"name": "stdout"
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "0ddbc0b87f8f4fb59751d46dcac24606",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(IntProgress(value=0, max=1), HTML(value='')))"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "stream",
"text": [
"\n"
],
"name": "stdout"
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "69143d8cf8494e91b995bc8971c9dfbe",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(IntProgress(value=0, max=1), HTML(value='')))"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "stream",
"text": [
"\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "-O8XrCOEtJNq",
"colab_type": "code",
"outputId": "f6ae8b52-f19a-4e8b-c940-9f9725ee15ea",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
}
},
"source": [
"predictions2"
],
"execution_count": 35,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([1])"
]
},
"metadata": {
"tags": []
},
"execution_count": 35
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "MLOc0QUKpfvN",
"colab_type": "text"
},
"source": [
"##Predicting For A Test Set"
]
},
{
"cell_type": "code",
"metadata": {
"id": "oTnPbpaZDZ03",
"colab_type": "code",
"colab": {}
},
"source": [
"predictions3, _ = model.predict(test_data.STORY)"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "M9sQXt8lDZci",
"colab_type": "code",
"colab": {}
},
"source": [
"df = pd.DataFrame(predictions3, columns = ['SECTION'])"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "aIl0EBsrNgqb",
"colab_type": "code",
"colab": {}
},
"source": [
"#Saving the predictions in an excel file\n",
"df.to_excel(\"/GD/My Drive/Colab Notebooks/Transformers/simple_transformers.xlsx\", index = False)"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "R7kpPtRupqeJ",
"colab_type": "text"
},
"source": [
"Upload the above file at MachineHack to check your score!!"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment