{ "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": { "700de9123d6743bd8cfd38b2472b6a77": { "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_f32d3ac414d84dae8181a9de8dc58dc9", "IPY_MODEL_05ce5f19bcb2456a91aac192a0b7bddb", "IPY_MODEL_bdb7dfb9e0ae4bc7bb838d645d243b4a" ], "layout": "IPY_MODEL_26c9faf9770248a8bae7f49870014dda" } }, "f32d3ac414d84dae8181a9de8dc58dc9": { "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_fcce776a2aed47fc89e507dfbee0f825", "placeholder": "​", "style": "IPY_MODEL_47dee4d380f94855819f77c908da461d", "value": "tokenizer_config.json: 100%" } }, "05ce5f19bcb2456a91aac192a0b7bddb": { "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_8fc1ab9ac8b2424f9610b8c37f16c27a", "max": 905, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_37d8b4b560d7467b8765a13d307bde60", "value": 905 } }, "bdb7dfb9e0ae4bc7bb838d645d243b4a": { "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_c5386323e3354561be7394b242020759", "placeholder": "​", "style": "IPY_MODEL_03a8799d0c00459f8f0eaa7f4eea17cb", "value": " 905/905 [00:00<00:00, 37.6kB/s]" } }, "26c9faf9770248a8bae7f49870014dda": { "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 } }, "fcce776a2aed47fc89e507dfbee0f825": { "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 } }, "47dee4d380f94855819f77c908da461d": { "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": "" } }, "8fc1ab9ac8b2424f9610b8c37f16c27a": { "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 } }, "37d8b4b560d7467b8765a13d307bde60": { "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": "" } }, "c5386323e3354561be7394b242020759": { "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 } }, "03a8799d0c00459f8f0eaa7f4eea17cb": { "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": "" } }, "370aa09913bc4ecd86d3c728f7178c13": { "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_5595c063c66a4d05b3336cacd20ce80f", "IPY_MODEL_707b8b4b6ca04e5b9e21a0baff59d550", "IPY_MODEL_602d0688585449539c53b290b892e5dd" ], "layout": "IPY_MODEL_f4123196f5454d7e9929aeb22ee46d7f" } }, "5595c063c66a4d05b3336cacd20ce80f": { "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_7f13e11fcebc491aaed844296ad80b4b", "placeholder": "​", "style": "IPY_MODEL_00b5b8ac2124480c998d55b01cc1eba9", "value": "vocab.json: 100%" } }, "707b8b4b6ca04e5b9e21a0baff59d550": { "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_961a7ac497c74091ad176cf88f7751fc", "max": 961143, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_5c2b7467d4bb4b3aae97a4e55d7cd2ab", "value": 961143 } }, "602d0688585449539c53b290b892e5dd": { "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_ecd447c08c18457190ebfc8b8b893bee", "placeholder": "​", "style": "IPY_MODEL_1e8afcb0a94646609b9026f1e665125a", "value": " 961k/961k [00:00<00:00, 7.95MB/s]" } }, "f4123196f5454d7e9929aeb22ee46d7f": { "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 } }, "7f13e11fcebc491aaed844296ad80b4b": { "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 } }, "00b5b8ac2124480c998d55b01cc1eba9": { "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": "" } }, "961a7ac497c74091ad176cf88f7751fc": { "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 } }, "5c2b7467d4bb4b3aae97a4e55d7cd2ab": { "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": "" } }, "ecd447c08c18457190ebfc8b8b893bee": { "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 } }, "1e8afcb0a94646609b9026f1e665125a": { "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": "" } }, "d6b23aaa2bc44eda8d98b7240f9e52d2": { "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_57d83a1e1f9246949ed93794457ec790", "IPY_MODEL_0bca2db2c1c94670b906ae9d7dc91277", "IPY_MODEL_92a0d332f3db4feca034eb46eba30059" ], "layout": "IPY_MODEL_660083229b4648eea1fb34d7013b6bd6" } }, "57d83a1e1f9246949ed93794457ec790": { "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_02eed4862c35402189d6602da0aadd66", "placeholder": "​", "style": "IPY_MODEL_a3fc76725200482db0fe024499664f12", "value": "merges.txt: 100%" } }, "0bca2db2c1c94670b906ae9d7dc91277": { "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_50dafe65120245b18c40367a1b4b4eaf", "max": 524619, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_52064524aba34437a534e0c01c9f625e", "value": 524619 } }, "92a0d332f3db4feca034eb46eba30059": { "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_fa599a118d7a4f989c50715cba9b76d2", "placeholder": "​", "style": "IPY_MODEL_c110929e7c6e4d0888f6884880badfcd", "value": " 525k/525k [00:00<00:00, 12.9MB/s]" } }, "660083229b4648eea1fb34d7013b6bd6": { "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 } }, "02eed4862c35402189d6602da0aadd66": { "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 } }, "a3fc76725200482db0fe024499664f12": { "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": "" } }, "50dafe65120245b18c40367a1b4b4eaf": { "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 } }, "52064524aba34437a534e0c01c9f625e": { "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": "" } }, "fa599a118d7a4f989c50715cba9b76d2": { "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 } }, "c110929e7c6e4d0888f6884880badfcd": { "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": "" } }, "dc9ce716b97c48289bea7896d5747e92": { "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_a0a5408cc1d042c7ad56a67941a4c000", "IPY_MODEL_a4486983a51d49afa4a4ea3eec6311f0", "IPY_MODEL_9fe57aae7d6347f4a043acff2c97fa10" ], "layout": "IPY_MODEL_f7faf855b1414b089ae0a0429a7d2dae" } }, "a0a5408cc1d042c7ad56a67941a4c000": { "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_7c651de2340c4be18cbc41154dc01045", "placeholder": "​", "style": "IPY_MODEL_205bda7206984dafa6a35e3bd310d35d", "value": "tokenizer.json: 100%" } }, "a4486983a51d49afa4a4ea3eec6311f0": { "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_6652a081684d4f13a61bcc2067698cba", "max": 2224003, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_ed37d698176d4b91889a1627a1b3b5d9", "value": 2224003 } }, "9fe57aae7d6347f4a043acff2c97fa10": { "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_e54b9aed9b9e42dfa5a5caf91471136e", "placeholder": "​", "style": "IPY_MODEL_696e6aba710f42b4b1c8d79ec9fd263d", "value": " 2.22M/2.22M [00:00<00:00, 21.8MB/s]" } }, "f7faf855b1414b089ae0a0429a7d2dae": { "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 } }, "7c651de2340c4be18cbc41154dc01045": { "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 } }, "205bda7206984dafa6a35e3bd310d35d": { "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": "" } }, "6652a081684d4f13a61bcc2067698cba": { "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 } }, "ed37d698176d4b91889a1627a1b3b5d9": { "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": "" } }, "e54b9aed9b9e42dfa5a5caf91471136e": { "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 } }, "696e6aba710f42b4b1c8d79ec9fd263d": { "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": "" } }, "1128c744b3694b31a3f8e323f971685d": { "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_bb70227e6e8b40c8a96b91bc4c479837", "IPY_MODEL_dd694122e4d8485381a683a8136d625e", "IPY_MODEL_04b082701b6a4b5d92459425141da697" ], "layout": "IPY_MODEL_63420bca392b477797aa9e422aa9fc20" } }, "bb70227e6e8b40c8a96b91bc4c479837": { "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_99f3f056980944d3aed55212e6ac73a1", "placeholder": "​", "style": "IPY_MODEL_73389602be0a4944acff041ba7d8f200", "value": "special_tokens_map.json: 100%" } }, "dd694122e4d8485381a683a8136d625e": { "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_52b9ea1168c944919fba9cee8c3571a8", "max": 389, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_2978d050850145c3a6e59c53941f258e", "value": 389 } }, "04b082701b6a4b5d92459425141da697": { "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_6c0de1e97a52417bbae2f354c846d9db", "placeholder": "​", "style": "IPY_MODEL_58d9ae79f827490d8cb6339749746331", "value": " 389/389 [00:00<00:00, 18.5kB/s]" } }, "63420bca392b477797aa9e422aa9fc20": { "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 } }, "99f3f056980944d3aed55212e6ac73a1": { "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 } }, "73389602be0a4944acff041ba7d8f200": { "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": "" } }, "52b9ea1168c944919fba9cee8c3571a8": { "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 } }, "2978d050850145c3a6e59c53941f258e": { "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": "" } }, "6c0de1e97a52417bbae2f354c846d9db": { "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 } }, "58d9ae79f827490d8cb6339749746331": { "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": [ "# NOTE : although they have 1x768 dimension , these are not text_encodings , but token vectors\n", "import json\n", "import pandas as pd\n", "import os\n", "import shelve\n", "import torch\n", "from safetensors.torch import save_file , load_file\n", "import json\n", "\n", "home_directory = '/content/'\n", "using_Kaggle = os.environ.get('KAGGLE_URL_BASE','')\n", "if using_Kaggle : home_directory = '/kaggle/working/'\n", "%cd {home_directory}\n", "#-------#\n", "\n", "# Load the data if not already loaded\n", "try:\n", " loaded\n", "except:\n", " %cd {home_directory}\n", " !git clone https://huggingface.co/datasets/codeShare/text-to-image-prompts\n", " loaded = True\n", "#--------#\n", "\n", "def getPrompts(_path, separator):\n", " path = _path + '/text'\n", " path_vec = _path + '/token_vectors'\n", " _file_name = 'vocab'\n", " #-----#\n", " index = 0\n", " prompts = {}\n", " text_encodings = {}\n", " #-----#\n", " for filename in os.listdir(f'{path}'):\n", " print(f'reading {filename}....')\n", " _index = 0\n", " %cd {path}\n", " with open(f'{filename}', 'r') as f:\n", " data = json.load(f)\n", " #------#\n", " _df = pd.DataFrame({'count': data})['count']\n", " prompts = {\n", " key : value for key, value in _df.items()\n", " }\n", "\n", " for key in prompts:\n", " index = index + 1\n", " #------#\n", " NUM_ITEMS = index -1\n", " #------#\n", " %cd {path_vec}\n", " text_encodings = load_file(f'{_file_name}.safetensors')\n", " continue\n", " #----------#\n", " return prompts , text_encodings , NUM_ITEMS\n", "#--------#\n", "\n", "def append_from_url(dictA, tensA , nA , url , separator):\n", " dictB , tensB, nB = getPrompts(url, separator)\n", " dictAB = dictA\n", " tensAB = tensA\n", " nAB = nA\n", " for key in dictB:\n", " nAB = nAB + 1\n", " dictAB[f'{nA + int(key)}'] = dictB[key]\n", " tensAB[f'{nA + int(key)}'] = tensB[key]\n", " #-----#\n", " return dictAB, tensAB , nAB-1\n", "#-------#" ], "metadata": { "id": "V-1DrszLqEVj", "outputId": "c101d131-7fd4-4392-fed6-bbab0e7a4583", "colab": { "base_uri": "https://localhost:8080/" } }, "execution_count": 1, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "/content\n", "/content\n", "Cloning into 'text-to-image-prompts'...\n", "remote: Enumerating objects: 18622, done.\u001b[K\n", "remote: Counting objects: 100% (3/3), done.\u001b[K\n", "remote: Compressing objects: 100% (3/3), done.\u001b[K\n", "remote: Total 18622 (delta 1), reused 0 (delta 0), pack-reused 18619 (from 1)\u001b[K\n", "Receiving objects: 100% (18622/18622), 190.46 MiB | 8.02 MiB/s, done.\n", "Resolving deltas: 100% (2369/2369), done.\n", "Updating files: 100% (8539/8539), done.\n", "Filtering content: 100% (3503/3503), 10.27 GiB | 46.93 MiB/s, done.\n" ] } ] }, { "cell_type": "code", "source": [ "# @title Fetch the json + .safetensor pair\n", "\n", "#------#\n", "vocab = {}\n", "tokens = {}\n", "nA = 0\n", "#--------#\n", "\n", "if True:\n", " url = '/content/text-to-image-prompts/vocab'\n", " vocab , tokens, nA = append_from_url(vocab , tokens, nA , url , '')\n", "#-------#\n", "NUM_TOKENS = nA\n", "#--------#\n", "\n", "if False:\n", " print(NUM_TOKENS) # NUM_TOKENS = 49407\n", " print(vocab['8922']) #ID for banana is 8922" ], "metadata": { "id": "EDCd1IGEqj3-", "outputId": "7e73d97b-eaee-4686-d0a7-1c5bbff96162", "colab": { "base_uri": "https://localhost:8080/" } }, "execution_count": 2, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "reading vocab.json....\n", "/content/text-to-image-prompts/vocab/text\n", "/content/text-to-image-prompts/vocab/token_vectors\n" ] } ] }, { "cell_type": "code", "source": [ "# @title Compare similiarity between tokens\n", "\n", "import torch\n", "from transformers import AutoTokenizer\n", "tokenizer = AutoTokenizer.from_pretrained(\"openai/clip-vit-large-patch14\", clean_up_tokenization_spaces = False)\n", "\n", "# @markdown Write name of token to match against\n", "token_name = \"visual\" # @param {type:'string',\"placeholder\":\"leave empty for random value token\"}\n", "\n", "prompt = token_name\n", "# @markdown (optional) Mix the token with something else\n", "mix_with = \"\" # @param {\"type\":\"string\",\"placeholder\":\"leave empty for random value token\"}\n", "mix_method = \"None\" # @param [\"None\" , \"Average\", \"Subtract\"] {allow-input: true}\n", "w = 0.5 # @param {type:\"slider\", min:0, max:1, step:0.01}\n", "# @markdown Limit char size of included token\n", "\n", "min_char_size = 0 # param {type:\"slider\", min:0, max: 50, step:1}\n", "char_range = 50 # param {type:\"slider\", min:0, max: 50, step:1}\n", "\n", "tokenizer_output = tokenizer(text = prompt)\n", "input_ids = tokenizer_output['input_ids']\n", "id_A = input_ids[1]\n", "A = torch.tensor(tokens[f'{id_A}'])\n", "A = A/A.norm(p=2, dim=-1, keepdim=True)\n", "#-----#\n", "tokenizer_output = tokenizer(text = mix_with)\n", "input_ids = tokenizer_output['input_ids']\n", "id_C = input_ids[1]\n", "C = torch.tensor(tokens[f'{id_C}'])\n", "C = C/C.norm(p=2, dim=-1, keepdim=True)\n", "#-----#\n", "sim_AC = torch.dot(A,C)\n", "#-----#\n", "print(input_ids)\n", "#-----#\n", "\n", "#if no imput exists we just randomize the entire thing\n", "if (prompt == \"\"):\n", " id_A = -1\n", " print(\"Tokenized prompt tensor A is a random valued tensor with no ID\")\n", " R = torch.rand(A.shape)\n", " R = R/R.norm(p=2, dim=-1, keepdim=True)\n", " A = R\n", " name_A = 'random_A'\n", "\n", "#if no imput exists we just randomize the entire thing\n", "if (mix_with == \"\"):\n", " id_C = -1\n", " print(\"Tokenized prompt 'mix_with' tensor C is a random valued tensor with no ID\")\n", " R = torch.rand(A.shape)\n", " R = R/R.norm(p=2, dim=-1, keepdim=True)\n", " C = R\n", " name_C = 'random_C'\n", "\n", "name_A = \"A of random type\"\n", "if (id_A>-1):\n", " name_A = vocab[f'{id_A}']\n", "\n", "name_C = \"token C of random type\"\n", "if (id_C>-1):\n", " name_C = vocab[f'{id_C}']\n", "\n", "print(f\"The similarity between A '{name_A}' and C '{name_C}' is {round(sim_AC.item()*100,2)} %\")\n", "\n", "if (mix_method == \"None\"):\n", " print(\"No operation\")\n", "\n", "if (mix_method == \"Average\"):\n", " A = w*A + (1-w)*C\n", " _A = A.norm(p=2, dim=-1, keepdim=True)\n", " print(f\"Tokenized prompt tensor A '{name_A}' token has been recalculated as A = w*A + (1-w)*C , where C is '{name_C}' token , for w = {w} \")\n", "\n", "if (mix_method == \"Subtract\"):\n", " tmp = w*A - (1-w)*C\n", " tmp = tmp/tmp.norm(p=2, dim=-1, keepdim=True)\n", " A = tmp\n", " #//---//\n", " print(f\"Tokenized prompt tensor A '{name_A}' token has been recalculated as A = _A*norm(w*A - (1-w)*C) , where C is '{name_C}' token , for w = {w} \")\n", "\n", "#OPTIONAL : Add/subtract + normalize above result with another token. Leave field empty to get a random value tensor\n", "\n", "dots = torch.zeros(NUM_TOKENS)\n", "for index in range(NUM_TOKENS):\n", " id_B = index\n", " B = torch.tensor(tokens[f'{id_B}'])\n", " B = B/B.norm(p=2, dim=-1, keepdim=True)\n", " sim_AB = torch.dot(A,B)\n", " dots[index] = sim_AB\n", "\n", "\n", "sorted, indices = torch.sort(dots,dim=0 , descending=True)\n", "#----#\n", "if (mix_method == \"Average\"):\n", " print(f'Calculated all cosine-similarities between the average of token {name_A} and {name_C} with Id_A = {id_A} and mixed Id_C = {id_C} as a 1x{sorted.shape[0]} tensor')\n", "if (mix_method == \"Subtract\"):\n", " print(f'Calculated all cosine-similarities between the subtract of token {name_A} and {name_C} with Id_A = {id_A} and mixed Id_C = {id_C} as a 1x{sorted.shape[0]} tensor')\n", "if (mix_method == \"None\"):\n", " print(f'Calculated all cosine-similarities between the token {name_A} with Id_A = {id_A} with the the rest of the {NUM_TOKENS} tokens as a 1x{sorted.shape[0]} tensor')\n", "\n", "#Produce a list id IDs that are most similiar to the prompt ID at positiion 1 based on above result\n", "\n", "# @markdown Set print options\n", "list_size = 100 # @param {type:'number'}\n", "print_ID = False # @param {type:\"boolean\"}\n", "print_Similarity = True # @param {type:\"boolean\"}\n", "print_Name = True # @param {type:\"boolean\"}\n", "print_Divider = True # @param {type:\"boolean\"}\n", "\n", "\n", "if (print_Divider):\n", " print('//---//')\n", "\n", "print('')\n", "print('Here is the result : ')\n", "print('')\n", "\n", "for index in range(list_size):\n", " id = indices[index].item()\n", " if (print_Name):\n", " print(vocab[f'{id}']) # vocab item\n", " if (print_ID):\n", " print(f'ID = {id}') # IDs\n", " if (print_Similarity):\n", " print(f'similiarity = {round(sorted[index].item()*100,2)} %')\n", " if (print_Divider):\n", " print('--------')\n", "\n", "#Print the sorted list from above result\n", "\n", "#The prompt will be enclosed with the <|start-of-text|> and <|end-of-text|> tokens, which is why output will be [49406, ... , 49407].\n", "\n", "#You can leave the 'prompt' field empty to get a random value tensor. Since the tensor is random value, it will not correspond to any tensor in the vocab.json list , and this it will have no ID.\n", "\n", "# Save results as .db file\n", "import shelve\n", "VOCAB_FILENAME = 'tokens_most_similiar_to_' + name_A.replace('','').strip()\n", "d = shelve.open(VOCAB_FILENAME)\n", "#NUM TOKENS == 49407\n", "for index in range(NUM_TOKENS):\n", " #print(d[f'{index}']) #<-----Use this to read values from the .db file\n", " d[f'{index}']= vocab[f'{indices[index].item()}'] #<---- write values to .db file\n", "#----#\n", "d.close() #close the file\n", "# See this link for additional stuff to do with shelve: https://docs.python.org/3/library/shelve.html" ], "metadata": { "id": "ZwGqg9R5s1QS", "outputId": "7899dd81-440f-4401-d205-f52f5a2da7b8", "colab": { "base_uri": "https://localhost:8080/", "height": 1000, "referenced_widgets": [ "700de9123d6743bd8cfd38b2472b6a77", "f32d3ac414d84dae8181a9de8dc58dc9", "05ce5f19bcb2456a91aac192a0b7bddb", "bdb7dfb9e0ae4bc7bb838d645d243b4a", "26c9faf9770248a8bae7f49870014dda", "fcce776a2aed47fc89e507dfbee0f825", "47dee4d380f94855819f77c908da461d", "8fc1ab9ac8b2424f9610b8c37f16c27a", "37d8b4b560d7467b8765a13d307bde60", "c5386323e3354561be7394b242020759", "03a8799d0c00459f8f0eaa7f4eea17cb", "370aa09913bc4ecd86d3c728f7178c13", "5595c063c66a4d05b3336cacd20ce80f", "707b8b4b6ca04e5b9e21a0baff59d550", "602d0688585449539c53b290b892e5dd", "f4123196f5454d7e9929aeb22ee46d7f", "7f13e11fcebc491aaed844296ad80b4b", "00b5b8ac2124480c998d55b01cc1eba9", "961a7ac497c74091ad176cf88f7751fc", "5c2b7467d4bb4b3aae97a4e55d7cd2ab", "ecd447c08c18457190ebfc8b8b893bee", "1e8afcb0a94646609b9026f1e665125a", "d6b23aaa2bc44eda8d98b7240f9e52d2", "57d83a1e1f9246949ed93794457ec790", "0bca2db2c1c94670b906ae9d7dc91277", "92a0d332f3db4feca034eb46eba30059", "660083229b4648eea1fb34d7013b6bd6", "02eed4862c35402189d6602da0aadd66", "a3fc76725200482db0fe024499664f12", "50dafe65120245b18c40367a1b4b4eaf", "52064524aba34437a534e0c01c9f625e", "fa599a118d7a4f989c50715cba9b76d2", "c110929e7c6e4d0888f6884880badfcd", "dc9ce716b97c48289bea7896d5747e92", "a0a5408cc1d042c7ad56a67941a4c000", "a4486983a51d49afa4a4ea3eec6311f0", "9fe57aae7d6347f4a043acff2c97fa10", "f7faf855b1414b089ae0a0429a7d2dae", "7c651de2340c4be18cbc41154dc01045", "205bda7206984dafa6a35e3bd310d35d", "6652a081684d4f13a61bcc2067698cba", "ed37d698176d4b91889a1627a1b3b5d9", "e54b9aed9b9e42dfa5a5caf91471136e", "696e6aba710f42b4b1c8d79ec9fd263d", "1128c744b3694b31a3f8e323f971685d", "bb70227e6e8b40c8a96b91bc4c479837", "dd694122e4d8485381a683a8136d625e", "04b082701b6a4b5d92459425141da697", "63420bca392b477797aa9e422aa9fc20", "99f3f056980944d3aed55212e6ac73a1", "73389602be0a4944acff041ba7d8f200", "52b9ea1168c944919fba9cee8c3571a8", "2978d050850145c3a6e59c53941f258e", "6c0de1e97a52417bbae2f354c846d9db", "58d9ae79f827490d8cb6339749746331" ] } }, "execution_count": 3, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "tokenizer_config.json: 0%| | 0.00/905 [00:00:23: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).\n", " A = torch.tensor(tokens[f'{id_A}'])\n", ":29: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).\n", " C = torch.tensor(tokens[f'{id_C}'])\n", ":85: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).\n", " B = torch.tensor(tokens[f'{id_B}'])\n" ] }, { "output_type": "stream", "name": "stdout", "text": [ "[49406, 49407]\n", "Tokenized prompt 'mix_with' tensor C is a random valued tensor with no ID\n", "The similarity between A 'visual' and C 'token C of random type' is -2.89 %\n", "No operation\n", "Calculated all cosine-similarities between the token visual with Id_A = 7195 with the the rest of the 49407 tokens as a 1x49407 tensor\n", "//---//\n", "\n", "Here is the result : \n", "\n", "visual\n", "similiarity = 100.0 %\n", "--------\n", "visual\n", "similiarity = 48.21 %\n", "--------\n", "visuals\n", "similiarity = 38.77 %\n", "--------\n", "visually\n", "similiarity = 29.68 %\n", "--------\n", "visu\n", "similiarity = 27.89 %\n", "--------\n", "visualization\n", "similiarity = 21.76 %\n", "--------\n", "graphical\n", "similiarity = 21.66 %\n", "--------\n", "multimedia\n", "similiarity = 21.13 %\n", "--------\n", "pictorial\n", "similiarity = 20.29 %\n", "--------\n", "video\n", "similiarity = 20.2 %\n", "--------\n", "image\n", "similiarity = 19.46 %\n", "--------\n", "creative\n", "similiarity = 19.2 %\n", "--------\n", "visualize\n", "similiarity = 19.04 %\n", "--------\n", "graphic\n", "similiarity = 18.41 %\n", "--------\n", "spatial\n", "similiarity = 18.4 %\n", "--------\n", "aesthetic\n", "similiarity = 17.92 %\n", "--------\n", "cinematic\n", "similiarity = 17.38 %\n", "--------\n", "photo\n", "similiarity = 17.29 %\n", "--------\n", "artistic\n", "similiarity = 17.14 %\n", "--------\n", "physical\n", "similiarity = 17.12 %\n", "--------\n", "sensory\n", "similiarity = 17.07 %\n", "--------\n", "elegant\n", "similiarity = 17.0 %\n", "--------\n", "photographic\n", "similiarity = 16.98 %\n", "--------\n", "infographics\n", "similiarity = 16.94 %\n", "--------\n", "technical\n", "similiarity = 16.87 %\n", "--------\n", "dataviz\n", "similiarity = 16.86 %\n", "--------\n", "cosmetic\n", "similiarity = 16.81 %\n", "--------\n", "portray\n", "similiarity = 16.78 %\n", "--------\n", "vision\n", "similiarity = 16.68 %\n", "--------\n", "image\n", "similiarity = 16.63 %\n", "--------\n", "resource\n", "similiarity = 16.42 %\n", "--------\n", "imaging\n", "similiarity = 16.19 %\n", "--------\n", "documentation\n", "similiarity = 16.15 %\n", "--------\n", "witness\n", "similiarity = 16.13 %\n", "--------\n", "impactful\n", "similiarity = 16.11 %\n", "--------\n", "optical\n", "similiarity = 16.11 %\n", "--------\n", "imagery\n", "similiarity = 15.97 %\n", "--------\n", "neurological\n", "similiarity = 15.86 %\n", "--------\n", "aesthetics\n", "similiarity = 15.72 %\n", "--------\n", "light\n", "similiarity = 15.72 %\n", "--------\n", "aerial\n", "similiarity = 15.49 %\n", "--------\n", "vocal\n", "similiarity = 15.37 %\n", "--------\n", "infographic\n", "similiarity = 15.16 %\n", "--------\n", "video\n", "similiarity = 15.07 %\n", "--------\n", "decorative\n", "similiarity = 15.07 %\n", "--------\n", "viz\n", "similiarity = 14.95 %\n", "--------\n", "visible\n", "similiarity = 14.91 %\n", "--------\n", "erotic\n", "similiarity = 14.82 %\n", "--------\n", "graphicdesign\n", "similiarity = 14.8 %\n", "--------\n", "graphic\n", "similiarity = 14.77 %\n", "--------\n", "symbolic\n", "similiarity = 14.67 %\n", "--------\n", "virtual\n", "similiarity = 14.62 %\n", "--------\n", "plastic\n", "similiarity = 14.54 %\n", "--------\n", "sight\n", "similiarity = 14.54 %\n", "--------\n", "viewing\n", "similiarity = 14.48 %\n", "--------\n", "clinical\n", "similiarity = 14.44 %\n", "--------\n", "graphics\n", "similiarity = 14.4 %\n", "--------\n", "thetic\n", "similiarity = 14.39 %\n", "--------\n", "subtle\n", "similiarity = 14.35 %\n", "--------\n", "basic\n", "similiarity = 14.32 %\n", "--------\n", "retrospective\n", "similiarity = 14.3 %\n", "--------\n", "suspected\n", "similiarity = 14.21 %\n", "--------\n", "vivid\n", "similiarity = 14.18 %\n", "--------\n", "eye\n", "similiarity = 14.14 %\n", "--------\n", "riverside\n", "similiarity = 14.14 %\n", "--------\n", "representation\n", "similiarity = 14.12 %\n", "--------\n", "visionary\n", "similiarity = 14.11 %\n", "--------\n", "illa\n", "similiarity = 14.05 %\n", "--------\n", "tural\n", "similiarity = 14.03 %\n", "--------\n", "consumer\n", "similiarity = 14.0 %\n", "--------\n", "chart\n", "similiarity = 13.98 %\n", "--------\n", "architectural\n", "similiarity = 13.92 %\n", "--------\n", "webdesign\n", "similiarity = 13.89 %\n", "--------\n", "artsy\n", "similiarity = 13.88 %\n", "--------\n", "conceptu\n", "similiarity = 13.82 %\n", "--------\n", "photograph\n", "similiarity = 13.82 %\n", "--------\n", "illustrating\n", "similiarity = 13.81 %\n", "--------\n", "displaying\n", "similiarity = 13.8 %\n", "--------\n", "psychotic\n", "similiarity = 13.71 %\n", "--------\n", "distinctive\n", "similiarity = 13.71 %\n", "--------\n", "signaling\n", "similiarity = 13.67 %\n", "--------\n", "mutual\n", "similiarity = 13.61 %\n", "--------\n", "demographic\n", "similiarity = 13.59 %\n", "--------\n", "distinct\n", "similiarity = 13.57 %\n", "--------\n", "symboli\n", "similiarity = 13.54 %\n", "--------\n", "capturing\n", "similiarity = 13.43 %\n", "--------\n", "spiritual\n", "similiarity = 13.43 %\n", "--------\n", "looking\n", "similiarity = 13.41 %\n", "--------\n", "cultural\n", "similiarity = 13.37 %\n", "--------\n", "ential\n", "similiarity = 13.36 %\n", "--------\n", "vision\n", "similiarity = 13.32 %\n", "--------\n", "journal\n", "similiarity = 13.31 %\n", "--------\n", "rett\n", "similiarity = 13.31 %\n", "--------\n", "girly\n", "similiarity = 13.3 %\n", "--------\n", "ical\n", "similiarity = 13.22 %\n", "--------\n", "sight\n", "similiarity = 13.22 %\n", "--------\n", "demonstr\n", "similiarity = 13.21 %\n", "--------\n", "quantitative\n", "similiarity = 13.16 %\n", "--------\n", "communications\n", "similiarity = 13.14 %\n", "--------\n", "poster\n", "similiarity = 13.11 %\n", "--------\n" ] } ] }, { "cell_type": "markdown", "source": [ "Below is code used to create the .safetensor + json files for the notebook" ], "metadata": { "id": "dGb1KgP_p4_w" } }, { "cell_type": "code", "source": [ "\n", "# @title Do Torch Roll()\n", "\n", "# READ HERE https://pytorch.org/docs/stable/generated/torch.roll.html\n", "\n", "# NOTE : although they have 1x768 dimension , these are not text_encodings , but token vectors\n", "import json\n", "import pandas as pd\n", "import os\n", "import shelve\n", "import torch\n", "from safetensors.torch import save_file , load_file\n", "import json\n", "\n", "home_directory = '/content/'\n", "using_Kaggle = os.environ.get('KAGGLE_URL_BASE','')\n", "if using_Kaggle : home_directory = '/kaggle/working/'\n", "%cd {home_directory}\n", "#-------#\n", "\n", "# Load the data if not already loaded\n", "try:\n", " loaded\n", "except:\n", " %cd {home_directory}\n", " !git clone https://huggingface.co/datasets/codeShare/text-to-image-prompts\n", " loaded = True\n", "#--------#\n", "\n", "# User input\n", "target = home_directory + 'text-to-image-prompts/vocab/'\n", "root_output_folder = home_directory + 'output/'\n", "output_folder = root_output_folder + 'rolls/bare/'\n", "root_filename = 'vocab'\n", "NUM_FILES = 1\n", "#--------#\n", "\n", "#We use the token 'nsfw' at ID 19847\n", "#nude at ID 16630\n", "#naked at ID 11478\n", "#bare with Id_A = 14318\n", "id = 14318\n", "\n", "# Setup environment\n", "def my_mkdirs(folder):\n", " if os.path.exists(folder)==False:\n", " os.makedirs(folder)\n", "#--------#\n", "output_folder_text = output_folder + 'text/'\n", "output_folder_text = output_folder + 'text/'\n", "output_folder_token_vectors = output_folder + 'token_vectors/'\n", "target_raw = target + 'raw/'\n", "%cd {home_directory}\n", "my_mkdirs(output_folder)\n", "my_mkdirs(output_folder_text)\n", "my_mkdirs(output_folder_token_vectors)\n", "#-------#\n", "\n", "\n", "\n", "\n", "\n", "rolls = {}\n", "target = tokens[f'{id}'].clone().detach()\n", "rolls[f'{0}'] = target.clone().detach() #Unmodified\n", "%cd {output_folder_token_vectors}\n", "save_file(rolls , f\"ID{19847}-R{0}.safetensors\")\n", "for times in range(768):\n", " if times <1:continue\n", " rolls = {}\n", " rolls[f'{times}'] = torch.roll(target , times).clone().detach()\n", " save_file(rolls , f\"ID{19847}-R{times}.safetensors\")\n", "#-------#" ], "metadata": { "id": "ersEIbp0A3O6" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "rolls[f'{767}'].shape" ], "metadata": { "id": "0hsJd7PsFjYk" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "AyhYBlP2pYyI" }, "outputs": [], "source": [ "# @title Process the raw vocab into json + .safetensor pair\n", "\n", "# NOTE : although they have 1x768 dimension , these are not text_encodings , but token vectors\n", "import json\n", "import pandas as pd\n", "import os\n", "import shelve\n", "import torch\n", "from safetensors.torch import save_file , load_file\n", "import json\n", "\n", "home_directory = '/content/'\n", "using_Kaggle = os.environ.get('KAGGLE_URL_BASE','')\n", "if using_Kaggle : home_directory = '/kaggle/working/'\n", "%cd {home_directory}\n", "#-------#\n", "\n", "# Load the data if not already loaded\n", "try:\n", " loaded\n", "except:\n", " %cd {home_directory}\n", " !git clone https://huggingface.co/datasets/codeShare/text-to-image-prompts\n", " loaded = True\n", "#--------#\n", "\n", "# User input\n", "target = home_directory + 'text-to-image-prompts/vocab/'\n", "root_output_folder = home_directory + 'output/'\n", "output_folder = root_output_folder + 'vocab/'\n", "root_filename = 'vocab'\n", "NUM_FILES = 1\n", "#--------#\n", "\n", "# Setup environment\n", "def my_mkdirs(folder):\n", " if os.path.exists(folder)==False:\n", " os.makedirs(folder)\n", "#--------#\n", "output_folder_text = output_folder + 'text/'\n", "output_folder_text = output_folder + 'text/'\n", "output_folder_token_vectors = output_folder + 'token_vectors/'\n", "target_raw = target + 'raw/'\n", "%cd {home_directory}\n", "my_mkdirs(output_folder)\n", "my_mkdirs(output_folder_text)\n", "my_mkdirs(output_folder_token_vectors)\n", "#-------#\n", "\n", "%cd {target_raw}\n", "model = torch.load(f'{root_filename}.pt' , weights_only=True)\n", "tokens = model.clone().detach()\n", "\n", "\n", "%cd {target_raw}\n", "with open(f'{root_filename}.json', 'r') as f:\n", " data = json.load(f)\n", "_df = pd.DataFrame({'count': data})['count']\n", "#reverse key and value in the dict\n", "vocab = {\n", " value : key for key, value in _df.items()\n", "}\n", "#------#\n", "\n", "\n", "tensors = {}\n", "names = {}\n", "for key in vocab:\n", " token = tokens[int(key)]\n", " tensors[f'{key}'] = token\n", " names[f'{key}'] = vocab[key]\n", "#-----#\n", "\n", "%cd {output_folder_token_vectors}\n", "save_file(tensors, \"vocab.safetensors\")\n", "\n", "%cd {output_folder_text}\n", "with open('vocab.json', 'w') as f:\n", " json.dump(names, f)\n" ] }, { "cell_type": "code", "source": [], "metadata": { "id": "W_Ig4ZGH18hX" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Determine if this notebook is running on Colab or Kaggle\n", "#Use https://www.kaggle.com/ if Google Colab GPU is busy\n", "home_directory = '/content/'\n", "using_Kaggle = os.environ.get('KAGGLE_URL_BASE','')\n", "if using_Kaggle : home_directory = '/kaggle/working/'\n", "%cd {home_directory}\n", "#-------#\n", "\n", "# @title Download the vocab as .zip\n", "import os\n", "%cd {home_directory}\n", "#os.remove(f'{home_directory}results.zip')\n", "root_output_folder = home_directory + 'output/'\n", "zip_dest = f'{home_directory}results.zip'\n", "!zip -r {zip_dest} {root_output_folder}" ], "metadata": { "id": "9uIDf9IUpzh2" }, "execution_count": null, "outputs": [] } ] }