Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidefiocco/3b6c6b1e09c4f664b3a73e5bf24d1668 to your computer and use it in GitHub Desktop.
Save davidefiocco/3b6c6b1e09c4f664b3a73e5bf24d1668 to your computer and use it in GitHub Desktop.
Text classification in PyTorch to refactor with PyTorch lightning.ipynb
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
},
"colab": {
"name": "Text classification in PyTorch to refactor with PyTorch lightning.ipynb",
"provenance": [],
"collapsed_sections": [],
"include_colab_link": true
},
"accelerator": "GPU",
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"6f43d9df326c4ee7b04cf479e53f71db": {
"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_8289fb90dbda4dde885dee850c361352",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_45a6b2ce80004c0b97621110fc2b49f1",
"IPY_MODEL_419bb5c2c9714853b640ed363f9941d1"
]
}
},
"8289fb90dbda4dde885dee850c361352": {
"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": "row wrap",
"width": "100%",
"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": "inline-flex",
"left": null
}
},
"45a6b2ce80004c0b97621110fc2b49f1": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_9fc5507c71b8403cb1a4395e7bc51ac2",
"_dom_classes": [],
"description": "Validation sanity check: 0%",
"_model_name": "FloatProgressModel",
"bar_style": "danger",
"max": 2,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 0,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_f477c4ef892e446aa0e6322e3c98bcde"
}
},
"419bb5c2c9714853b640ed363f9941d1": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_9d44a713ec154ce2a4c53495730a1920",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 0/2 [02:38<?, ?it/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_ce1f3b7cd88246498de8bb0212ea373b"
}
},
"9fc5507c71b8403cb1a4395e7bc51ac2": {
"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"
}
},
"f477c4ef892e446aa0e6322e3c98bcde": {
"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": "2",
"_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
}
},
"9d44a713ec154ce2a4c53495730a1920": {
"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"
}
},
"ce1f3b7cd88246498de8bb0212ea373b": {
"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
}
},
"eb9c8bdf50064cc1a14653c7c9c7842c": {
"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_e6d7f64108094a7b86f5e509b827eb6f",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_5edddaca47b0480980e770fa2cced3e4",
"IPY_MODEL_9df73ed5042c48afa92ec2ae936f54c7"
]
}
},
"e6d7f64108094a7b86f5e509b827eb6f": {
"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": "row wrap",
"width": "100%",
"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": "inline-flex",
"left": null
}
},
"5edddaca47b0480980e770fa2cced3e4": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_d02fc382096247f395d3979bcc50bffb",
"_dom_classes": [],
"description": "Epoch 4: 100%",
"_model_name": "FloatProgressModel",
"bar_style": "success",
"max": 7500,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 7500,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_e571e70aefa14f94a680e2909c6eff97"
}
},
"9df73ed5042c48afa92ec2ae936f54c7": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_0e27e5f5981a4e89a9bf9a5737b1386e",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 7500/7500 [01:03<00:00, 117.23it/s, loss=0.0887, v_num=1, val_acc=0.889]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_1302af10bba64ad0ae393492c862db7b"
}
},
"d02fc382096247f395d3979bcc50bffb": {
"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"
}
},
"e571e70aefa14f94a680e2909c6eff97": {
"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": "2",
"_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
}
},
"0e27e5f5981a4e89a9bf9a5737b1386e": {
"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"
}
},
"1302af10bba64ad0ae393492c862db7b": {
"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
}
},
"746c3eafa18648a4808b4edbddabfa8c": {
"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_0206209330e54a19b7ea97a5b5b6ff76",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_cd18766d802b47c38421f00b34d51fdf",
"IPY_MODEL_bd5670fcfcd54c7abc6382ba9b41efda"
]
}
},
"0206209330e54a19b7ea97a5b5b6ff76": {
"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": "row wrap",
"width": "100%",
"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": "inline-flex",
"left": null
}
},
"cd18766d802b47c38421f00b34d51fdf": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_5e23422bfba544e9a7b54ea3340a5e88",
"_dom_classes": [],
"description": "Validating: 100%",
"_model_name": "FloatProgressModel",
"bar_style": "info",
"max": 375,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 375,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_7c228db214a94aa5ad5cd1a3550fe3cc"
}
},
"bd5670fcfcd54c7abc6382ba9b41efda": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_55247e603de942d58d84fda06551a279",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 375/375 [00:01<00:00, 376.25it/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_5b9eb176ca3a4055bc6cb33392cbf95b"
}
},
"5e23422bfba544e9a7b54ea3340a5e88": {
"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"
}
},
"7c228db214a94aa5ad5cd1a3550fe3cc": {
"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": "2",
"_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
}
},
"55247e603de942d58d84fda06551a279": {
"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"
}
},
"5b9eb176ca3a4055bc6cb33392cbf95b": {
"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
}
},
"df1e0b6b7873443aa3dcbaa16d7a40d4": {
"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_73c49d6734994c2d96847cd538cf6409",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_0ca7b7453f6b44a29211c4219ff37e1e",
"IPY_MODEL_16f1ec214a004bf884ebac94113ceb12"
]
}
},
"73c49d6734994c2d96847cd538cf6409": {
"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": "row wrap",
"width": "100%",
"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": "inline-flex",
"left": null
}
},
"0ca7b7453f6b44a29211c4219ff37e1e": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_d1f11f2343cc4156a2ba202aaa14f0c4",
"_dom_classes": [],
"description": "Validating: 100%",
"_model_name": "FloatProgressModel",
"bar_style": "info",
"max": 375,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 375,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_e1dadbd6dcc44f3c8fdb88e201001595"
}
},
"16f1ec214a004bf884ebac94113ceb12": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_68353b7a5f2e4adfa1ba11f838513244",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 375/375 [00:01<00:00, 372.61it/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_225a1fa8e9f4472a82b5140d2b3fe30b"
}
},
"d1f11f2343cc4156a2ba202aaa14f0c4": {
"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"
}
},
"e1dadbd6dcc44f3c8fdb88e201001595": {
"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": "2",
"_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
}
},
"68353b7a5f2e4adfa1ba11f838513244": {
"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"
}
},
"225a1fa8e9f4472a82b5140d2b3fe30b": {
"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
}
},
"1664974f65bf4cbfa28ad11ed3334d42": {
"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_c5efdc3375d6425b8dfc88ccc4b8ff44",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_eeaee542c812453084a9f06b13f16099",
"IPY_MODEL_0b05af54584c4ac384b595eed21810e2"
]
}
},
"c5efdc3375d6425b8dfc88ccc4b8ff44": {
"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": "row wrap",
"width": "100%",
"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": "inline-flex",
"left": null
}
},
"eeaee542c812453084a9f06b13f16099": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_e3fd7c13640442679f1ee5d628c26f7d",
"_dom_classes": [],
"description": "Validating: 100%",
"_model_name": "FloatProgressModel",
"bar_style": "info",
"max": 375,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 375,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_5643b8f68a54425ebda449d6a027cf57"
}
},
"0b05af54584c4ac384b595eed21810e2": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_91bfc0bd6f654396bee2753028c82d11",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 375/375 [00:01<00:00, 367.49it/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_5b4e3f3bae28428a971a3e99803679c8"
}
},
"e3fd7c13640442679f1ee5d628c26f7d": {
"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"
}
},
"5643b8f68a54425ebda449d6a027cf57": {
"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": "2",
"_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
}
},
"91bfc0bd6f654396bee2753028c82d11": {
"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"
}
},
"5b4e3f3bae28428a971a3e99803679c8": {
"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
}
},
"c126d188f5f24fbab6ffb3ca40bfaf03": {
"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_9171936e044d47a681fa75ade71eae52",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_061313a9750f4cc6a5824a1881ec835a",
"IPY_MODEL_7c49640b3a8f475caa09bb9b206a8842"
]
}
},
"9171936e044d47a681fa75ade71eae52": {
"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": "row wrap",
"width": "100%",
"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": "inline-flex",
"left": null
}
},
"061313a9750f4cc6a5824a1881ec835a": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_bcdfa572cc2a44abba7c452e4b48891a",
"_dom_classes": [],
"description": "Validating: 100%",
"_model_name": "FloatProgressModel",
"bar_style": "info",
"max": 375,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 375,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_5e25c1cd9d964bb998288cf42b733f79"
}
},
"7c49640b3a8f475caa09bb9b206a8842": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_93aa4244ffc049c2b7badf2b371fdfbd",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 375/375 [00:01<00:00, 376.20it/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_ac2766ef0a5a49a1a2ea33d91040d048"
}
},
"bcdfa572cc2a44abba7c452e4b48891a": {
"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"
}
},
"5e25c1cd9d964bb998288cf42b733f79": {
"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": "2",
"_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
}
},
"93aa4244ffc049c2b7badf2b371fdfbd": {
"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"
}
},
"ac2766ef0a5a49a1a2ea33d91040d048": {
"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
}
},
"3194cec831be46049ca599e7dd9a7768": {
"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_607e73f75e9c48bcb85756877435b1e7",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_20589d25607a4f798834fbe0e90418c9",
"IPY_MODEL_5d6252f314564f20aa1158920cbdc1ec"
]
}
},
"607e73f75e9c48bcb85756877435b1e7": {
"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": "row wrap",
"width": "100%",
"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": "inline-flex",
"left": null
}
},
"20589d25607a4f798834fbe0e90418c9": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_beddee83afd44ac3875c5dbe728966c3",
"_dom_classes": [],
"description": "Validating: 100%",
"_model_name": "FloatProgressModel",
"bar_style": "info",
"max": 375,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 375,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_0954c5b7e8794307a33d0d19f275f33a"
}
},
"5d6252f314564f20aa1158920cbdc1ec": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_5e545b81d5f14049900f05060c5bb000",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 375/375 [00:01<00:00, 370.27it/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_d5dedbed6941456897af583d0cc07550"
}
},
"beddee83afd44ac3875c5dbe728966c3": {
"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"
}
},
"0954c5b7e8794307a33d0d19f275f33a": {
"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": "2",
"_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
}
},
"5e545b81d5f14049900f05060c5bb000": {
"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"
}
},
"d5dedbed6941456897af583d0cc07550": {
"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": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/davidefiocco/3b6c6b1e09c4f664b3a73e5bf24d1668/text-classification-in-pytorch-to-refactor-with-pytorch-lightning.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "SVhHUPSWPCHG"
},
"source": [
"The code below is a PyTorch text classifier obtained by getting code from https://pytorch.org/tutorials/beginner/text_sentiment_ngrams_tutorial.html, attempting (clumsily) a PyTorch lightning refactor.\r\n",
"How can I make this work with PyTorch lightning?"
]
},
{
"cell_type": "code",
"metadata": {
"id": "8-un-rXKQ2ec"
},
"source": [
"%matplotlib inline"
],
"execution_count": 1,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "RWuv_rZYRdXz",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "04bf2b45-d31b-417f-8517-072d751e347e"
},
"source": [
"pip install torchtext pytorch-lightning --upgrade --quiet"
],
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": [
"\u001b[K |████████████████████████████████| 7.0MB 27.1MB/s \n",
"\u001b[K |████████████████████████████████| 819kB 43.3MB/s \n",
"\u001b[K |████████████████████████████████| 829kB 52.9MB/s \n",
"\u001b[K |████████████████████████████████| 276kB 47.4MB/s \n",
"\u001b[K |████████████████████████████████| 112kB 56.5MB/s \n",
"\u001b[K |████████████████████████████████| 1.3MB 50.1MB/s \n",
"\u001b[K |████████████████████████████████| 143kB 60.6MB/s \n",
"\u001b[K |████████████████████████████████| 296kB 59.7MB/s \n",
"\u001b[?25h Building wheel for future (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Building wheel for PyYAML (setup.py) ... \u001b[?25l\u001b[?25hdone\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "vOAdk0qdQ2ef",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "4450f600-c758-49f6-9f28-59f5277015a9"
},
"source": [
"import torch\n",
"import torchtext\n",
"import torch.nn as nn\n",
"from torchtext.datasets import text_classification\n",
"NGRAMS = 2\n",
"import os\n",
"if not os.path.isdir('./.data'):\n",
"\tos.mkdir('./.data')\n",
"train_dataset, test_dataset = text_classification.DATASETS['AG_NEWS'](\n",
" root='./.data', ngrams=NGRAMS, vocab=None)\n",
"BATCH_SIZE = 16"
],
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"text": [
"ag_news_csv.tar.gz: 11.8MB [00:00, 67.7MB/s]\n",
"120000lines [00:06, 18254.78lines/s]\n",
"120000lines [00:14, 8170.78lines/s]\n",
"7600lines [00:00, 8609.89lines/s]\n"
],
"name": "stderr"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "SUOxiQOJQ2el"
},
"source": [
"VOCAB_SIZE = len(train_dataset.get_vocab())\n",
"EMBED_DIM = 32\n",
"NUM_CLASS = len(train_dataset.get_labels())"
],
"execution_count": 13,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "YJXial03Q2em"
},
"source": [
"Functions used to generate batch\n",
"--------------------------------\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "36rTk-S5Q2en"
},
"source": [
"def generate_batch(batch):\n",
" label = torch.tensor([entry[0] for entry in batch])\n",
" text = [entry[1] for entry in batch]\n",
" offsets = [0] + [len(entry) for entry in text]\n",
" # torch.Tensor.cumsum returns the cumulative sum\n",
" # of elements in the dimension dim.\n",
" # torch.Tensor([1.0, 2.0, 3.0]).cumsum(dim=0)\n",
"\n",
" offsets = torch.tensor(offsets[:-1]).cumsum(dim=0)\n",
" text = torch.cat(text)\n",
" return text, offsets, label"
],
"execution_count": 5,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "kiaOrOBhQ2ep"
},
"source": [
"Define functions to train the model and evaluate results.\n",
"---------------------------------------------------------\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "mMzZQ2e-Q2er"
},
"source": [
"import time\n",
"from torch.utils.data.dataset import random_split\n",
"\n",
"train_len = int(len(train_dataset) * 0.95)\n",
"sub_train_, sub_valid_ = \\\n",
" random_split(train_dataset, [train_len, len(train_dataset) - train_len])"
],
"execution_count": 6,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "drSdUCLuSuhK"
},
"source": [
"from torch.utils.data import DataLoader\r\n",
"\r\n",
"train_dl = DataLoader(sub_train_, batch_size=BATCH_SIZE, shuffle=True,\r\n",
" collate_fn=generate_batch)\r\n",
"valid_dl = DataLoader(sub_valid_, batch_size=BATCH_SIZE, shuffle=False,\r\n",
" collate_fn=generate_batch)"
],
"execution_count": 7,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "9-3usDU_TGY9"
},
"source": [
"import pytorch_lightning as pl\r\n",
"from torch import optim\r\n",
"from torch.nn import CrossEntropyLoss"
],
"execution_count": 8,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "qFUFjqu_S9Gp"
},
"source": [
"class LitTextClassifier(pl.LightningModule):\r\n",
" def __init__(self, num_class, criterion = CrossEntropyLoss):\r\n",
" super().__init__()\r\n",
" self.embedding = nn.EmbeddingBag(VOCAB_SIZE, EMBED_DIM, sparse=False)\r\n",
" self.fc = nn.Linear(EMBED_DIM, num_class)\r\n",
" self.init_weights()\r\n",
" self.criterion = criterion()\r\n",
" self.accuracy = pl.metrics.Accuracy()\r\n",
"\r\n",
" def init_weights(self):\r\n",
" initrange = 0.5\r\n",
" self.embedding.weight.data.uniform_(-initrange, initrange)\r\n",
" self.fc.weight.data.uniform_(-initrange, initrange)\r\n",
" self.fc.bias.data.zero_()\r\n",
"\r\n",
" def forward(self, text, offsets):\r\n",
" embedded = self.embedding(text, offsets)\r\n",
" return self.fc(embedded)\r\n",
"\r\n",
" def configure_optimizers(self):\r\n",
" optimizer = optim.SGD(self.parameters(), lr=4.0)\r\n",
" return optimizer\r\n",
"\r\n",
" def training_step(self, batch, batch_idx):\r\n",
" text, offsets, cls = batch\r\n",
" output = self.forward(text, offsets)\r\n",
" loss = self.criterion(output, cls)\r\n",
" self.log(\"loss\", loss)\r\n",
" return loss\r\n",
"\r\n",
" def validation_step(self, batch, batch_idx):\r\n",
" text, offsets, cls = batch\r\n",
" output = self.forward(text, offsets)\r\n",
" loss = self.criterion(output, cls)\r\n",
" self.log('val_acc', self.accuracy(output.argmax(1), cls), prog_bar=True)\r\n",
" self.log(\"val_loss\", loss)\r\n",
" \r\n",
" return loss"
],
"execution_count": 14,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "TgxhOV1YUCoD"
},
"source": [
"classifier = LitTextClassifier(NUM_CLASS)"
],
"execution_count": 15,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "BYgIuqqW7kQw",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 626,
"referenced_widgets": [
"6f43d9df326c4ee7b04cf479e53f71db",
"8289fb90dbda4dde885dee850c361352",
"45a6b2ce80004c0b97621110fc2b49f1",
"419bb5c2c9714853b640ed363f9941d1",
"9fc5507c71b8403cb1a4395e7bc51ac2",
"f477c4ef892e446aa0e6322e3c98bcde",
"9d44a713ec154ce2a4c53495730a1920",
"ce1f3b7cd88246498de8bb0212ea373b",
"eb9c8bdf50064cc1a14653c7c9c7842c",
"e6d7f64108094a7b86f5e509b827eb6f",
"5edddaca47b0480980e770fa2cced3e4",
"9df73ed5042c48afa92ec2ae936f54c7",
"d02fc382096247f395d3979bcc50bffb",
"e571e70aefa14f94a680e2909c6eff97",
"0e27e5f5981a4e89a9bf9a5737b1386e",
"1302af10bba64ad0ae393492c862db7b",
"746c3eafa18648a4808b4edbddabfa8c",
"0206209330e54a19b7ea97a5b5b6ff76",
"cd18766d802b47c38421f00b34d51fdf",
"bd5670fcfcd54c7abc6382ba9b41efda",
"5e23422bfba544e9a7b54ea3340a5e88",
"7c228db214a94aa5ad5cd1a3550fe3cc",
"55247e603de942d58d84fda06551a279",
"5b9eb176ca3a4055bc6cb33392cbf95b",
"df1e0b6b7873443aa3dcbaa16d7a40d4",
"73c49d6734994c2d96847cd538cf6409",
"0ca7b7453f6b44a29211c4219ff37e1e",
"16f1ec214a004bf884ebac94113ceb12",
"d1f11f2343cc4156a2ba202aaa14f0c4",
"e1dadbd6dcc44f3c8fdb88e201001595",
"68353b7a5f2e4adfa1ba11f838513244",
"225a1fa8e9f4472a82b5140d2b3fe30b",
"1664974f65bf4cbfa28ad11ed3334d42",
"c5efdc3375d6425b8dfc88ccc4b8ff44",
"eeaee542c812453084a9f06b13f16099",
"0b05af54584c4ac384b595eed21810e2",
"e3fd7c13640442679f1ee5d628c26f7d",
"5643b8f68a54425ebda449d6a027cf57",
"91bfc0bd6f654396bee2753028c82d11",
"5b4e3f3bae28428a971a3e99803679c8",
"c126d188f5f24fbab6ffb3ca40bfaf03",
"9171936e044d47a681fa75ade71eae52",
"061313a9750f4cc6a5824a1881ec835a",
"7c49640b3a8f475caa09bb9b206a8842",
"bcdfa572cc2a44abba7c452e4b48891a",
"5e25c1cd9d964bb998288cf42b733f79",
"93aa4244ffc049c2b7badf2b371fdfbd",
"ac2766ef0a5a49a1a2ea33d91040d048",
"3194cec831be46049ca599e7dd9a7768",
"607e73f75e9c48bcb85756877435b1e7",
"20589d25607a4f798834fbe0e90418c9",
"5d6252f314564f20aa1158920cbdc1ec",
"beddee83afd44ac3875c5dbe728966c3",
"0954c5b7e8794307a33d0d19f275f33a",
"5e545b81d5f14049900f05060c5bb000",
"d5dedbed6941456897af583d0cc07550"
]
},
"outputId": "6f314971-2e82-4084-a0fe-b2ec0ce01811"
},
"source": [
"trainer = pl.Trainer(gpus=1, max_epochs=5, check_val_every_n_epoch=1)\r\n",
"trainer.fit(classifier, train_dl, valid_dl)"
],
"execution_count": 16,
"outputs": [
{
"output_type": "stream",
"text": [
"GPU available: True, used: True\n",
"INFO:lightning:GPU available: True, used: True\n",
"TPU available: None, using: 0 TPU cores\n",
"INFO:lightning:TPU available: None, using: 0 TPU cores\n",
"\n",
" | Name | Type | Params\n",
"-----------------------------------------------\n",
"0 | embedding | EmbeddingBag | 41.9 M\n",
"1 | fc | Linear | 132 \n",
"2 | criterion | CrossEntropyLoss | 0 \n",
"3 | accuracy | Accuracy | 0 \n",
"-----------------------------------------------\n",
"41.9 M Trainable params\n",
"0 Non-trainable params\n",
"41.9 M Total params\n",
"167.533 Total estimated model params size (MB)\n",
"INFO:lightning:\n",
" | Name | Type | Params\n",
"-----------------------------------------------\n",
"0 | embedding | EmbeddingBag | 41.9 M\n",
"1 | fc | Linear | 132 \n",
"2 | criterion | CrossEntropyLoss | 0 \n",
"3 | accuracy | Accuracy | 0 \n",
"-----------------------------------------------\n",
"41.9 M Trainable params\n",
"0 Non-trainable params\n",
"41.9 M Total params\n",
"167.533 Total estimated model params size (MB)\n"
],
"name": "stderr"
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6f43d9df326c4ee7b04cf479e53f71db",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(FloatProgress(value=1.0, bar_style='info', description='Validation sanity check', layout=Layout…"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "stream",
"text": [
"\r"
],
"name": "stdout"
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "eb9c8bdf50064cc1a14653c7c9c7842c",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(FloatProgress(value=1.0, bar_style='info', description='Training', layout=Layout(flex='2'), max…"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "746c3eafa18648a4808b4edbddabfa8c",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(FloatProgress(value=1.0, bar_style='info', description='Validating', layout=Layout(flex='2'), m…"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "df1e0b6b7873443aa3dcbaa16d7a40d4",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(FloatProgress(value=1.0, bar_style='info', description='Validating', layout=Layout(flex='2'), m…"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1664974f65bf4cbfa28ad11ed3334d42",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(FloatProgress(value=1.0, bar_style='info', description='Validating', layout=Layout(flex='2'), m…"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c126d188f5f24fbab6ffb3ca40bfaf03",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(FloatProgress(value=1.0, bar_style='info', description='Validating', layout=Layout(flex='2'), m…"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3194cec831be46049ca599e7dd9a7768",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(FloatProgress(value=1.0, bar_style='info', description='Validating', layout=Layout(flex='2'), m…"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "stream",
"text": [
"\n"
],
"name": "stdout"
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"1"
]
},
"metadata": {
"tags": []
},
"execution_count": 16
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment