{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "423d621389ad4a42bb5135995d015b22": { "model_module": "@jupyter-widgets/controls", "model_name": "VBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "VBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "VBoxView", "box_style": "", "children": [ "IPY_MODEL_08c70ceeea924b71b3b6f857ed42d853", "IPY_MODEL_54849760c68c4f3bbc1ae7791dc95b17", "IPY_MODEL_00b87c0992474b169894118405633975", "IPY_MODEL_951f643c654645159ac1419fc924c994", "IPY_MODEL_41a103d864d54a5ab7cd3164ceb29be9" ], "layout": "IPY_MODEL_ee14797dd17d460a9c719c3fd995ce64" } }, "08c70ceeea924b71b3b6f857ed42d853": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_b5971665f06946baa63db15a77dc7f03", "placeholder": "​", "style": "IPY_MODEL_9acdf1cf6fec48c0aa468d42676f8489", "value": "

Copy a token from your Hugging Face\ntokens page and paste it below.
Immediately click login after copying\nyour token or it might be stored in plain text in this notebook file.
" } }, "54849760c68c4f3bbc1ae7791dc95b17": { "model_module": "@jupyter-widgets/controls", "model_name": "PasswordModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "PasswordModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "PasswordView", "continuous_update": true, "description": "Token:", "description_tooltip": null, "disabled": false, "layout": "IPY_MODEL_e3f9e19327d743719810d3900ac7cd80", "placeholder": "​", "style": "IPY_MODEL_04417e13279a4fa59529a95d62ef4a18", "value": "" } }, "00b87c0992474b169894118405633975": { "model_module": "@jupyter-widgets/controls", "model_name": "CheckboxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "CheckboxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "CheckboxView", "description": "Add token as git credential?", "description_tooltip": null, "disabled": false, "indent": true, "layout": "IPY_MODEL_1e6b456269274b14b9856a17b5d475f2", "style": "IPY_MODEL_becffc777f0e4b1aa660611be6cf2523", "value": true } }, "951f643c654645159ac1419fc924c994": { "model_module": "@jupyter-widgets/controls", "model_name": "ButtonModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ButtonModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ButtonView", "button_style": "", "description": "Login", "disabled": false, "icon": "", "layout": "IPY_MODEL_451d90a772384fd0a629468e53cbc5dc", "style": "IPY_MODEL_776e614de7f048feb52a9404856992b4", "tooltip": "" } }, "41a103d864d54a5ab7cd3164ceb29be9": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_f48f47fb2325479996e0e44e4b278c41", "placeholder": "​", "style": "IPY_MODEL_2325f8c161184afc87e6294f7de28e5a", "value": "\nPro Tip: If you don't already have one, you can create a dedicated\n'notebooks' token with 'write' access, that you can then easily reuse for all\nnotebooks. " } }, "ee14797dd17d460a9c719c3fd995ce64": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": "center", "align_self": null, "border": null, "bottom": null, "display": "flex", "flex": null, "flex_flow": "column", "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": "50%" } }, "b5971665f06946baa63db15a77dc7f03": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "9acdf1cf6fec48c0aa468d42676f8489": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "e3f9e19327d743719810d3900ac7cd80": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "04417e13279a4fa59529a95d62ef4a18": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "1e6b456269274b14b9856a17b5d475f2": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "becffc777f0e4b1aa660611be6cf2523": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "451d90a772384fd0a629468e53cbc5dc": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "776e614de7f048feb52a9404856992b4": { "model_module": "@jupyter-widgets/controls", "model_name": "ButtonStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ButtonStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "button_color": null, "font_weight": "" } }, "f48f47fb2325479996e0e44e4b278c41": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "2325f8c161184afc87e6294f7de28e5a": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "69109c9a4e2147839ceb2de9d20db3ef": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_ac0c289e62cc420e8bef115da44b278e", "IPY_MODEL_18091a982a214a619058b48d527f8d4d", "IPY_MODEL_ee5eff014eae4abd9788520e8abc6d4c" ], "layout": "IPY_MODEL_9eae3316acd14871a24ac842f7d5b6ce" } }, "ac0c289e62cc420e8bef115da44b278e": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_f6a6e9c455954a3691842a035d363fc2", "placeholder": "​", "style": "IPY_MODEL_93a4c2a6fd294b5ca67016fe5bf33a48", "value": "Map: 100%" } }, "18091a982a214a619058b48d527f8d4d": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_68719c5b6fd64a839ab60864d7c15ea1", "max": 4500, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_ce1e58abcf71495296f3a4ef3102b0b2", "value": 4500 } }, "ee5eff014eae4abd9788520e8abc6d4c": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_ac9e432d45a14fc4b537349ce27755ce", "placeholder": "​", "style": "IPY_MODEL_d1c83e485c0e4d8f8a9bc4493f3492c8", "value": " 4500/4500 [00:03<00:00, 1459.38 examples/s]" } }, "9eae3316acd14871a24ac842f7d5b6ce": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "f6a6e9c455954a3691842a035d363fc2": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "93a4c2a6fd294b5ca67016fe5bf33a48": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "68719c5b6fd64a839ab60864d7c15ea1": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "ce1e58abcf71495296f3a4ef3102b0b2": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "ac9e432d45a14fc4b537349ce27755ce": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "d1c83e485c0e4d8f8a9bc4493f3492c8": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "8bcb60258fe34e3d898707e6fec24474": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_89ec6dcc72694ce89edf962dc1c6aa59", "IPY_MODEL_494a8b65ace247f3b92dfef9ecd00aab", "IPY_MODEL_49d5fa2bf1d24b138a4807446af6e0c8" ], "layout": "IPY_MODEL_441e331f51464982bb37a193619fc8e0" } }, "89ec6dcc72694ce89edf962dc1c6aa59": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_0f5c0f16b6244a7bbdfead4101a3296f", "placeholder": "​", "style": "IPY_MODEL_a499ba515e6f4bff9fdce1308b0d39c5", "value": "Map: 100%" } }, "494a8b65ace247f3b92dfef9ecd00aab": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_4511cbda120a4d4783076c38ef31a193", "max": 500, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_c22f126ec3d249a394d6ea3a6d17f5a1", "value": 500 } }, "49d5fa2bf1d24b138a4807446af6e0c8": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_79e0392d6abe44acb2939c92745eec5b", "placeholder": "​", "style": "IPY_MODEL_9ccddcda8b7643daba53760e4aaf8016", "value": " 500/500 [00:00<00:00, 880.49 examples/s]" } }, "441e331f51464982bb37a193619fc8e0": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "0f5c0f16b6244a7bbdfead4101a3296f": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "a499ba515e6f4bff9fdce1308b0d39c5": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "4511cbda120a4d4783076c38ef31a193": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "c22f126ec3d249a394d6ea3a6d17f5a1": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "79e0392d6abe44acb2939c92745eec5b": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "9ccddcda8b7643daba53760e4aaf8016": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } } } } }, "cells": [ { "cell_type": "code", "source": [ "import gradio as gr\n", "from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline, Trainer, TrainingArguments\n", "from datasets import load_dataset, Dataset\n", "import torch\n", "import pandas as pd\n", "from huggingface_hub import notebook_login\n", "from transformers import DataCollatorForSeq2Seq\n", "\n", "MODEL_NAME = \"t5-small\"\n", "DATASET_NAME = \"embedding-data/amazon-QA\"\n", "FINETUNED_MODEL_NAME = \"MujtabaShopifyChatbot\"\n", "HF_TOKEN = \"your_huggingface_token\"\n", "\n", "chatbot_pipe = None\n", "\n", "def show_dataset_head(dataset, num_rows=5):\n", "\n", " print(\"\\nDataset Preview:\")\n", " if isinstance(dataset, dict):\n", " for split in dataset.keys():\n", " print(f\"\\nSplit: {split}\")\n", " df = pd.DataFrame(dataset[split][:num_rows])\n", " cols = [col for col in ['query', 'pos', 'question', 'answer'] if col in df.columns]\n", " if cols:\n", " print(df[cols].to_markdown(index=False))\n", " else:\n", " df = pd.DataFrame(dataset[:num_rows])\n", " cols = [col for col in ['query', 'pos', 'question', 'answer'] if col in df.columns]\n", " if cols:\n", " print(df[cols].to_markdown(index=False))\n", " return dataset\n", "\n", "def load_and_preprocess_data():\n", " print(\"Loading dataset...\")\n", " dataset = load_dataset(DATASET_NAME)\n", " show_dataset_head(dataset)\n", "\n", " df = pd.DataFrame(dataset['train'])\n", "\n", " if 'query' in df.columns and 'pos' in df.columns:\n", " df = df.rename(columns={'query': 'question', 'pos': 'answer'})\n", " elif 'question' not in df.columns or 'answer' not in df.columns:\n", " df = df.rename(columns={df.columns[0]: 'question', df.columns[1]: 'answer'})\n", "\n", " df = df[['question', 'answer']].dropna()\n", " df = df[:5000]\n", "\n", " df['answer'] = df['answer'].astype(str).str.replace(r'\\[\\^|\\].*', '', regex=True)\n", "\n", " processed_dataset = Dataset.from_pandas(df)\n", " show_dataset_head(processed_dataset, num_rows=3)\n", " return processed_dataset.train_test_split(test_size=0.1)\n", "\n", "def tokenize_data(dataset):\n", " print(\"Tokenizing data...\")\n", " tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)\n", "\n", " def preprocess_function(examples):\n", " inputs = [f\"question: {q} answer:\" for q in examples[\"question\"]]\n", " targets = [str(a) for a in examples[\"answer\"]]\n", "\n", " model_inputs = tokenizer(\n", " inputs,\n", " max_length=128,\n", " truncation=True,\n", " padding='max_length'\n", " )\n", " labels = tokenizer(\n", " targets,\n", " max_length=128,\n", " truncation=True,\n", " padding='max_length'\n", " )\n", "\n", " model_inputs[\"labels\"] = labels[\"input_ids\"]\n", " return model_inputs\n", "\n", " return dataset.map(preprocess_function, batched=True)\n", "\n", "\n", "def fine_tune_model(tokenized_dataset):\n", " print(\"Fine-tuning model...\")\n", " tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)\n", " model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME)\n", "\n", "\n", " data_collator = DataCollatorForSeq2Seq(\n", " tokenizer,\n", " model=model,\n", " padding='longest',\n", " max_length=128,\n", " pad_to_multiple_of=8\n", " )\n", "\n", " training_args = TrainingArguments(\n", " output_dir=\"./results\",\n", " eval_strategy=\"epoch\",\n", " learning_rate=2e-5,\n", " per_device_train_batch_size=8,\n", " per_device_eval_batch_size=8,\n", " num_train_epochs=1,\n", " weight_decay=0.01,\n", " save_total_limit=3,\n", " fp16=torch.cuda.is_available(),\n", " push_to_hub=False,\n", " report_to=\"none\",\n", " logging_steps=100,\n", " save_steps=500,\n", " gradient_accumulation_steps=1\n", " )\n", "\n", " trainer = Trainer(\n", " model=model,\n", " args=training_args,\n", " train_dataset=tokenized_dataset[\"train\"],\n", " eval_dataset=tokenized_dataset[\"test\"],\n", " data_collator=data_collator,\n", " tokenizer=tokenizer\n", " )\n", "\n", " trainer.train()\n", " return model\n", "\n", "def initialize_chatbot():\n", " global chatbot_pipe\n", " print(\"Loading chatbot...\")\n", " model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME)\n", " tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)\n", " chatbot_pipe = pipeline(\n", " \"text2text-generation\",\n", " model=model,\n", " tokenizer=tokenizer,\n", " device=0 if torch.cuda.is_available() else -1\n", " )\n", " return chatbot_pipe\n", "\n", "def generate_response(message, history):\n", " response = chatbot_pipe(\n", " f\"question: {message} answer:\",\n", " max_length=128,\n", " do_sample=True,\n", " temperature=0.7\n", " )[0]['generated_text']\n", " return response.split(\"answer:\")[-1].strip()\n", "\n", "def deploy_chatbot():\n", " demo = gr.ChatInterface(\n", " fn=generate_response,\n", " title=\"Mujtaba's Shopify Assistant\",\n", " description=\"Ask about products, shipping, or store policies\",\n", " examples=[\n", " \"Will this work with iPhone 15?\",\n", " \"What's the return window?\",\n", " \"Do you ship to Lahore?\"\n", " ],\n", " theme=\"soft\",\n", " cache_examples=False\n", " )\n", " return demo\n", "\n", "if __name__ == \"__main__\":\n", " notebook_login()\n", " dataset = load_and_preprocess_data()\n", " tokenized_data = tokenize_data(dataset)\n", "\n", " model = fine_tune_model(tokenized_data)\n", "\n", " initialize_chatbot()\n", " deploy_chatbot().launch()" ], "metadata": { "id": "jWPRRSztm3Qg", "colab": { "base_uri": "https://localhost:8080/", "height": 1000, "referenced_widgets": [ "423d621389ad4a42bb5135995d015b22", "08c70ceeea924b71b3b6f857ed42d853", "54849760c68c4f3bbc1ae7791dc95b17", "00b87c0992474b169894118405633975", "951f643c654645159ac1419fc924c994", "41a103d864d54a5ab7cd3164ceb29be9", "ee14797dd17d460a9c719c3fd995ce64", "b5971665f06946baa63db15a77dc7f03", "9acdf1cf6fec48c0aa468d42676f8489", "e3f9e19327d743719810d3900ac7cd80", "04417e13279a4fa59529a95d62ef4a18", "1e6b456269274b14b9856a17b5d475f2", "becffc777f0e4b1aa660611be6cf2523", "451d90a772384fd0a629468e53cbc5dc", "776e614de7f048feb52a9404856992b4", "f48f47fb2325479996e0e44e4b278c41", "2325f8c161184afc87e6294f7de28e5a", "69109c9a4e2147839ceb2de9d20db3ef", "ac0c289e62cc420e8bef115da44b278e", "18091a982a214a619058b48d527f8d4d", "ee5eff014eae4abd9788520e8abc6d4c", "9eae3316acd14871a24ac842f7d5b6ce", "f6a6e9c455954a3691842a035d363fc2", "93a4c2a6fd294b5ca67016fe5bf33a48", "68719c5b6fd64a839ab60864d7c15ea1", "ce1e58abcf71495296f3a4ef3102b0b2", "ac9e432d45a14fc4b537349ce27755ce", "d1c83e485c0e4d8f8a9bc4493f3492c8", "8bcb60258fe34e3d898707e6fec24474", "89ec6dcc72694ce89edf962dc1c6aa59", "494a8b65ace247f3b92dfef9ecd00aab", "49d5fa2bf1d24b138a4807446af6e0c8", "441e331f51464982bb37a193619fc8e0", "0f5c0f16b6244a7bbdfead4101a3296f", "a499ba515e6f4bff9fdce1308b0d39c5", "4511cbda120a4d4783076c38ef31a193", "c22f126ec3d249a394d6ea3a6d17f5a1", "79e0392d6abe44acb2939c92745eec5b", "9ccddcda8b7643daba53760e4aaf8016" ] }, "outputId": "dcbac3a4-3d4f-4612-f97c-07eaf2ecebd0" }, "execution_count": 19, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "VBox(children=(HTML(value='
" ], "text/html": [ "\n", "
\n", " \n", " \n", " [563/563 1:20:09, Epoch 1/1]\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
EpochTraining LossValidation Loss
12.9606002.700889

" ] }, "metadata": {} }, { "output_type": "stream", "name": "stdout", "text": [ "Loading chatbot...\n" ] }, { "output_type": "stream", "name": "stderr", "text": [ "Device set to use cpu\n", "/usr/local/lib/python3.11/dist-packages/gradio/chat_interface.py:339: UserWarning: The 'tuples' format for chatbot messages is deprecated and will be removed in a future version of Gradio. Please set type='messages' instead, which uses openai-style 'role' and 'content' keys.\n", " self.chatbot = Chatbot(\n" ] }, { "output_type": "stream", "name": "stdout", "text": [ "It looks like you are running Gradio on a hosted a Jupyter notebook. For the Gradio app to work, sharing must be enabled. Automatically setting `share=True` (you can turn this off by setting `share=False` in `launch()` explicitly).\n", "\n", "Colab notebook detected. To show errors in colab notebook, set debug=True in launch()\n", "* Running on public URL: https://a3e682dd7134cd6ae5.gradio.live\n", "\n", "This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/html": [ "

" ] }, "metadata": {} } ] }, { "cell_type": "code", "source": [ "show_dataset_head()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "eH0jLoMQTR6J", "outputId": "7cf6dfee-275b-44dd-d56e-f8674e86786b" }, "execution_count": 7, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", "Dataset Preview:\n", "| query | pos |\n", "|:-----------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n", "| does this fit the z2x version? Thx | ['I am not 100% sure. It appears that it does based on the size of the torch housing. I have the 9p and it fits perfectly. Compare the two and see. Otherwise it is a great product and has lasted 2 years so far wearing every day on my duty belt. Gets lots of inquiries and compliments.', 'Yes. The retention clip on this holster holds the bezel, the shape of the flashlight shaft is irrelevant. I would suggest getting a different holster however, since the retention clip is plastic and does not work very well.'] |\n", "| What material are these dumbbells made out of? | [\"They say cast iron.. I don't know the exact chemical compound breakdown but they seem like cast.\", 'Here is the official CAP site that gives measurements and weight or you can contact them--http://www.capbarbell.com/Bars/1inch.html'] |\n", "| What is the length and width of this scooter in inches? | ['below are all the products specs- We are authorized dealers and offer fast shipping- Also 1 year warranty FREE Phillips Health care he EW-36 mobility scooter is a 3 wheel high-power mobility scooter using a transaxle brushless electric motor. At full power the EW-36 can reach speed up to 18 mph which makes it easily the fastest mobility scooter on the market! Up to 45 mile range per single charge! Also included a reverse switch, armrest and large storage basket. The EW-36 comes equipped with a digital anti-theft alarm and two rear shock absorbers on the frame. The EW-36 is a great scooter for both fun and transportation. COLOR: Red, Silver, Blue, Orange, Camo POWER: Electric WATTS: 500 Watt MOTOR TYPE: Transaxle differential brushless motor AMPS: 20 AH VOLTS: 48 Volt DIMENSIONS: 61\"*29\"*41\" BATTERIES: 48 volt lead acid maintenance free battery TIRE SIZE: 16\"/2.5\" CHARGER: Smart charger included SPEED: Up to 18mph DISTANCE: Up to 45 miles per charge (distance varies by riders weight , terrain, road surface etc.) THROTTLE TYPE: Variable speed control- Twist Throttle KEY START: Yes BRAKING SYSTEM: Front and rear braking system DRIVE SYSTEM: Brushless motor HEAD LIGHT: Yes CARTON SIZE: Shipped on a pallet SHIPPING WEIGHT: 280 lbs NET WEIGHT: 200 lbs ELECTRIC LIGHT: Yes BATTERY INDICATOR: Yes STORAGE BASKET: Yes SHOCK ABSORBER: Two rear shock absorber on the frame ALARM: Anti-theft alarm'] |\n", "| how much bigger is the medium versus the baby gund spunky? | ['These are no longer at my house as they went home with my granddaughter, but the medium is significantly larger than the small. She was about one year old and she and I both liked the medium sized one the best', 'The medium spunky is about 2-3 times as large as the baby spunky. The medium size is a little big for a newborn but my kid started sleeping with his medium \"dogbo\" around 6mo old. He is 3 now, we are on the 3rd dog. They hold up really well, we just buy extras for daycare and grandmas house. He still has the original one!', 'We have the little one that rattles and this medium puppy is at least 4 to 5 times larger than that one. My kids are obsessed with these puppies and this is one of their faves. :)'] |\n", "| Does it work with t-mobile | ['Yes but it almost caught on fire charging in my daughters bed. I DONT RECOMMEND THIS PHONE!!!!'] |\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "Dataset({\n", " features: ['query', 'pos'],\n", " num_rows: 5000\n", "})" ] }, "metadata": {}, "execution_count": 7 } ] }, { "cell_type": "code", "source": [], "metadata": { "id": "ro5Z2SqaThl_" }, "execution_count": null, "outputs": [] } ] }