diff --git "a/colab_training_code.ipynb" "b/colab_training_code.ipynb" new file mode 100644--- /dev/null +++ "b/colab_training_code.ipynb" @@ -0,0 +1,2638 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "gpuType": "T4" + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + }, + "accelerator": "GPU", + "widgets": { + "application/vnd.jupyter.widget-state+json": { + "c6c7e0d1901345578badb5bcf973845d": { + "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_4b0c3d5ca3dc423db4b6ffd841ff0fd0", + "IPY_MODEL_c3d3e3bc5a624cd5b6f7a8739eb3a68a", + "IPY_MODEL_702bb99acd4d49c780b17717abbfe6dc" + ], + "layout": "IPY_MODEL_542f013a534843ca99f5c1ba9f01bcca" + } + }, + "4b0c3d5ca3dc423db4b6ffd841ff0fd0": { + "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_7c7d260dffd04f73b214a9e291f9fc25", + "placeholder": "​", + "style": "IPY_MODEL_1fc3385a09b84ee18612783c52cfe62a", + "value": "tokenizer_config.json: 100%" + } + }, + "c3d3e3bc5a624cd5b6f7a8739eb3a68a": { + "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_cfd012fa57e5478590075dd0399c6a68", + "max": 1358, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_2177e94cce4444bbbca8d278f0b53126", + "value": 1358 + } + }, + "702bb99acd4d49c780b17717abbfe6dc": { + "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_e36b702b3688483b8744270954e96547", + "placeholder": "​", + "style": "IPY_MODEL_b3453bbe8d3746668d09f711e4405250", + "value": " 1.36k/1.36k [00:00<00:00, 6.22kB/s]" + } + }, + "542f013a534843ca99f5c1ba9f01bcca": { + "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 + } + }, + "7c7d260dffd04f73b214a9e291f9fc25": { + "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 + } + }, + "1fc3385a09b84ee18612783c52cfe62a": { + "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": "" + } + }, + "cfd012fa57e5478590075dd0399c6a68": { + "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 + } + }, + "2177e94cce4444bbbca8d278f0b53126": { + "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": "" + } + }, + "e36b702b3688483b8744270954e96547": { + "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 + } + }, + "b3453bbe8d3746668d09f711e4405250": { + "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": "" + } + }, + "bbc53c8266ce4c339b7556cef9d2fe98": { + "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_d13dea5b635f4b1a8624a1650a332170", + "IPY_MODEL_c642a67357b74c739d0b122cec98abc1", + "IPY_MODEL_affc5d41a23e4a46a27617bc810075a8" + ], + "layout": "IPY_MODEL_6b2ae09a409d437faa550a529820d380" + } + }, + "d13dea5b635f4b1a8624a1650a332170": { + "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_585d5d703d634c2d8b5fb8ed45ee88c8", + "placeholder": "​", + "style": "IPY_MODEL_d48ee2a93d2e4d89a3cd290aa4e23ef2", + "value": "vocab.txt: 100%" + } + }, + "c642a67357b74c739d0b122cec98abc1": { + "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_76865e3769604df888b7cb6af85a7f97", + "max": 231508, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_28aeadf8d26d45e4a96b477760497c36", + "value": 231508 + } + }, + "affc5d41a23e4a46a27617bc810075a8": { + "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_c9a7b7bf01db4fb1a21c7d59664a9949", + "placeholder": "​", + "style": "IPY_MODEL_40650991d4de480b92abc8a91abca41b", + "value": " 232k/232k [00:00<00:00, 3.59MB/s]" + } + }, + "6b2ae09a409d437faa550a529820d380": { + "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 + } + }, + "585d5d703d634c2d8b5fb8ed45ee88c8": { + "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 + } + }, + "d48ee2a93d2e4d89a3cd290aa4e23ef2": { + "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": "" + } + }, + "76865e3769604df888b7cb6af85a7f97": { + "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 + } + }, + "28aeadf8d26d45e4a96b477760497c36": { + "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": "" + } + }, + "c9a7b7bf01db4fb1a21c7d59664a9949": { + "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 + } + }, + "40650991d4de480b92abc8a91abca41b": { + "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": "" + } + }, + "ad38c28f61ed4ce58f085551e142f242": { + "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_3b03770df99943908d4babc53de9069f", + "IPY_MODEL_bcc437f9c03f47d1b2bf4a0a83f11d33", + "IPY_MODEL_5fedd5628a57489b8a644232c3c6c308" + ], + "layout": "IPY_MODEL_1b65db10dc7a4ec3a6cab537df94880b" + } + }, + "3b03770df99943908d4babc53de9069f": { + "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_887234bfb32246aca5370d9dd6be2d17", + "placeholder": "​", + "style": "IPY_MODEL_30a7f594d4874911bcae724110ff3dd0", + "value": "special_tokens_map.json: 100%" + } + }, + "bcc437f9c03f47d1b2bf4a0a83f11d33": { + "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_21f33fdc787e49c898f00295103c4117", + "max": 132, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_9bd42bc2ed69469c95039cf3bde58e0a", + "value": 132 + } + }, + "5fedd5628a57489b8a644232c3c6c308": { + "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_a2adea0e4320422aa0e34cf0d7959f7a", + "placeholder": "​", + "style": "IPY_MODEL_2b7047384f7e4dca869f780754a849f6", + "value": " 132/132 [00:00<00:00, 2.69kB/s]" + } + }, + "1b65db10dc7a4ec3a6cab537df94880b": { + "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 + } + }, + "887234bfb32246aca5370d9dd6be2d17": { + "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 + } + }, + "30a7f594d4874911bcae724110ff3dd0": { + "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": "" + } + }, + "21f33fdc787e49c898f00295103c4117": { + "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 + } + }, + "9bd42bc2ed69469c95039cf3bde58e0a": { + "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": "" + } + }, + "a2adea0e4320422aa0e34cf0d7959f7a": { + "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 + } + }, + "2b7047384f7e4dca869f780754a849f6": { + "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": "" + } + }, + "397437206f74420d902c06e9b882ad54": { + "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_9cc3b218e6e7432eb3e63a4f057a0e4c", + "IPY_MODEL_e9b20a2fc69c49809d5aa0d737407476", + "IPY_MODEL_5d2ac154f453417fa1213e58c11ae22a" + ], + "layout": "IPY_MODEL_91dad0843f3d44b6acea94fa481ad341" + } + }, + "9cc3b218e6e7432eb3e63a4f057a0e4c": { + "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_f2ca343aec434c7580bd87d7ec0c6fcf", + "placeholder": "​", + "style": "IPY_MODEL_cdb57aa0b9b64a0dbdaa8b3c182998e1", + "value": "tokenizer.json: 100%" + } + }, + "e9b20a2fc69c49809d5aa0d737407476": { + "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_e1b11ef8f2634dc9be64addac317e92f", + "max": 711396, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_da6331b72349419b9a2d8d77e93ed1d8", + "value": 711396 + } + }, + "5d2ac154f453417fa1213e58c11ae22a": { + "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_83ae801315b04f8481673d35483ef65a", + "placeholder": "​", + "style": "IPY_MODEL_138ac735e9a8415d9357e0264fce24fa", + "value": " 711k/711k [00:00<00:00, 7.20MB/s]" + } + }, + "91dad0843f3d44b6acea94fa481ad341": { + "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 + } + }, + "f2ca343aec434c7580bd87d7ec0c6fcf": { + "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 + } + }, + "cdb57aa0b9b64a0dbdaa8b3c182998e1": { + "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": "" + } + }, + "e1b11ef8f2634dc9be64addac317e92f": { + "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 + } + }, + "da6331b72349419b9a2d8d77e93ed1d8": { + "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": "" + } + }, + "83ae801315b04f8481673d35483ef65a": { + "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 + } + }, + "138ac735e9a8415d9357e0264fce24fa": { + "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": "" + } + }, + "845d1c6fea494c0497367e12dbc9d105": { + "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_b2db3dad6bb24a3a8408c15388ad3dfb", + "IPY_MODEL_6b956eecb665442f9da464a0cd20e178", + "IPY_MODEL_b08ae070e19e4169adc690cb17fa6971" + ], + "layout": "IPY_MODEL_7be04d395ee34e01843a28afd10811a0" + } + }, + "b2db3dad6bb24a3a8408c15388ad3dfb": { + "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_fc403fcb99c24579a54c1cce6c8048dc", + "placeholder": "​", + "style": "IPY_MODEL_9905fcad5c4d4e57816426d1ebb9abca", + "value": "config.json: 100%" + } + }, + "6b956eecb665442f9da464a0cd20e178": { + "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_b7803797a1fe482093b5efbbe2633aa1", + "max": 610, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_597bbafff7a6473b9f6bafe1028b3b8b", + "value": 610 + } + }, + "b08ae070e19e4169adc690cb17fa6971": { + "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_5bb6148e41c7440490b75fcffb1d3a7d", + "placeholder": "​", + "style": "IPY_MODEL_075935b99f1547ba80e0edc56bf9e9a9", + "value": " 610/610 [00:00<00:00, 66.6kB/s]" + } + }, + "7be04d395ee34e01843a28afd10811a0": { + "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 + } + }, + "fc403fcb99c24579a54c1cce6c8048dc": { + "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 + } + }, + "9905fcad5c4d4e57816426d1ebb9abca": { + "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": "" + } + }, + "b7803797a1fe482093b5efbbe2633aa1": { + "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 + } + }, + "597bbafff7a6473b9f6bafe1028b3b8b": { + "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": "" + } + }, + "5bb6148e41c7440490b75fcffb1d3a7d": { + "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 + } + }, + "075935b99f1547ba80e0edc56bf9e9a9": { + "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": "" + } + }, + "a6f03d2a2fd549459865dca0bc3dff20": { + "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_40341752775c42938ea12ac202a48ad1", + "IPY_MODEL_cb53bfebe87d47f69a2da1d1dc5b92f3", + "IPY_MODEL_0208e65bfe3f49f2a2e8872cacfcbd45" + ], + "layout": "IPY_MODEL_3e987ada49af4ce39b664f194e3914d9" + } + }, + "40341752775c42938ea12ac202a48ad1": { + "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_dc761015f5b9434d839a5a26269c7805", + "placeholder": "​", + "style": "IPY_MODEL_95ab2f101615401eb6a948b3f4e95d03", + "value": "model.safetensors: 100%" + } + }, + "cb53bfebe87d47f69a2da1d1dc5b92f3": { + "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_39cc3b07643b4b7da234f9707a98a0c6", + "max": 19261432, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_855cde7a39da48c9826ce09ac88e5aa5", + "value": 19261432 + } + }, + "0208e65bfe3f49f2a2e8872cacfcbd45": { + "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_80eb606137144f0f840be5cccf9e0930", + "placeholder": "​", + "style": "IPY_MODEL_1a18c41c53b14621af20d12ece785b3e", + "value": " 19.3M/19.3M [00:00<00:00, 54.7MB/s]" + } + }, + "3e987ada49af4ce39b664f194e3914d9": { + "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 + } + }, + "dc761015f5b9434d839a5a26269c7805": { + "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 + } + }, + "95ab2f101615401eb6a948b3f4e95d03": { + "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": "" + } + }, + "39cc3b07643b4b7da234f9707a98a0c6": { + "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 + } + }, + "855cde7a39da48c9826ce09ac88e5aa5": { + "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": "" + } + }, + "80eb606137144f0f840be5cccf9e0930": { + "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 + } + }, + "1a18c41c53b14621af20d12ece785b3e": { + "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", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 979, + "referenced_widgets": [ + "c6c7e0d1901345578badb5bcf973845d", + "4b0c3d5ca3dc423db4b6ffd841ff0fd0", + "c3d3e3bc5a624cd5b6f7a8739eb3a68a", + "702bb99acd4d49c780b17717abbfe6dc", + "542f013a534843ca99f5c1ba9f01bcca", + "7c7d260dffd04f73b214a9e291f9fc25", + "1fc3385a09b84ee18612783c52cfe62a", + "cfd012fa57e5478590075dd0399c6a68", + "2177e94cce4444bbbca8d278f0b53126", + "e36b702b3688483b8744270954e96547", + "b3453bbe8d3746668d09f711e4405250", + "bbc53c8266ce4c339b7556cef9d2fe98", + "d13dea5b635f4b1a8624a1650a332170", + "c642a67357b74c739d0b122cec98abc1", + "affc5d41a23e4a46a27617bc810075a8", + "6b2ae09a409d437faa550a529820d380", + "585d5d703d634c2d8b5fb8ed45ee88c8", + "d48ee2a93d2e4d89a3cd290aa4e23ef2", + "76865e3769604df888b7cb6af85a7f97", + "28aeadf8d26d45e4a96b477760497c36", + "c9a7b7bf01db4fb1a21c7d59664a9949", + "40650991d4de480b92abc8a91abca41b", + "ad38c28f61ed4ce58f085551e142f242", + "3b03770df99943908d4babc53de9069f", + "bcc437f9c03f47d1b2bf4a0a83f11d33", + "5fedd5628a57489b8a644232c3c6c308", + "1b65db10dc7a4ec3a6cab537df94880b", + "887234bfb32246aca5370d9dd6be2d17", + "30a7f594d4874911bcae724110ff3dd0", + "21f33fdc787e49c898f00295103c4117", + "9bd42bc2ed69469c95039cf3bde58e0a", + "a2adea0e4320422aa0e34cf0d7959f7a", + "2b7047384f7e4dca869f780754a849f6", + "397437206f74420d902c06e9b882ad54", + "9cc3b218e6e7432eb3e63a4f057a0e4c", + "e9b20a2fc69c49809d5aa0d737407476", + "5d2ac154f453417fa1213e58c11ae22a", + "91dad0843f3d44b6acea94fa481ad341", + "f2ca343aec434c7580bd87d7ec0c6fcf", + "cdb57aa0b9b64a0dbdaa8b3c182998e1", + "e1b11ef8f2634dc9be64addac317e92f", + "da6331b72349419b9a2d8d77e93ed1d8", + "83ae801315b04f8481673d35483ef65a", + "138ac735e9a8415d9357e0264fce24fa", + "845d1c6fea494c0497367e12dbc9d105", + "b2db3dad6bb24a3a8408c15388ad3dfb", + "6b956eecb665442f9da464a0cd20e178", + "b08ae070e19e4169adc690cb17fa6971", + "7be04d395ee34e01843a28afd10811a0", + "fc403fcb99c24579a54c1cce6c8048dc", + "9905fcad5c4d4e57816426d1ebb9abca", + "b7803797a1fe482093b5efbbe2633aa1", + "597bbafff7a6473b9f6bafe1028b3b8b", + "5bb6148e41c7440490b75fcffb1d3a7d", + "075935b99f1547ba80e0edc56bf9e9a9", + "a6f03d2a2fd549459865dca0bc3dff20", + "40341752775c42938ea12ac202a48ad1", + "cb53bfebe87d47f69a2da1d1dc5b92f3", + "0208e65bfe3f49f2a2e8872cacfcbd45", + "3e987ada49af4ce39b664f194e3914d9", + "dc761015f5b9434d839a5a26269c7805", + "95ab2f101615401eb6a948b3f4e95d03", + "39cc3b07643b4b7da234f9707a98a0c6", + "855cde7a39da48c9826ce09ac88e5aa5", + "80eb606137144f0f840be5cccf9e0930", + "1a18c41c53b14621af20d12ece785b3e" + ] + }, + "id": "HsmRaw4gb7cY", + "outputId": "81dec567-3123-4d64-f3ae-37e513be96fe" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + "/usr/local/lib/python3.11/dist-packages/huggingface_hub/utils/_auth.py:94: UserWarning: \n", + "The secret `HF_TOKEN` does not exist in your Colab secrets.\n", + "To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.\n", + "You will be able to reuse this secret in all of your notebooks.\n", + "Please note that authentication is recommended but still optional to access public models or datasets.\n", + " warnings.warn(\n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "tokenizer_config.json: 0%| | 0.00/1.36k [00:00" + ], + "text/html": [ + "\n", + "
\n", + " \n", + " \n", + " [174990/174990 1:21:25, Epoch 5/5]\n", + "
\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
EpochTraining LossValidation LossAccuracyF1 Weighted
10.3521000.3248650.9183720.918152
20.2013000.2403210.9390670.938894
30.1778000.2075490.9469530.946888
40.2875000.1947170.9509820.950944
50.2135000.1911160.9523960.952359

" + ] + }, + "metadata": {} + }, + { + "output_type": "stream", + "name": "stderr", + "text": [ + "Training: 100%|██████████| 174990/174990 [1:21:26<00:00, 35.81step/s, epoch=5.00, step=174990]\n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "\n", + "

\n", + " \n", + " \n", + " [8750/8750 01:50]\n", + "
\n", + " " + ] + }, + "metadata": {} + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "✅ Training complete. Model and tokenizer saved to ./neuro-nearby\n", + "✅ Model directory zipped to neuro-nearby.zip\n", + "\n", + "Running test cases...\n", + "\n", + "Test Cases Accuracy: 100.00% (6/6 correct)\n", + "✓ 'Where is the nearest airport to this location?'\n", + " Expected: airport, Predicted: airport, Confidence: 0.999\n", + "✓ 'Can I bring a laptop through airport security?'\n", + " Expected: airport, Predicted: airport, Confidence: 0.999\n", + "✓ 'How do I get to the closest airport terminal?'\n", + " Expected: airport, Predicted: airport, Confidence: 0.999\n", + "✓ 'Need help finding an accounting firm for tax planning.'\n", + " Expected: accounting firm, Predicted: accounting firm, Confidence: 1.000\n", + "✓ 'Can an accounting firm help with financial audits?'\n", + " Expected: accounting firm, Predicted: accounting firm, Confidence: 1.000\n", + "✓ 'Looking for an accounting firm to manage payroll.'\n", + " Expected: accounting firm, Predicted: accounting firm, Confidence: 1.000\n", + "✅ Test cases completed.\n" + ] + } + ], + "source": [ + "import pandas as pd\n", + "from transformers import BertTokenizer, BertForSequenceClassification, Trainer, TrainingArguments, TrainerCallback\n", + "from sklearn.model_selection import train_test_split\n", + "from sklearn.metrics import accuracy_score, f1_score\n", + "import torch\n", + "from torch.utils.data import Dataset\n", + "import shutil\n", + "from tqdm import tqdm\n", + "import numpy as np\n", + "\n", + "# === 0. Define model and output paths ===\n", + "MODEL_NAME = \"boltuix/bert-mini\"\n", + "OUTPUT_DIR = \"./neuro-nearby\"\n", + "\n", + "# === 1. Custom callback for tqdm progress bar ===\n", + "class TQDMProgressBarCallback(TrainerCallback):\n", + " def __init__(self):\n", + " super().__init__()\n", + " self.progress_bar = None\n", + "\n", + " def on_train_begin(self, args, state, control, **kwargs):\n", + " self.total_steps = state.max_steps\n", + " self.progress_bar = tqdm(total=self.total_steps, desc=\"Training\", unit=\"step\")\n", + "\n", + " def on_step_end(self, args, state, control, **kwargs):\n", + " self.progress_bar.update(1)\n", + " self.progress_bar.set_postfix({\n", + " \"epoch\": f\"{state.epoch:.2f}\",\n", + " \"step\": state.global_step\n", + " })\n", + "\n", + " def on_train_end(self, args, state, control, **kwargs):\n", + " if self.progress_bar is not None:\n", + " self.progress_bar.close()\n", + " self.progress_bar = None\n", + "\n", + "# === 2. Load and preprocess data ===\n", + "dataset_path = 'dataset.csv'\n", + "df = pd.read_csv(dataset_path)\n", + "df = df.dropna(subset=['category'])\n", + "df.columns = ['label', 'text'] # Rename columns\n", + "\n", + "# === 3. Encode labels ===\n", + "labels = sorted(df[\"label\"].unique())\n", + "label_to_id = {label: idx for idx, label in enumerate(labels)}\n", + "id_to_label = {idx: label for label, idx in label_to_id.items()}\n", + "df['label'] = df['label'].map(label_to_id)\n", + "\n", + "# === 4. Train-val split ===\n", + "train_texts, val_texts, train_labels, val_labels = train_test_split(\n", + " df['text'].tolist(), df['label'].tolist(), test_size=0.2, random_state=42, stratify=df['label']\n", + ")\n", + "\n", + "# === 5. Tokenizer ===\n", + "tokenizer = BertTokenizer.from_pretrained(MODEL_NAME)\n", + "\n", + "# === 6. Dataset class ===\n", + "class CategoryDataset(Dataset):\n", + " def __init__(self, texts, labels, tokenizer, max_length=128):\n", + " self.texts = texts\n", + " self.labels = labels\n", + " self.tokenizer = tokenizer\n", + " self.max_length = max_length\n", + "\n", + " def __len__(self):\n", + " return len(self.texts)\n", + "\n", + " def __getitem__(self, idx):\n", + " encoding = self.tokenizer(\n", + " self.texts[idx],\n", + " padding='max_length',\n", + " truncation=True,\n", + " max_length=self.max_length,\n", + " return_tensors='pt'\n", + " )\n", + " return {\n", + " 'input_ids': encoding['input_ids'].squeeze(0),\n", + " 'attention_mask': encoding['attention_mask'].squeeze(0),\n", + " 'labels': torch.tensor(self.labels[idx], dtype=torch.long)\n", + " }\n", + "\n", + "# === 7. Load datasets ===\n", + "train_dataset = CategoryDataset(train_texts, train_labels, tokenizer)\n", + "val_dataset = CategoryDataset(val_texts, val_labels, tokenizer)\n", + "\n", + "# === 8. Load model with num_labels ===\n", + "model = BertForSequenceClassification.from_pretrained(\n", + " MODEL_NAME,\n", + " num_labels=len(label_to_id)\n", + ")\n", + "\n", + "# === 9. Define metrics for evaluation ===\n", + "def compute_metrics(eval_pred):\n", + " logits, labels = eval_pred\n", + " predictions = np.argmax(logits, axis=-1)\n", + " acc = accuracy_score(labels, predictions)\n", + " f1 = f1_score(labels, predictions, average='weighted')\n", + " return {\n", + " 'accuracy': acc,\n", + " 'f1_weighted': f1,\n", + " }\n", + "\n", + "# === 10. Training arguments ===\n", + "training_args = TrainingArguments(\n", + " output_dir='./results',\n", + " run_name=\"NeuroNearby\",\n", + " num_train_epochs=5,\n", + " per_device_train_batch_size=16,\n", + " per_device_eval_batch_size=16,\n", + " warmup_steps=500,\n", + " weight_decay=0.01,\n", + " logging_dir='./logs',\n", + " logging_steps=10,\n", + " eval_strategy=\"epoch\", # Corrected from evaluation_strategy\n", + " report_to=\"none\"\n", + ")\n", + "\n", + "\n", + "# === 11. Trainer setup ===\n", + "trainer = Trainer(\n", + " model=model,\n", + " args=training_args,\n", + " train_dataset=train_dataset,\n", + " eval_dataset=val_dataset,\n", + " compute_metrics=compute_metrics,\n", + " callbacks=[TQDMProgressBarCallback()]\n", + ")\n", + "\n", + "# === 12. Train and evaluate ===\n", + "trainer.train()\n", + "trainer.evaluate()\n", + "\n", + "# === 13. Save model and tokenizer ===\n", + "model.config.label2id = label_to_id\n", + "model.config.id2label = id_to_label\n", + "model.config.num_labels = len(label_to_id)\n", + "\n", + "model.save_pretrained(OUTPUT_DIR)\n", + "tokenizer.save_pretrained(OUTPUT_DIR)\n", + "\n", + "# === 14. Zip model directory ===\n", + "shutil.make_archive(\"neuro-nearby\", 'zip', OUTPUT_DIR)\n", + "print(\"✅ Training complete. Model and tokenizer saved to ./neuro-nearby\")\n", + "print(\"✅ Model directory zipped to neuro-nearby.zip\")\n", + "\n", + "# === 15. Test function with confidence threshold ===\n", + "def run_test_cases(model, tokenizer, test_sentences, label_to_id, id_to_label, confidence_threshold=0.5):\n", + " model.eval()\n", + " device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n", + " model.to(device)\n", + "\n", + " correct = 0\n", + " total = len(test_sentences)\n", + " results = []\n", + "\n", + " for text, expected_label in test_sentences:\n", + " encoding = tokenizer(\n", + " text,\n", + " padding='max_length',\n", + " truncation=True,\n", + " max_length=128,\n", + " return_tensors='pt'\n", + " )\n", + " input_ids = encoding['input_ids'].to(device)\n", + " attention_mask = encoding['attention_mask'].to(device)\n", + "\n", + " with torch.no_grad():\n", + " outputs = model(input_ids, attention_mask=attention_mask)\n", + " probs = torch.nn.functional.softmax(outputs.logits, dim=-1)\n", + " max_prob, predicted_id = torch.max(probs, dim=1)\n", + " predicted_label = id_to_label[predicted_id.item()]\n", + " # Apply confidence threshold\n", + " if max_prob.item() < confidence_threshold:\n", + " predicted_label = \"unknown\"\n", + "\n", + " is_correct = (predicted_label == expected_label)\n", + " if is_correct:\n", + " correct += 1\n", + " results.append({\n", + " \"sentence\": text,\n", + " \"expected\": expected_label,\n", + " \"predicted\": predicted_label,\n", + " \"confidence\": max_prob.item(),\n", + " \"correct\": is_correct\n", + " })\n", + "\n", + " accuracy = correct / total * 100\n", + " print(f\"\\nTest Cases Accuracy: {accuracy:.2f}% ({correct}/{total} correct)\")\n", + "\n", + " for r in results:\n", + " status = \"✓\" if r[\"correct\"] else \"✗\"\n", + " print(f\"{status} '{r['sentence']}'\")\n", + " print(f\" Expected: {r['expected']}, Predicted: {r['predicted']}, Confidence: {r['confidence']:.3f}\")\n", + "\n", + " assert accuracy >= 70, f\"Test failed: Accuracy {accuracy:.2f}% < 70%\"\n", + " return results\n", + "\n", + "# === 16. Sample test sentences for testing ===\n", + "test_sentences = [\n", + " (\"Where is the nearest airport to this location?\", \"airport\"),\n", + " (\"Can I bring a laptop through airport security?\", \"airport\"),\n", + " (\"How do I get to the closest airport terminal?\", \"airport\"),\n", + " (\"Need help finding an accounting firm for tax planning.\", \"accounting firm\"),\n", + " (\"Can an accounting firm help with financial audits?\", \"accounting firm\"),\n", + " (\"Looking for an accounting firm to manage payroll.\", \"accounting firm\"),\n", + " # Add more diverse sentences covering your 155 categories\n", + "]\n", + "\n", + "print(\"\\nRunning test cases...\")\n", + "test_results = run_test_cases(model, tokenizer, test_sentences, label_to_id, id_to_label)\n", + "print(\"✅ Test cases completed.\")" + ] + }, + { + "cell_type": "code", + "source": [ + "# === 16. Sample test sentences for testing ===\n", + "test_sentences = [\n", + " (\"show me a store that sells snow shoes\", \"shoe store\"),\n", + " (\"Is there a hotline for reporting a malfunctioning streetlight near City Hall?\", \"city hall\"),\n", + " (\"i need to get my allergy medication refilled\", \"pharmacy\"),\n", + " (\"i have a headache\", \"pharmacy\"),\n", + " (\"Looking for a shop with bike chains.\", \"bicycle store\"),\n", + "]\n", + "print(\"\\nRunning test cases...\")\n", + "test_results = run_test_cases(model, tokenizer, test_sentences, label_to_id, id_to_label)\n", + "print(\"✅ Test cases completed.\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "rTKHC6mP4keH", + "outputId": "2d0a9f1c-4eea-428b-9a09-26ee957c32f2" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n", + "Running test cases...\n", + "\n", + "Test Cases Accuracy: 80.00% (4/5 correct)\n", + "✓ 'show me a store that sells snow shoes'\n", + " Expected: shoe store, Predicted: shoe store, Confidence: 0.788\n", + "✓ 'Is there a hotline for reporting a malfunctioning streetlight near City Hall?'\n", + " Expected: city hall, Predicted: city hall, Confidence: 0.999\n", + "✓ 'i need to get my allergy medication refilled'\n", + " Expected: pharmacy, Predicted: pharmacy, Confidence: 0.994\n", + "✗ 'i have a headache'\n", + " Expected: pharmacy, Predicted: hospital, Confidence: 0.815\n", + "✓ 'Looking for a shop with bike chains.'\n", + " Expected: bicycle store, Predicted: bicycle store, Confidence: 0.997\n", + "✅ Test cases completed.\n" + ] + } + ] + } + ] +} \ No newline at end of file