{ "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": { "version_major": 2, "version_minor": 0, "state": { "c688cebed0a24a4397537160f59456dc": { "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_157b992031564576a76db4b5d7628a22", "IPY_MODEL_8e01c190c6f046cd9907698dfa1d5114", "IPY_MODEL_f846216e34164ce690d38597889537be" ], "layout": "IPY_MODEL_9bbdd17fe1b44003bca018a0356270c4" } }, "157b992031564576a76db4b5d7628a22": { "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_41822898441944409e3b4d1d19600285", "placeholder": "​", "style": "IPY_MODEL_17d7f5eba9704e24a5c6dd16abf1af07", "value": "tokenizer_config.json: " } }, "8e01c190c6f046cd9907698dfa1d5114": { "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_ddf1b5542b4b495782d2f0455c17bdfb", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_5c0c88e4a72b42bbbf3d3d2a84d21e64", "value": 1 } }, "f846216e34164ce690d38597889537be": { "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_7f32ace718304a2c891ca2270a48c7e6", "placeholder": "​", "style": "IPY_MODEL_1dd4b4c89d5445c087e850b04b1275f0", "value": " 7.30k/? [00:00<00:00, 552kB/s]" } }, "9bbdd17fe1b44003bca018a0356270c4": { "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 } }, "41822898441944409e3b4d1d19600285": { "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 } }, "17d7f5eba9704e24a5c6dd16abf1af07": { "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": "" } }, "ddf1b5542b4b495782d2f0455c17bdfb": { "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": "20px" } }, "5c0c88e4a72b42bbbf3d3d2a84d21e64": { "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": "" } }, "7f32ace718304a2c891ca2270a48c7e6": { "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 } }, "1dd4b4c89d5445c087e850b04b1275f0": { "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": "" } }, "96d42579c296428799a3c7b11859ac50": { "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_406178ff1ab349eca760363b588dc5d7", "IPY_MODEL_7354d8c8dd30486bb03113c02bc7cc51", "IPY_MODEL_c70419378b0c464081e2179c5a3d2fd2" ], "layout": "IPY_MODEL_8669050eda7142229b55552d8ea865dd" } }, "406178ff1ab349eca760363b588dc5d7": { "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_aacf9d2dfa424753802b16f36b3f1b89", "placeholder": "​", "style": "IPY_MODEL_65e381cb1e4a43929b88dc9a6878cb0b", "value": "vocab.json: " } }, "7354d8c8dd30486bb03113c02bc7cc51": { "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_0089dace3c3b48a0afa450a77a9f9396", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_18d9b78883ec44febc2665e4bc9f7734", "value": 1 } }, "c70419378b0c464081e2179c5a3d2fd2": { "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_7588acf5a92846f79ff381fa0858c8ef", "placeholder": "​", "style": "IPY_MODEL_8160621d64ee40399eefac0758786733", "value": " 2.78M/? [00:00<00:00, 53.4MB/s]" } }, "8669050eda7142229b55552d8ea865dd": { "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 } }, "aacf9d2dfa424753802b16f36b3f1b89": { "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 } }, "65e381cb1e4a43929b88dc9a6878cb0b": { "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": "" } }, "0089dace3c3b48a0afa450a77a9f9396": { "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": "20px" } }, "18d9b78883ec44febc2665e4bc9f7734": { "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": "" } }, "7588acf5a92846f79ff381fa0858c8ef": { "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 } }, "8160621d64ee40399eefac0758786733": { "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": "" } }, "9c95a06cf8734ce5882015089f630ae2": { "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_ea751e5d80504b46b463a32376c6b89e", "IPY_MODEL_ce9a609aa89e4bf689b0dc9f3c6772d2", "IPY_MODEL_d23d9aae69454385a7a8fd999c8b7133" ], "layout": "IPY_MODEL_571e7195b0ee44488d41f243e74f4971" } }, "ea751e5d80504b46b463a32376c6b89e": { "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_0f3e1df1a1484611a7abd6d387681ac5", "placeholder": "​", "style": "IPY_MODEL_d7024317913242abb056c5386ec8e25b", "value": "merges.txt: " } }, "ce9a609aa89e4bf689b0dc9f3c6772d2": { "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_ec84a54b692f47738073081553f684f9", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_7e05d9bf373742aca64ee31c7fcbc4a1", "value": 1 } }, "d23d9aae69454385a7a8fd999c8b7133": { "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_c5cd4216d5854b02a5af0dac16503814", "placeholder": "​", "style": "IPY_MODEL_254f6d24f1e24484928e56b5ab096e56", "value": " 1.67M/? [00:00<00:00, 47.5MB/s]" } }, "571e7195b0ee44488d41f243e74f4971": { "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 } }, "0f3e1df1a1484611a7abd6d387681ac5": { "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 } }, "d7024317913242abb056c5386ec8e25b": { "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": "" } }, "ec84a54b692f47738073081553f684f9": { "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": "20px" } }, "7e05d9bf373742aca64ee31c7fcbc4a1": { "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": "" } }, "c5cd4216d5854b02a5af0dac16503814": { "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 } }, "254f6d24f1e24484928e56b5ab096e56": { "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": "" } }, "c3bef397f2344506acc115bc526f1835": { "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_546b4556769840da97cb5a143fa1e465", "IPY_MODEL_d13e57a1212a4d479d44bb45d5245961", "IPY_MODEL_a4f1cdcfe3ab42b3b25de10f7fb71a6c" ], "layout": "IPY_MODEL_a8594bcf8b2748f0856a8f43eccce756" } }, "546b4556769840da97cb5a143fa1e465": { "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_90ac166843174352b9e0ab48c28c2825", "placeholder": "​", "style": "IPY_MODEL_53990d1f568f46089b91569e19bf96ff", "value": "tokenizer.json: " } }, "d13e57a1212a4d479d44bb45d5245961": { "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_7f34374a55264326876a554edbeb5b99", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_82c602b07787405d8f79770a61344cba", "value": 1 } }, "a4f1cdcfe3ab42b3b25de10f7fb71a6c": { "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_e188719e0d0f4526831bb7599aa4b72f", "placeholder": "​", "style": "IPY_MODEL_10718fbac7df43bcb7833d1ef23d9aad", "value": " 7.03M/? [00:00<00:00, 121MB/s]" } }, "a8594bcf8b2748f0856a8f43eccce756": { "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 } }, "90ac166843174352b9e0ab48c28c2825": { "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 } }, "53990d1f568f46089b91569e19bf96ff": { "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": "" } }, "7f34374a55264326876a554edbeb5b99": { "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": "20px" } }, "82c602b07787405d8f79770a61344cba": { "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": "" } }, "e188719e0d0f4526831bb7599aa4b72f": { "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 } }, "10718fbac7df43bcb7833d1ef23d9aad": { "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": "" } }, "ce9ce9b6c1b44337998ec52e283363ba": { "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_9b5776c04c3f45dd8c936c052d135d6a", "IPY_MODEL_2a81b5aaa2e640f19b41c7b2baf5f0f2", "IPY_MODEL_23f61ee36e3c44ed9d6d03e224c33447" ], "layout": "IPY_MODEL_668e5554049146c1858380b71ab152e6" } }, "9b5776c04c3f45dd8c936c052d135d6a": { "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_06fbf47543974e499a9499650cb26251", "placeholder": "​", "style": "IPY_MODEL_8116ecf72c48418298b1c4a358ff5f85", "value": "config.json: 100%" } }, "2a81b5aaa2e640f19b41c7b2baf5f0f2": { "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_868626bf3d1d41b4970b7a96414450be", "max": 660, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_14595d57c0a54966a66d44dc2c3e6eec", "value": 660 } }, "23f61ee36e3c44ed9d6d03e224c33447": { "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_7126d8ce72d444ddb110279b3f10666e", "placeholder": "​", "style": "IPY_MODEL_fa504f170ea54d6b84101194d27ac1dc", "value": " 660/660 [00:00<00:00, 54.9kB/s]" } }, "668e5554049146c1858380b71ab152e6": { "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 } }, "06fbf47543974e499a9499650cb26251": { "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 } }, "8116ecf72c48418298b1c4a358ff5f85": { "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": "" } }, "868626bf3d1d41b4970b7a96414450be": { "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 } }, "14595d57c0a54966a66d44dc2c3e6eec": { "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": "" } }, "7126d8ce72d444ddb110279b3f10666e": { "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 } }, "fa504f170ea54d6b84101194d27ac1dc": { "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": "" } }, "73998712481744d88c288470cfa08172": { "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_42b45e32c2b24cd08e26fcef44ee2f39", "IPY_MODEL_60fb468ec0134b8c862a4db4e013c421", "IPY_MODEL_e12a9ccf01a94e68af9a900c05ea7943" ], "layout": "IPY_MODEL_95acf21e430d4be1b9fe62a000d5b74f" } }, "42b45e32c2b24cd08e26fcef44ee2f39": { "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_c190a41b991348a1961b96f35b8ba170", "placeholder": "​", "style": "IPY_MODEL_bd06e278634646ca957b54c944eba0c4", "value": "model.safetensors: 100%" } }, "60fb468ec0134b8c862a4db4e013c421": { "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_88237519cc3d45c0aface31f1dc92723", "max": 3087467144, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_a5533dd696b94e4a9bddab69bfc2c899", "value": 3087467144 } }, "e12a9ccf01a94e68af9a900c05ea7943": { "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_08fbced6e12d45f696d372f09fe4676a", "placeholder": "​", "style": "IPY_MODEL_ad0e94274d6149aba009fec9d34dad9f", "value": " 3.09G/3.09G [00:22<00:00, 146MB/s]" } }, "95acf21e430d4be1b9fe62a000d5b74f": { "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 } }, "c190a41b991348a1961b96f35b8ba170": { "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 } }, "bd06e278634646ca957b54c944eba0c4": { "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": "" } }, "88237519cc3d45c0aface31f1dc92723": { "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 } }, "a5533dd696b94e4a9bddab69bfc2c899": { "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": "" } }, "08fbced6e12d45f696d372f09fe4676a": { "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 } }, "ad0e94274d6149aba009fec9d34dad9f": { "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": "" } }, "11f489e90b5f482d8b32e7263b9fb7a5": { "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_7e4a53eaea0c42a78267cc92fdfdaaa8", "IPY_MODEL_91e5df4970bd46a7a2b0bd7e0113ba85", "IPY_MODEL_d8545f4887ec46dca9a39378e755eabb" ], "layout": "IPY_MODEL_9f6119d19c0e457397b7929e6ef9d8e9" } }, "7e4a53eaea0c42a78267cc92fdfdaaa8": { "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_4dd55af6d0ca496abde214d422627e2d", "placeholder": "​", "style": "IPY_MODEL_bc41ee4dac0340c1bc9db1da3deed59b", "value": "generation_config.json: 100%" } }, "91e5df4970bd46a7a2b0bd7e0113ba85": { "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_7ab9ce875af8490db7cea002b01a7d85", "max": 242, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_8988ecb6ee224f54bbe8f785a88777d2", "value": 242 } }, "d8545f4887ec46dca9a39378e755eabb": { "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_f3af6b38a6fc4f0e94b402bcb28519bc", "placeholder": "​", "style": "IPY_MODEL_0389988d3d30434f906d296ae0f1a4b9", "value": " 242/242 [00:00<00:00, 24.3kB/s]" } }, "9f6119d19c0e457397b7929e6ef9d8e9": { "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 } }, "4dd55af6d0ca496abde214d422627e2d": { "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 } }, "bc41ee4dac0340c1bc9db1da3deed59b": { "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": "" } }, "7ab9ce875af8490db7cea002b01a7d85": { "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 } }, "8988ecb6ee224f54bbe8f785a88777d2": { "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": "" } }, "f3af6b38a6fc4f0e94b402bcb28519bc": { "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 } }, "0389988d3d30434f906d296ae0f1a4b9": { "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": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "j23AFflWprTr", "outputId": "c15b0476-7d18-47fd-95cb-14cfa5043423" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m44.4/44.4 kB\u001b[0m \u001b[31m3.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m9.9/9.9 MB\u001b[0m \u001b[31m47.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m324.4/324.4 kB\u001b[0m \u001b[31m15.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.8/1.8 MB\u001b[0m \u001b[31m29.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m566.4/566.4 kB\u001b[0m \u001b[31m20.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.0/3.0 MB\u001b[0m \u001b[31m43.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", "gradio 6.19.0 requires huggingface-hub<2.0,>=1.2.0, but you have huggingface-hub 0.36.2 which is incompatible.\u001b[0m\u001b[31m\n", "\u001b[0m✅ Dependencies installed. Restart runtime, then run Cell 2 onward.\n" ] } ], "source": [ "# ============================================================\n", "# CELL 1 — Install Dependencies\n", "# ============================================================\n", "!pip install -q transformers==4.45.2 accelerate==0.34.2 faker==26.0.0 pandas==2.2.2\n", "\n", "print(\"✅ Dependencies installed. Restart runtime, then run Cell 2 onward.\")" ] }, { "cell_type": "code", "source": [ "# ============================================================\n", "# CELL 2 — Imports & Configuration\n", "# ============================================================\n", "import os, json, random, warnings\n", "from datetime import datetime\n", "from pathlib import Path\n", "\n", "import pandas as pd\n", "import numpy as np\n", "from faker import Faker\n", "import torch\n", "from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline\n", "\n", "warnings.filterwarnings(\"ignore\")\n", "fake = Faker(\"en_US\")\n", "random.seed(42)\n", "np.random.seed(42)\n", "\n", "# ── Google Drive (survives session resets) ───────────────────\n", "from google.colab import drive\n", "drive.mount(\"/content/drive\")\n", "OUTPUT_DIR = Path(\"/content/drive/MyDrive/prosync_data\")\n", "OUTPUT_DIR.mkdir(parents=True, exist_ok=True)\n", "\n", "VENDOR_CHECKPOINT = OUTPUT_DIR / \"vendors_checkpoint.csv\"\n", "EVENT_CHECKPOINT = OUTPUT_DIR / \"events_checkpoint.csv\"\n", "\n", "# ── Scale toggle ─────────────────────────────────────────────\n", "PILOT_MODE = False\n", "NUM_EVENTS = 10 if PILOT_MODE else 3_000\n", "VENDORS_PER_CATEGORY = 3 if PILOT_MODE else 1_000\n", "CHECKPOINT_EVERY = 5 if PILOT_MODE else 100 # Drive writes are slow\n", "\n", "# ── Domain constants ─────────────────────────────────────────\n", "VENDOR_CATEGORIES = [\n", " \"Catering\", \"AV_Technology\", \"Venue\", \"Security\",\n", " \"Photography_Video\", \"Entertainment\", \"Logistics\",\n", "]\n", "EVENT_TYPES = [\n", " \"Tech Summit\", \"Corporate Gala\", \"Product Launch\",\n", " \"Annual Conference\", \"Award Ceremony\", \"Team Building\",\n", " \"Investor Day\", \"Trade Show\", \"Workshop Series\", \"Brand Activation\",\n", "]\n", "CITIES = [\n", " \"Tel Aviv\", \"Jerusalem\", \"Haifa\", \"Beer Sheva\",\n", " \"Herzliya\", \"Ramat Gan\", \"Petah Tikva\", \"Netanya\",\n", "]\n", "CATERING_STYLES = [\"Vegan\", \"Kosher\", \"International Buffet\",\n", " \"Plated Fine Dining\", \"Street Food\", \"Mediterranean\"]\n", "SEASONS = {1:\"Winter\",2:\"Winter\",3:\"Spring\",4:\"Spring\",5:\"Spring\",\n", " 6:\"Summer\",7:\"Summer\",8:\"Summer\",9:\"Fall\",10:\"Fall\",\n", " 11:\"Fall\",12:\"Winter\"}\n", "CLIENT_INDUSTRIES = [\"Technology\",\"Finance\",\"Healthcare\",\"Retail\",\n", " \"Government\",\"Education\",\"Real Estate\",\"Media\"]\n", "CERTIFICATIONS = [\"ISO 9001\",\"ISO 14001\",\"Halal Certified\",\"Kosher Certified\",\n", " \"Green Event Certified\",\"PCI-DSS\",\"HACCP\"]\n", "SPECIALIZATIONS = {\n", " \"Catering\": [\"Vegan\",\"Kosher\",\"Halal\",\"Gluten-Free\",\"Live Cooking\"],\n", " \"AV_Technology\": [\"LED Walls\",\"Live Streaming\",\"Simultaneous Translation\",\n", " \"Holographic Displays\",\"Stage Design\"],\n", " \"Venue\": [\"Outdoor\",\"Rooftop\",\"Ballroom\",\"Conference Center\",\n", " \"Historic Building\",\"Marina\"],\n", " \"Security\": [\"VIP Protection\",\"Crowd Control\",\"Cybersecurity\",\n", " \"Access Control\",\"K9 Units\"],\n", " \"Photography_Video\": [\"Aerial Drone\",\"360° Video\",\"Live Editing\",\n", " \"Documentary Style\",\"Photo Booth\"],\n", " \"Entertainment\": [\"Live Band\",\"DJ\",\"Comedian\",\"Keynote Speaker\",\n", " \"Magician\",\"Cultural Performance\"],\n", " \"Logistics\": [\"Airport Transfers\",\"Shuttle Service\",\"Equipment Freight\",\n", " \"Customs Clearance\",\"Cold Chain\"],\n", "}\n", "SUBCATEGORIES = {\n", " \"Catering\": [\"Corporate Catering\",\"Gourmet Catering\",\n", " \"Mobile Catering\",\"Cocktail Reception\"],\n", " \"AV_Technology\": [\"Full AV Production\",\"Lighting Design\",\n", " \"Audio Engineering\",\"Broadcast & Streaming\"],\n", " \"Venue\": [\"Hotel Conference Center\",\"Standalone Event Space\",\n", " \"Outdoor Venue\",\"Cultural Heritage Venue\"],\n", " \"Security\": [\"Event Security\",\"Executive Protection\",\n", " \"Crowd Management\",\"Technical Security\"],\n", " \"Photography_Video\": [\"Event Photography\",\"Videography & Editing\",\n", " \"Live Event Streaming\",\"Aerial Photography\"],\n", " \"Entertainment\": [\"Live Music\",\"Corporate DJ\",\n", " \"Keynote & Speakers\",\"Themed Entertainment\"],\n", " \"Logistics\": [\"Ground Transportation\",\"Equipment Logistics\",\n", " \"On-Site Coordination\",\"International Freight\"],\n", "}\n", "BUDGET_BASE = {\n", " \"Tech Summit\":(180,450),\"Corporate Gala\":(220,600),\"Product Launch\":(150,380),\n", " \"Annual Conference\":(130,320),\"Award Ceremony\":(200,520),\"Team Building\":(80,200),\n", " \"Investor Day\":(300,800),\"Trade Show\":(100,280),\"Workshop Series\":(60,160),\n", " \"Brand Activation\":(120,350),\n", "}\n", "CATEGORY_COST_SHARE = {\n", " \"Catering\":(0.28,0.36),\"AV_Technology\":(0.15,0.22),\"Venue\":(0.20,0.28),\n", " \"Security\":(0.04,0.08),\"Photography_Video\":(0.06,0.10),\n", " \"Entertainment\":(0.08,0.14),\"Logistics\":(0.04,0.08),\n", "}\n", "DAY_RATE_RANGES = {\n", " \"Catering\": [(800,2000),(2000,4000),(4000,7000),(7000,12000),(12000,25000)],\n", " \"AV_Technology\": [(1500,3500),(3500,6500),(6500,11000),(11000,18000),(18000,40000)],\n", " \"Venue\": [(2000,5000),(5000,10000),(10000,18000),(18000,30000),(30000,80000)],\n", " \"Security\": [(500,1200),(1200,2500),(2500,4500),(4500,8000),(8000,15000)],\n", " \"Photography_Video\":[(600,1500),(1500,3000),(3000,5500),(5500,9000),(9000,20000)],\n", " \"Entertainment\": [(1000,3000),(3000,6000),(6000,11000),(11000,20000),(20000,60000)],\n", " \"Logistics\": [(800,2000),(2000,4000),(4000,7000),(7000,12000),(12000,25000)],\n", "}\n", "\n", "print(f\"✅ Config loaded | PILOT_MODE={PILOT_MODE}\")\n", "print(f\" Events : {NUM_EVENTS} | Vendors: {len(VENDOR_CATEGORIES)*VENDORS_PER_CATEGORY}\")\n", "print(f\" Output : {OUTPUT_DIR}\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "dHjxoeB8pymq", "outputId": "cddef3c5-b094-416b-fb52-3ce25b94d280" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Mounted at /content/drive\n", "✅ Config loaded | PILOT_MODE=False\n", " Events : 3000 | Vendors: 7000\n", " Output : /content/drive/MyDrive/prosync_data\n" ] } ] }, { "cell_type": "code", "source": [ "# ============================================================\n", "# CELL 3 — Load Model\n", "# ============================================================\n", "MODEL_ID = \"Qwen/Qwen2.5-1.5B-Instruct\"\n", "\n", "print(f\"⏳ Loading {MODEL_ID} ...\")\n", "if torch.cuda.is_available():\n", " props = torch.cuda.get_device_properties(0)\n", " print(f\" GPU : {props.name}\")\n", " print(f\" VRAM : {props.total_memory/1e9:.1f} GB\")\n", "else:\n", " print(\" ⚠️ No GPU detected — generation will be very slow on CPU\")\n", "\n", "dtype = torch.float16 if torch.cuda.is_available() else torch.float32\n", "\n", "tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)\n", "\n", "# Required for left-padding (decoder-only batched inference)\n", "tokenizer.padding_side = \"left\"\n", "if tokenizer.pad_token is None:\n", " tokenizer.pad_token = tokenizer.eos_token\n", "\n", "model = AutoModelForCausalLM.from_pretrained(\n", " MODEL_ID,\n", " torch_dtype=dtype,\n", " device_map=\"auto\",\n", " trust_remote_code=True,\n", " low_cpu_mem_usage=True,\n", ")\n", "model.eval()\n", "\n", "gen_pipe = pipeline(\n", " \"text-generation\",\n", " model=model,\n", " tokenizer=tokenizer,\n", " max_new_tokens=130, # ← 130 is sufficient; 280 was the main time-waster\n", " temperature=0.75,\n", " top_p=0.92,\n", " repetition_penalty=1.15,\n", " do_sample=True,\n", " pad_token_id=tokenizer.eos_token_id,\n", ")\n", "\n", "# Optimal batch size for T4 (15 GB VRAM) with Qwen2.5-1.5B fp16\n", "# Each fp16 forward pass of 1.5B ≈ 3 GB → 4 concurrent sequences safe\n", "# Use 8 for throughput; reduce to 4 if you see CUDA OOM\n", "BATCH_SIZE = 8\n", "\n", "print(f\"✅ Model ready | batch_size={BATCH_SIZE} | max_new_tokens=130\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 309, "referenced_widgets": [ "c688cebed0a24a4397537160f59456dc", "157b992031564576a76db4b5d7628a22", "8e01c190c6f046cd9907698dfa1d5114", "f846216e34164ce690d38597889537be", "9bbdd17fe1b44003bca018a0356270c4", "41822898441944409e3b4d1d19600285", "17d7f5eba9704e24a5c6dd16abf1af07", "ddf1b5542b4b495782d2f0455c17bdfb", "5c0c88e4a72b42bbbf3d3d2a84d21e64", "7f32ace718304a2c891ca2270a48c7e6", "1dd4b4c89d5445c087e850b04b1275f0", "96d42579c296428799a3c7b11859ac50", "406178ff1ab349eca760363b588dc5d7", "7354d8c8dd30486bb03113c02bc7cc51", "c70419378b0c464081e2179c5a3d2fd2", "8669050eda7142229b55552d8ea865dd", "aacf9d2dfa424753802b16f36b3f1b89", "65e381cb1e4a43929b88dc9a6878cb0b", "0089dace3c3b48a0afa450a77a9f9396", "18d9b78883ec44febc2665e4bc9f7734", "7588acf5a92846f79ff381fa0858c8ef", "8160621d64ee40399eefac0758786733", "9c95a06cf8734ce5882015089f630ae2", "ea751e5d80504b46b463a32376c6b89e", "ce9a609aa89e4bf689b0dc9f3c6772d2", "d23d9aae69454385a7a8fd999c8b7133", "571e7195b0ee44488d41f243e74f4971", "0f3e1df1a1484611a7abd6d387681ac5", "d7024317913242abb056c5386ec8e25b", "ec84a54b692f47738073081553f684f9", "7e05d9bf373742aca64ee31c7fcbc4a1", "c5cd4216d5854b02a5af0dac16503814", "254f6d24f1e24484928e56b5ab096e56", "c3bef397f2344506acc115bc526f1835", "546b4556769840da97cb5a143fa1e465", "d13e57a1212a4d479d44bb45d5245961", "a4f1cdcfe3ab42b3b25de10f7fb71a6c", "a8594bcf8b2748f0856a8f43eccce756", "90ac166843174352b9e0ab48c28c2825", "53990d1f568f46089b91569e19bf96ff", "7f34374a55264326876a554edbeb5b99", "82c602b07787405d8f79770a61344cba", "e188719e0d0f4526831bb7599aa4b72f", "10718fbac7df43bcb7833d1ef23d9aad", "ce9ce9b6c1b44337998ec52e283363ba", "9b5776c04c3f45dd8c936c052d135d6a", "2a81b5aaa2e640f19b41c7b2baf5f0f2", "23f61ee36e3c44ed9d6d03e224c33447", "668e5554049146c1858380b71ab152e6", "06fbf47543974e499a9499650cb26251", "8116ecf72c48418298b1c4a358ff5f85", "868626bf3d1d41b4970b7a96414450be", "14595d57c0a54966a66d44dc2c3e6eec", "7126d8ce72d444ddb110279b3f10666e", "fa504f170ea54d6b84101194d27ac1dc", "73998712481744d88c288470cfa08172", "42b45e32c2b24cd08e26fcef44ee2f39", "60fb468ec0134b8c862a4db4e013c421", "e12a9ccf01a94e68af9a900c05ea7943", "95acf21e430d4be1b9fe62a000d5b74f", "c190a41b991348a1961b96f35b8ba170", "bd06e278634646ca957b54c944eba0c4", "88237519cc3d45c0aface31f1dc92723", "a5533dd696b94e4a9bddab69bfc2c899", "08fbced6e12d45f696d372f09fe4676a", "ad0e94274d6149aba009fec9d34dad9f", "11f489e90b5f482d8b32e7263b9fb7a5", "7e4a53eaea0c42a78267cc92fdfdaaa8", "91e5df4970bd46a7a2b0bd7e0113ba85", "d8545f4887ec46dca9a39378e755eabb", "9f6119d19c0e457397b7929e6ef9d8e9", "4dd55af6d0ca496abde214d422627e2d", "bc41ee4dac0340c1bc9db1da3deed59b", "7ab9ce875af8490db7cea002b01a7d85", "8988ecb6ee224f54bbe8f785a88777d2", "f3af6b38a6fc4f0e94b402bcb28519bc", "0389988d3d30434f906d296ae0f1a4b9" ] }, "id": "Vh6ViR02pzFJ", "outputId": "648579f7-761a-42bc-8e48-7d0a0142b9d7" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "⏳ Loading Qwen/Qwen2.5-1.5B-Instruct ...\n", " GPU : Tesla T4\n", " VRAM : 15.6 GB\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "tokenizer_config.json: 0.00B [00:00, ?B/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "c688cebed0a24a4397537160f59456dc" } }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "vocab.json: 0.00B [00:00, ?B/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "96d42579c296428799a3c7b11859ac50" } }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "merges.txt: 0.00B [00:00, ?B/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "9c95a06cf8734ce5882015089f630ae2" } }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "tokenizer.json: 0.00B [00:00, ?B/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "c3bef397f2344506acc115bc526f1835" } }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "config.json: 0%| | 0.00/660 [00:00 str:\n", " messages = [{\"role\": \"system\", \"content\": system},\n", " {\"role\": \"user\", \"content\": user}]\n", " try:\n", " return tokenizer.apply_chat_template(\n", " messages, tokenize=False, add_generation_prompt=True)\n", " except Exception:\n", " return (f\"<|im_start|>system\\n{system}<|im_end|>\\n\"\n", " f\"<|im_start|>user\\n{user}<|im_end|>\\n\"\n", " f\"<|im_start|>assistant\\n\")\n", "\n", "def _clean(raw: str, prompt: str) -> str:\n", " text = raw[len(prompt):].strip()\n", " for tok in [\"<|im_end|>\", \"<|endoftext|>\", \"\"]:\n", " text = text.replace(tok, \"\")\n", " return text.strip()\n", "\n", "# ── Prompt builders (pure string, no LLM call) ───────────────\n", "\n", "_VENDOR_SYSTEM = (\n", " \"You are a B2B procurement specialist writing concise vendor profiles \"\n", " \"for a professional event management platform. Use formal English. \"\n", " \"Write exactly 2 paragraphs: (1) company overview and capabilities, \"\n", " \"(2) why event producers should choose this vendor. Under 130 words total.\"\n", ")\n", "\n", "def _vendor_prompt(v: dict) -> str:\n", " specs = v[\"specializations\"] if isinstance(v[\"specializations\"], list) \\\n", " else json.loads(v[\"specializations\"])\n", " certs = v[\"certifications\"] if isinstance(v[\"certifications\"], list) \\\n", " else json.loads(v[\"certifications\"])\n", " user = (\n", " f\"Write a vendor profile for:\\n\"\n", " f\"Company : {v['vendor_name']}\\n\"\n", " f\"Category : {v['category'].replace('_',' ')}\\n\"\n", " f\"Subcategory: {v['subcategory']}\\n\"\n", " f\"Price Tier : {v['price_tier']}/5\\n\"\n", " f\"Rating : {v['avg_rating']}/5\\n\"\n", " f\"SLA : {v['sla_compliance_rate']*100:.0f}%\\n\"\n", " f\"Response : {v['response_time_hours']}h average\\n\"\n", " f\"Experience : {v['years_in_business']} years\\n\"\n", " f\"Max Guests : {v['guest_capacity_max']:,}\\n\"\n", " f\"Specs : {', '.join(specs)}\\n\"\n", " f\"Certs : {', '.join(certs) or 'None'}\"\n", " )\n", " return _build_prompt(_VENDOR_SYSTEM, user)\n", "\n", "_EVENT_SYSTEM = (\n", " \"You are a senior B2B event consultant writing professional post-event \"\n", " \"summary reports. Use formal English. Write 3 concise paragraphs: \"\n", " \"event objectives, execution highlights, financial/vendor summary. \"\n", " \"Use only the figures provided. Under 130 words total.\"\n", ")\n", "\n", "def _event_prompt(e: dict) -> str:\n", " user = (\n", " f\"Write a post-event summary for:\\n\"\n", " f\"Type : {e['event_type']}\\n\"\n", " f\"Industry : {e['client_industry']}\\n\"\n", " f\"Location : {e['city']}, {e['month_name']} {e['year']}\\n\"\n", " f\"Guests : {e['guest_capacity']:,}\\n\"\n", " f\"Catering : {e['catering_style']}\\n\"\n", " f\"AV Level : {e['av_complexity']}/5\\n\"\n", " f\"Budget : ${e['total_budget_usd']:,.0f}\\n\"\n", " f\"Spend : ${e['actual_spend_usd']:,.0f}\\n\"\n", " f\"Margin : {e['margin_pct']:.1f}%\\n\"\n", " f\"Rating : {e['success_rating']}/5\\n\"\n", " f\"Vendors : {e['vendor_count']}\"\n", " )\n", " return _build_prompt(_EVENT_SYSTEM, user)\n", "\n", "# ── Core batch runner ────────────────────────────────────────\n", "\n", "def generate_texts_batched(\n", " rows: list[dict],\n", " prompt_fn,\n", " label: str,\n", " batch_size: int = BATCH_SIZE,\n", ") -> list[str]:\n", " \"\"\"\n", " Generates text for a list of row dicts in batches.\n", " Returns a list of generated strings in the same order as `rows`.\n", "\n", " This is the core speed improvement: instead of calling gen_pipe()\n", " 10,000 times (one per record), we call it ceil(10000/batch_size) times.\n", " On a T4 with batch_size=8, throughput improves ~5-8x.\n", " \"\"\"\n", " results = [\"\"] * len(rows)\n", "\n", " # Build all prompts upfront (pure Python, no GPU, negligible time)\n", " prompts = [prompt_fn(r) for r in rows]\n", "\n", " n_batches = (len(prompts) + batch_size - 1) // batch_size\n", " processed = 0\n", "\n", " for b_idx in range(n_batches):\n", " start = b_idx * batch_size\n", " end = min(start + batch_size, len(prompts))\n", " batch_prompts = prompts[start:end]\n", "\n", " try:\n", " # pipeline accepts a list → processes as a single batched forward pass\n", " outputs = gen_pipe(batch_prompts, batch_size=len(batch_prompts))\n", " for j, out in enumerate(outputs):\n", " raw = out[0][\"generated_text\"]\n", " results[start + j] = _clean(raw, batch_prompts[j])\n", " except RuntimeError as e:\n", " if \"out of memory\" in str(e).lower():\n", " # Fallback: process individually if batch causes OOM\n", " print(f\"\\n ⚠️ OOM on batch {b_idx+1} — falling back to batch_size=1\")\n", " torch.cuda.empty_cache()\n", " for j, prompt in enumerate(batch_prompts):\n", " try:\n", " out = gen_pipe(prompt)[0][\"generated_text\"]\n", " results[start + j] = _clean(out, prompt)\n", " except Exception as inner_e:\n", " results[start + j] = f\"[error: {inner_e}]\"\n", " else:\n", " # Fill batch with error strings and continue\n", " for j in range(len(batch_prompts)):\n", " results[start + j] = f\"[error: {e}]\"\n", "\n", " processed += len(batch_prompts)\n", " pct = processed / len(prompts) * 100\n", " print(f\" {label} | batch {b_idx+1:>4}/{n_batches} \"\n", " f\"| {processed:>5}/{len(prompts)} records \"\n", " f\"| {pct:>5.1f}%\", end=\"\\r\")\n", "\n", " print() # newline after the progress line\n", " return results\n", "\n", "print(\"✅ Batched generation helpers defined.\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "YNwxhy0Rp13A", "outputId": "333c0cd8-16ff-4254-b7ab-5ff1461fb0d5" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "✅ Batched generation helpers defined.\n" ] } ] }, { "cell_type": "code", "source": [ "# ============================================================\n", "# CELL 5 — Build & Save Dataset B (Vendors)\n", "# ============================================================\n", "\n", "# ── 5a: Build skeleton (vectorized with numpy) ───────────────\n", "def _make_vendors_skeleton(n_per_cat: int) -> pd.DataFrame:\n", " \"\"\"\n", " All structured fields generated with vectorized numpy operations.\n", " No per-row Python loops for numeric columns.\n", " \"\"\"\n", " total = len(VENDOR_CATEGORIES) * n_per_cat\n", " cats = np.repeat(VENDOR_CATEGORIES, n_per_cat)\n", "\n", " tiers = np.random.randint(1, 6, size=total)\n", " ratings = np.round(np.random.uniform(3.2, 5.0, size=total), 2)\n", " sla = np.round(np.random.uniform(0.72, 0.99, size=total), 3)\n", " resp = np.random.choice([1,2,4,6,8,12,24,48], size=total)\n", " cap_min = np.random.randint(20, 101, size=total)\n", " cap_max = cap_min + np.random.randint(100, 4901, size=total)\n", " yrs = np.random.randint(1, 29, size=total)\n", "\n", " rows = []\n", " for i in range(total):\n", " cat = cats[i]\n", " tier = int(tiers[i])\n", " lo, hi = DAY_RATE_RANGES[cat][tier - 1]\n", " specs = random.sample(SPECIALIZATIONS[cat],\n", " k=min(random.randint(2,4), len(SPECIALIZATIONS[cat])))\n", " certs = random.sample(CERTIFICATIONS, k=random.randint(0, 2))\n", " cities = random.sample(CITIES, k=random.randint(1, 4))\n", " seas = random.sample([\"Winter\",\"Spring\",\"Summer\",\"Fall\"],\n", " k=random.randint(2, 4))\n", " suffix = random.choice([\"Events\",\"Productions\",\"Services\",\n", " \"Group\",\"Solutions\",\"Pro\"])\n", " rows.append({\n", " \"vendor_id\": f\"VND-{i+1:05d}\",\n", " \"vendor_name\": fake.company() + \" \" + suffix,\n", " \"category\": cat,\n", " \"subcategory\": random.choice(SUBCATEGORIES[cat]),\n", " \"price_tier\": tier,\n", " \"day_rate_min_usd\": lo,\n", " \"day_rate_max_usd\": hi,\n", " \"avg_rating\": ratings[i],\n", " \"sla_compliance_rate\": sla[i],\n", " \"response_time_hours\": int(resp[i]),\n", " \"guest_capacity_min\": int(cap_min[i]),\n", " \"guest_capacity_max\": int(cap_max[i]),\n", " \"coverage_cities\": json.dumps(cities),\n", " \"seasonal_availability\": json.dumps(seas),\n", " \"specializations\": json.dumps(specs),\n", " \"certifications\": json.dumps(certs),\n", " \"years_in_business\": int(yrs[i]),\n", " \"vendor_profile_text\": \"\",\n", " })\n", " return pd.DataFrame(rows)\n", "\n", "print(\"⏳ Building vendor skeleton ...\")\n", "df_vendors = _make_vendors_skeleton(VENDORS_PER_CATEGORY)\n", "print(f\"✅ {len(df_vendors)} vendors | category balance:\")\n", "print(df_vendors[\"category\"].value_counts().to_string())\n", "\n", "# ── 5b: Resume — load already-generated texts ────────────────\n", "if VENDOR_CHECKPOINT.exists():\n", " print(f\"\\n⚡ Checkpoint found — resuming from {VENDOR_CHECKPOINT.name}\")\n", " ckpt = pd.read_csv(VENDOR_CHECKPOINT)[[\"vendor_id\",\"vendor_profile_text\"]]\n", " # Only keep valid (non-empty) generated texts from checkpoint\n", " ckpt = ckpt[ckpt[\"vendor_profile_text\"].str.len() > 20]\n", " done_map = dict(zip(ckpt[\"vendor_id\"], ckpt[\"vendor_profile_text\"]))\n", " df_vendors[\"vendor_profile_text\"] = df_vendors[\"vendor_id\"].map(done_map).fillna(\"\")\n", " n_done = (df_vendors[\"vendor_profile_text\"].str.len() > 20).sum()\n", " print(f\" Restored : {n_done} / {len(df_vendors)}\")\n", "else:\n", " print(\"\\n No checkpoint found — starting fresh.\")\n", "\n", "# ── 5c: Identify remaining work ──────────────────────────────\n", "todo_mask = df_vendors[\"vendor_profile_text\"].str.len() < 20\n", "todo_df = df_vendors[todo_mask]\n", "print(f\"\\n⏳ Remaining vendors to generate : {len(todo_df)} / {len(df_vendors)}\")\n", "\n", "if len(todo_df) > 0:\n", " # ── 5d: Batched LLM generation ───────────────────────────\n", " todo_rows = todo_df.to_dict(\"records\")\n", " # Pre-parse JSON list fields so _vendor_prompt() gets actual lists\n", " for r in todo_rows:\n", " r[\"specializations\"] = json.loads(r[\"specializations\"])\n", " r[\"certifications\"] = json.loads(r[\"certifications\"])\n", "\n", " print(f\" Batch size : {BATCH_SIZE} | \"\n", " f\"Total batches : {(len(todo_rows)+BATCH_SIZE-1)//BATCH_SIZE}\")\n", "\n", " # Generate in batches with periodic Drive checkpoints\n", " all_texts = []\n", " for chunk_start in range(0, len(todo_rows), CHECKPOINT_EVERY):\n", " chunk = todo_rows[chunk_start : chunk_start + CHECKPOINT_EVERY]\n", " texts = generate_texts_batched(chunk, _vendor_prompt, \"Vendors\")\n", " all_texts.extend(texts)\n", "\n", " # Write checkpoint to Drive\n", " df_vendors.loc[todo_df.index[:len(all_texts)],\n", " \"vendor_profile_text\"] = all_texts\n", " df_vendors.to_csv(VENDOR_CHECKPOINT, index=False)\n", " pct = (chunk_start + len(chunk)) / len(todo_rows) * 100\n", " print(f\" 💾 Checkpoint saved | {chunk_start+len(chunk)}/{len(todo_rows)} \"\n", " f\"({pct:.1f}%)\")\n", "\n", " # Apply remaining texts\n", " df_vendors.loc[todo_df.index, \"vendor_profile_text\"] = all_texts\n", "\n", "# ── 5e: Final save ───────────────────────────────────────────\n", "df_vendors.to_csv(OUTPUT_DIR / \"dataset_b_vendors.csv\", index=False)\n", "df_vendors.to_csv(VENDOR_CHECKPOINT, index=False) # keep checkpoint in sync\n", "print(f\"\\n✅ Dataset B complete → dataset_b_vendors.csv\")\n", "print(f\" LLM text filled: \"\n", " f\"{(df_vendors['vendor_profile_text'].str.len()>20).sum()} / {len(df_vendors)}\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "JI5rrDxzp4hl", "outputId": "be100819-c652-47c0-b39e-fa63a6a83c04" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "⏳ Building vendor skeleton ...\n", "✅ 7000 vendors | category balance:\n", "category\n", "Catering 1000\n", "AV_Technology 1000\n", "Venue 1000\n", "Security 1000\n", "Photography_Video 1000\n", "Entertainment 1000\n", "Logistics 1000\n", "\n", "⚡ Checkpoint found — resuming from vendors_checkpoint.csv\n", " Restored : 7000 / 7000\n", "\n", "⏳ Remaining vendors to generate : 0 / 7000\n", "\n", "✅ Dataset B complete → dataset_b_vendors.csv\n", " LLM text filled: 7000 / 7000\n" ] } ] }, { "cell_type": "code", "source": [ "# ============================================================\n", "# CELL 6 — Build & Save Dataset A (Events)\n", "# ============================================================\n", "\n", "# ── 6a: Pre-index vendors for O(1) lookup ───────────────────\n", "#\n", "# OPTIMIZATION: The original _pick_vendors() ran json.loads() on every\n", "# vendor row for every event (7,000 × 7 × 3,000 = 147M calls).\n", "# We parse each vendor's seasons ONCE here and build lookup dicts.\n", "\n", "print(\"⏳ Pre-indexing vendors for fast event-vendor matching ...\")\n", "\n", "# Structure: {category: [{vendor_id, cap_max, seasons_set}, ...]}\n", "_cat_index: dict[str, list[dict]] = {cat: [] for cat in VENDOR_CATEGORIES}\n", "\n", "for _, vrow in df_vendors.iterrows():\n", " seasons_set = set(json.loads(vrow[\"seasonal_availability\"]))\n", " _cat_index[vrow[\"category\"]].append({\n", " \"vid\": vrow[\"vendor_id\"],\n", " \"cap_max\": int(vrow[\"guest_capacity_max\"]),\n", " \"seasons\": seasons_set,\n", " })\n", "\n", "print(f\"✅ Vendor index built | {sum(len(v) for v in _cat_index.values())} entries\")\n", "\n", "def _pick_vendors_fast(cap: int, season: str) -> dict[str, str]:\n", " \"\"\"\n", " O(n_per_category) lookup — no DataFrame filtering, no json.loads().\n", " Returns {category: vendor_id}.\n", " \"\"\"\n", " sel = {}\n", " for cat, entries in _cat_index.items():\n", " # Prefer vendors that match both capacity AND season\n", " pool = [e[\"vid\"] for e in entries\n", " if e[\"cap_max\"] >= cap and season in e[\"seasons\"]]\n", " if not pool:\n", " pool = [e[\"vid\"] for e in entries] # relax capacity\n", " if pool:\n", " sel[cat] = random.choice(pool)\n", " return sel\n", "\n", "def _cost_breakdown(actual_spend: float, vendor_map: dict) -> dict:\n", " \"\"\"Distributes spend across vendors. Guarantees sum == actual_spend ±$0.01.\"\"\"\n", " raw = {vid: random.uniform(*CATEGORY_COST_SHARE[cat])\n", " for cat, vid in vendor_map.items()}\n", " total = sum(raw.values())\n", " norm = {vid: s / total for vid, s in raw.items()}\n", " bd = {vid: round(norm[vid] * actual_spend, 2) for vid in norm}\n", " diff = round(actual_spend - sum(bd.values()), 2)\n", " if bd:\n", " first = next(iter(bd))\n", " bd[first] = round(bd[first] + diff, 2)\n", " return bd\n", "\n", "# ── 6b: Build event skeleton (all numeric fields vectorized) ──\n", "def _make_events_skeleton(n: int) -> pd.DataFrame:\n", " months = np.random.randint(1, 13, size=n)\n", " years = np.random.randint(2021, 2025, size=n)\n", " seasons_arr = [SEASONS[m] for m in months]\n", " caps = np.random.choice([50,80,100,150,200,300,400,500,\n", " 750,800,1000,1200,1500,2000], size=n)\n", " etypes = [random.choice(EVENT_TYPES) for _ in range(n)]\n", " budgets = np.array([\n", " round(caps[i] * random.uniform(*BUDGET_BASE[etypes[i]]), -2)\n", " for i in range(n)\n", " ])\n", " variance = np.random.uniform(0.92, 1.12, size=n)\n", " spends = np.round(budgets * variance, -2)\n", " margins = np.round((budgets - spends) / budgets * 100, 2)\n", "\n", " rows = []\n", " for i in range(n):\n", " vmap = _pick_vendors_fast(int(caps[i]), seasons_arr[i])\n", " bd = _cost_breakdown(float(spends[i]), vmap)\n", " assert abs(sum(bd.values()) - spends[i]) < 1.0, \\\n", " f\"Cost-breakdown mismatch on event {i+1}\"\n", " rows.append({\n", " \"event_id\": f\"EVT-{i+1:05d}\",\n", " \"event_type\": etypes[i],\n", " \"client_industry\": random.choice(CLIENT_INDUSTRIES),\n", " \"city\": random.choice(CITIES),\n", " \"month\": int(months[i]),\n", " \"month_name\": datetime(2024, int(months[i]), 1).strftime(\"%B\"),\n", " \"year\": int(years[i]),\n", " \"season\": seasons_arr[i],\n", " \"guest_capacity\": int(caps[i]),\n", " \"catering_style\": random.choice(CATERING_STYLES),\n", " \"av_complexity\": int(np.random.randint(1, 6)),\n", " \"total_budget_usd\": float(budgets[i]),\n", " \"actual_spend_usd\": float(spends[i]),\n", " \"margin_pct\": float(margins[i]),\n", " \"vendor_count\": len(vmap),\n", " \"vendor_ids_used\": json.dumps(list(vmap.values())),\n", " \"vendor_cost_breakdown\": json.dumps(bd),\n", " \"success_rating\": round(random.uniform(2.5, 5.0), 1),\n", " \"event_narrative\": \"\",\n", " })\n", " return pd.DataFrame(rows)\n", "\n", "print(\"⏳ Building event skeleton ...\")\n", "df_events = _make_events_skeleton(NUM_EVENTS)\n", "print(f\"✅ {len(df_events)} events | breakdown integrity: \", end=\"\")\n", "errors = sum(\n", " 1 for _, r in df_events.iterrows()\n", " if abs(sum(json.loads(r[\"vendor_cost_breakdown\"]).values()) - r[\"actual_spend_usd\"]) >= 1.0\n", ")\n", "print(f\"{'✅ OK' if errors == 0 else f'❌ {errors} errors'}\")\n", "\n", "# ── 6c: Resume ───────────────────────────────────────────────\n", "if EVENT_CHECKPOINT.exists():\n", " print(f\"\\n⚡ Checkpoint found — resuming from {EVENT_CHECKPOINT.name}\")\n", " ckpt = pd.read_csv(EVENT_CHECKPOINT)[[\"event_id\",\"event_narrative\"]]\n", " ckpt = ckpt[ckpt[\"event_narrative\"].str.len() > 20]\n", " done_map = dict(zip(ckpt[\"event_id\"], ckpt[\"event_narrative\"]))\n", " df_events[\"event_narrative\"] = df_events[\"event_id\"].map(done_map).fillna(\"\")\n", " n_done = (df_events[\"event_narrative\"].str.len() > 20).sum()\n", " print(f\" Restored : {n_done} / {len(df_events)}\")\n", "\n", "# ── 6d: Batched LLM generation ───────────────────────────────\n", "todo_mask = df_events[\"event_narrative\"].str.len() < 20\n", "todo_df = df_events[todo_mask]\n", "todo_rows = todo_df.to_dict(\"records\")\n", "\n", "print(f\"\\n⏳ Remaining events to generate : {len(todo_df)} / {len(df_events)}\")\n", "\n", "if len(todo_df) > 0:\n", " all_texts = []\n", " for chunk_start in range(0, len(todo_rows), CHECKPOINT_EVERY):\n", " chunk = todo_rows[chunk_start : chunk_start + CHECKPOINT_EVERY]\n", " texts = generate_texts_batched(chunk, _event_prompt, \"Events \")\n", " all_texts.extend(texts)\n", "\n", " df_events.loc[todo_df.index[:len(all_texts)],\n", " \"event_narrative\"] = all_texts\n", " df_events.to_csv(EVENT_CHECKPOINT, index=False)\n", " pct = (chunk_start + len(chunk)) / len(todo_rows) * 100\n", " print(f\" 💾 Checkpoint saved | {chunk_start+len(chunk)}/{len(todo_rows)} \"\n", " f\"({pct:.1f}%)\")\n", "\n", " df_events.loc[todo_df.index, \"event_narrative\"] = all_texts\n", "\n", "# ── 6e: Final save ───────────────────────────────────────────\n", "df_events.to_csv(OUTPUT_DIR / \"dataset_a_events.csv\", index=False)\n", "df_events.to_csv(EVENT_CHECKPOINT, index=False)\n", "print(f\"\\n✅ Dataset A complete → dataset_a_events.csv\")\n", "print(f\" LLM text filled: \"\n", " f\"{(df_events['event_narrative'].str.len()>20).sum()} / {len(df_events)}\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "JG2N63xjqBTS", "outputId": "592de3e4-22bf-4802-91d7-1e7d460a4aca" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "⏳ Pre-indexing vendors for fast event-vendor matching ...\n", "✅ Vendor index built | 7000 entries\n", "⏳ Building event skeleton ...\n", "✅ 3000 events | breakdown integrity: ✅ OK\n", "\n", "⚡ Checkpoint found — resuming from events_checkpoint.csv\n", " Restored : 1800 / 3000\n", "\n", "⏳ Remaining events to generate : 1200 / 3000\n" ] }, { "output_type": "stream", "name": "stderr", "text": [ "Starting from v4.46, the `logits` model output will have the same type as the model (except at train time, where it will always be FP32)\n" ] }, { "output_type": "stream", "name": "stdout", "text": [] }, { "output_type": "stream", "name": "stderr", "text": [ "You seem to be using the pipelines sequentially on GPU. In order to maximize efficiency please use a dataset\n" ] }, { "output_type": "stream", "name": "stdout", "text": [ " Events | batch 13/13 | 100/100 records | 100.0%\n", " 💾 Checkpoint saved | 100/1200 (8.3%)\n", " Events | batch 13/13 | 100/100 records | 100.0%\n", " 💾 Checkpoint saved | 200/1200 (16.7%)\n", " Events | batch 13/13 | 100/100 records | 100.0%\n", " 💾 Checkpoint saved | 300/1200 (25.0%)\n", " Events | batch 13/13 | 100/100 records | 100.0%\n", " 💾 Checkpoint saved | 400/1200 (33.3%)\n", " Events | batch 13/13 | 100/100 records | 100.0%\n", " 💾 Checkpoint saved | 500/1200 (41.7%)\n", " Events | batch 13/13 | 100/100 records | 100.0%\n", " 💾 Checkpoint saved | 600/1200 (50.0%)\n", " Events | batch 13/13 | 100/100 records | 100.0%\n", " 💾 Checkpoint saved | 700/1200 (58.3%)\n", " Events | batch 13/13 | 100/100 records | 100.0%\n", " 💾 Checkpoint saved | 800/1200 (66.7%)\n", " Events | batch 13/13 | 100/100 records | 100.0%\n", " 💾 Checkpoint saved | 900/1200 (75.0%)\n", " Events | batch 13/13 | 100/100 records | 100.0%\n", " 💾 Checkpoint saved | 1000/1200 (83.3%)\n", " Events | batch 13/13 | 100/100 records | 100.0%\n", " 💾 Checkpoint saved | 1100/1200 (91.7%)\n", " Events | batch 13/13 | 100/100 records | 100.0%\n", " 💾 Checkpoint saved | 1200/1200 (100.0%)\n", "\n", "✅ Dataset A complete → dataset_a_events.csv\n", " LLM text filled: 3000 / 3000\n" ] } ] }, { "cell_type": "code", "source": [ "# ============================================================\n", "# CELL 7 — Validation Report\n", "# ============================================================\n", "print(\"=\" * 62)\n", "print(\" PROSYNC AI — DATASET VALIDATION REPORT\")\n", "print(\"=\" * 62)\n", "\n", "# ── Dataset B ────────────────────────────────────────────────\n", "print(\"\\n── Dataset B: B2B Vendors ──────────────────────────────\")\n", "bal = df_vendors[\"category\"].value_counts()\n", "print(f\" Rows : {len(df_vendors)}\")\n", "print(f\" Balanced : {bal.nunique() == 1} \"\n", " f\"({bal.iloc[0]} per category)\")\n", "filled_v = (df_vendors[\"vendor_profile_text\"].str.len() > 20).sum()\n", "print(f\" LLM text filled : {filled_v} / {len(df_vendors)}\")\n", "print(f\" Rating — mean {df_vendors['avg_rating'].mean():.2f} \"\n", " f\"| min {df_vendors['avg_rating'].min():.2f} \"\n", " f\"| max {df_vendors['avg_rating'].max():.2f}\")\n", "print(f\" SLA — mean {df_vendors['sla_compliance_rate'].mean():.2%}\")\n", "print(f\"\\n Price-tier distribution:\\n\"\n", " f\"{df_vendors['price_tier'].value_counts().sort_index().to_string()}\")\n", "sample_v = df_vendors.iloc[0]\n", "print(f\"\\n Sample [{sample_v['vendor_id']}]:\")\n", "print(f\" {sample_v['vendor_profile_text'][:300]} ...\")\n", "\n", "# ── Dataset A ────────────────────────────────────────────────\n", "print(\"\\n── Dataset A: Past Events ──────────────────────────────\")\n", "filled_e = (df_events[\"event_narrative\"].str.len() > 20).sum()\n", "print(f\" Rows : {len(df_events)}\")\n", "print(f\" LLM text filled : {filled_e} / {len(df_events)}\")\n", "print(f\"\\n Budget (USD):\\n\"\n", " f\"{df_events['total_budget_usd'].describe().apply(lambda x: f'${x:,.0f}').to_string()}\")\n", "print(f\"\\n Margin %:\\n{df_events['margin_pct'].describe().round(2).to_string()}\")\n", "\n", "# ── Cost-breakdown integrity ──────────────────────────────────\n", "print(\"\\n── vendor_cost_breakdown integrity ────────────────────\")\n", "n_errors = 0\n", "for _, row in df_events.iterrows():\n", " bd = json.loads(row[\"vendor_cost_breakdown\"])\n", " tot = sum(bd.values())\n", " if abs(tot - row[\"actual_spend_usd\"]) >= 1.0:\n", " n_errors += 1\n", "print(f\" {'✅ All OK' if n_errors==0 else f'❌ {n_errors} errors'} \"\n", " f\"(tolerance < $1.00)\")\n", "\n", "# Sample breakdown\n", "print(f\"\\n Sample breakdown [{df_events.iloc[0]['event_id']}]:\")\n", "bd0 = json.loads(df_events.iloc[0][\"vendor_cost_breakdown\"])\n", "vid_cat = df_vendors.set_index(\"vendor_id\")[\"category\"].to_dict()\n", "for vid, cost in bd0.items():\n", " cat = vid_cat.get(vid, \"?\")\n", " print(f\" {vid} ({cat:<20s}) ${cost:>10,.2f}\")\n", "print(f\" {'─'*47}\")\n", "print(f\" {'TOTAL':<26s} ${sum(bd0.values()):>10,.2f}\")\n", "print(f\" {'actual_spend_usd':<26s} \"\n", " f\"${df_events.iloc[0]['actual_spend_usd']:>10,.2f}\")\n", "\n", "# ── Files ─────────────────────────────────────────────────────\n", "print(\"\\n── Saved files ─────────────────────────────────────────\")\n", "for f in sorted(OUTPUT_DIR.glob(\"*.csv\")):\n", " size_mb = f.stat().st_size / 1024 / 1024\n", " print(f\" {f.name:<45s} {size_mb:>6.2f} MB\")\n", "\n", "print(f\"\\n✅ Validation complete | mode={'PILOT' if PILOT_MODE else 'PRODUCTION'}\")\n", "print(f\" Total LLM-generated texts : {filled_v + filled_e} / {len(df_vendors)+len(df_events)}\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "DES0K6NQqE_a", "outputId": "996ded80-5f29-4666-8e9b-56c47badee0b" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "==============================================================\n", " PROSYNC AI — DATASET VALIDATION REPORT\n", "==============================================================\n", "\n", "── Dataset B: B2B Vendors ──────────────────────────────\n", " Rows : 7000\n", " Balanced : True (1000 per category)\n", " LLM text filled : 7000 / 7000\n", " Rating — mean 4.10 | min 3.20 | max 5.00\n", " SLA — mean 85.42%\n", "\n", " Price-tier distribution:\n", "price_tier\n", "1 1395\n", "2 1393\n", "3 1366\n", "4 1418\n", "5 1428\n", "\n", " Sample [VND-00001]:\n", " **Vendor Profile:** \n", "Clark, Hunter & Orozco Pro is an esteemed provider of corporate catering services that has established itself as a leader in the industry with unparalleled expertise. With over eight years of experience under their belt, they have honed their skills to deliver exceptional culin ...\n", "\n", "── Dataset A: Past Events ──────────────────────────────\n", " Rows : 3000\n", " LLM text filled : 3000 / 3000\n", "\n", " Budget (USD):\n", "count $3,000\n", "mean $176,696\n", "std $198,525\n", "min $3,300\n", "25% $35,100\n", "50% $101,550\n", "75% $247,025\n", "max $1,541,900\n", "\n", " Margin %:\n", "count 3000.00\n", "mean -1.92\n", "std 5.78\n", "min -12.26\n", "25% -6.97\n", "50% -1.87\n", "75% 3.20\n", "max 8.05\n", "\n", "── vendor_cost_breakdown integrity ────────────────────\n", " ✅ All OK (tolerance < $1.00)\n", "\n", " Sample breakdown [EVT-00001]:\n", " VND-00706 (Catering ) $ 32,009.72\n", " VND-01483 (AV_Technology ) $ 18,236.33\n", " VND-02269 (Venue ) $ 24,831.73\n", " VND-03311 (Security ) $ 4,475.01\n", " VND-04136 (Photography_Video ) $ 9,256.37\n", " VND-05489 (Entertainment ) $ 11,055.98\n", " VND-06806 (Logistics ) $ 6,234.86\n", " ───────────────────────────────────────────────\n", " TOTAL $106,100.00\n", " actual_spend_usd $106,100.00\n", "\n", "── Saved files ─────────────────────────────────────────\n", " dataset_a_events.csv 3.42 MB\n", " dataset_b_vendors.csv 7.06 MB\n", " events_checkpoint.csv 3.42 MB\n", " vendors_checkpoint.csv 7.06 MB\n", "\n", "✅ Validation complete | mode=PRODUCTION\n", " Total LLM-generated texts : 10000 / 10000\n" ] } ] }, { "cell_type": "code", "source": [], "metadata": { "id": "a1ePwBEmYJtJ" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "sd-r_ERUdA-G", "outputId": "e7d6abe9-5bc2-46ab-9df7-41dd4440c7fb" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "⏳ Loading datasets ...\n", " Vendors : 7,000 rows\n", " Events : 3,000 rows\n", "✅ Originals backed up.\n", "\n", "── Step 1: Artifact prefix stripped ──────────────────\n", " Before: 384 profiles → After: 0\n", "\n", "── Step 2: Vendor price-quality correlation ───────────\n", " Poor performers : 592 vendors (8.5%)\n", " r(tier, rating) : +0.579 (was ≈ -0.017)\n", " r(tier, SLA) : +0.375 (was ≈ -0.003)\n", " Rating range : 1.50 – 5.00\n", " SLA range : 0.301 – 0.990\n", "\n", "── Step 3: Event success rating fat tail ──────────────\n", " Events with rating < 2.5 : 150\n", " New minimum rating : 1.0\n", "\n", "── Step 4: Geographic & seasonal premiums ─────────────\n", " Budget multiplier range : 0.828 – 1.510\n", " New budget range : $4,200 – $1,710,100\n", "\n", "── Step 5: Budget utilisation range ───────────────────\n", " util_rate range : 0.800 – 1.499\n", " Events > 1.25 : 150 (5.0%)\n", " Events over budget : 1650 (55.0%)\n", " Mean util_rate : 1.0292\n", "\n", "── Step 6: Rebuilding vendor cost breakdowns ──────────\n", " Breakdowns rebuilt : 3,000\n", " Integrity errors : 0 (should be 0)\n", " Fine Dining events : 498 (boosted catering allocation)\n", "\n", "==============================================================\n", " ADJUSTMENT COMPLETE — FINAL VALIDATION\n", "==============================================================\n", "\n", "── Vendors ─────────────────────────────────────────────\n", " Rows : 7,000\n", " Rating range : 1.50 – 5.00\n", " SLA range : 0.301 – 0.990\n", " Poor performers : 588 vendors (8.4%)\n", " r(tier, rating) : +0.579\n", " r(tier, SLA) : +0.375\n", "\n", " Rating by price tier:\n", " Tier 1: mean=3.14 std=0.43 min=1.51 max=4.37\n", " Tier 2: mean=3.42 std=0.53 min=1.50 max=4.71\n", " Tier 3: mean=3.76 std=0.59 min=1.50 max=4.88\n", " Tier 4: mean=4.04 std=0.68 min=1.52 max=5.00\n", " Tier 5: mean=4.32 std=0.70 min=1.51 max=5.00\n", "\n", " Artifact prefix remaining : 0\n", "\n", "── Events ──────────────────────────────────────────────\n", " Rows : 3,000\n", " Budget range : $4,200 – $1,710,100\n", " util_rate range : 0.800 – 1.499\n", " Events > 1.25 overrun : 150 (5.0%)\n", " Events over budget : 1650 (55.0%)\n", " Success rating < 2.5 : 150\n", " Success rating minimum : 1.0\n", "\n", " Budget/guest by city:\n", " Tel Aviv : $387/guest\n", " Herzliya : $358/guest\n", " Ramat Gan : $339/guest\n", " Netanya : $325/guest\n", " Jerusalem : $316/guest\n", " Haifa : $302/guest\n", " Petah Tikva : $300/guest\n", " Beer Sheva : $254/guest\n", "\n", "── Cost breakdown integrity ─────────────────────────────\n", " Sum-match errors : 0 ✅\n", "\n", "── Saved files ─────────────────────────────────────────\n", " dataset_b_vendors.csv 7.05 MB\n", " dataset_a_events.csv 3.41 MB\n", "\n", "✅ All adjustments applied and saved.\n", " Originals preserved as *_ORIGINAL.csv\n" ] } ], "source": [ "import json\n", "import warnings\n", "import numpy as np\n", "import pandas as pd\n", "from pathlib import Path\n", "\n", "warnings.filterwarnings(\"ignore\")\n", "\n", "# Reproducible adjustments — same seed → same result every run\n", "RNG = np.random.default_rng(seed=2025)\n", "\n", "DATA_DIR = Path(\"/content/drive/MyDrive/prosync_data\")\n", "\n", "# ── Load datasets ─────────────────────────────────────────────\n", "print(\"⏳ Loading datasets ...\")\n", "df_v = pd.read_csv(DATA_DIR / \"dataset_b_vendors.csv\")\n", "df_e = pd.read_csv(DATA_DIR / \"dataset_a_events.csv\")\n", "print(f\" Vendors : {len(df_v):,} rows\")\n", "print(f\" Events : {len(df_e):,} rows\")\n", "\n", "# Back up originals before touching anything\n", "df_v.to_csv(DATA_DIR / \"dataset_b_vendors_ORIGINAL.csv\", index=False)\n", "df_e.to_csv(DATA_DIR / \"dataset_a_events_ORIGINAL.csv\", index=False)\n", "print(\"✅ Originals backed up.\")\n", "\n", "\n", "# ============================================================\n", "# STEP 1 — STRIP LLM ARTIFACT PREFIX FROM VENDOR PROFILES\n", "# ============================================================\n", "# The raw CSV contains 384 profiles that begin with the literal\n", "# string \"**Vendor Profile:**\" — a prompt-leakage artifact.\n", "# Stripping it here means no downstream code needs to handle it.\n", "\n", "ARTIFACT = \"**Vendor Profile:**\"\n", "n_before = df_v[\"vendor_profile_text\"].str.startswith(ARTIFACT).sum()\n", "\n", "df_v[\"vendor_profile_text\"] = (\n", " df_v[\"vendor_profile_text\"]\n", " .astype(str)\n", " .str.strip()\n", " .str.removeprefix(ARTIFACT)\n", " .str.strip()\n", ")\n", "\n", "n_after = df_v[\"vendor_profile_text\"].str.startswith(ARTIFACT).sum()\n", "print(f\"\\n── Step 1: Artifact prefix stripped ──────────────────\")\n", "print(f\" Before: {n_before} profiles → After: {n_after}\")\n", "\n", "\n", "# ============================================================\n", "# STEP 2 — VENDOR PRICE-QUALITY CORRELATION\n", "# ============================================================\n", "# Original issue: avg_rating and sla_compliance_rate are\n", "# completely uncorrelated with price_tier (r ≈ -0.017).\n", "# Real B2B markets show r ≈ 0.3–0.5 between price and quality.\n", "#\n", "# Approach: For the ~90% \"normal\" vendors, draw rating and SLA\n", "# from tier-specific normal distributions that overlap but have\n", "# distinct means. Clip to the realistic range.\n", "#\n", "# Tier means (rating): 1→3.2 2→3.5 3→3.9 4→4.2 5→4.5\n", "# Tier means (SLA): 1→0.78 2→0.82 3→0.86 4→0.90 5→0.94\n", "\n", "TIER_RATING_MEANS = {1: 3.20, 2: 3.55, 3: 3.90, 4: 4.20, 5: 4.50}\n", "TIER_SLA_MEANS = {1: 0.78, 2: 0.82, 3: 0.86, 4: 0.90, 5: 0.94}\n", "RATING_STD = 0.35 # wide enough for realistic overlap\n", "SLA_STD = 0.055\n", "\n", "n_vendors = len(df_v)\n", "normal_mask = RNG.random(n_vendors) > 0.09 # ~91% normal, ~9% poor\n", "\n", "# Normal performers: tier-dependent quality\n", "new_ratings = np.zeros(n_vendors)\n", "new_sla = np.zeros(n_vendors)\n", "\n", "for tier in [1, 2, 3, 4, 5]:\n", " tier_mask = (df_v[\"price_tier\"] == tier).values & normal_mask\n", " n_tier = tier_mask.sum()\n", " if n_tier == 0:\n", " continue\n", " new_ratings[tier_mask] = np.clip(\n", " RNG.normal(TIER_RATING_MEANS[tier], RATING_STD, n_tier), 2.8, 5.0\n", " )\n", " new_sla[tier_mask] = np.clip(\n", " RNG.normal(TIER_SLA_MEANS[tier], SLA_STD, n_tier), 0.65, 0.99\n", " )\n", "\n", "# Poor performers: fat tail (~9% of total = ~630 vendors)\n", "poor_mask = ~normal_mask\n", "n_poor = poor_mask.sum()\n", "new_ratings[poor_mask] = np.round(RNG.uniform(1.5, 2.8, n_poor), 2)\n", "new_sla[poor_mask] = np.round(RNG.uniform(0.30, 0.60, n_poor), 3)\n", "\n", "# Round and assign\n", "df_v[\"avg_rating\"] = np.round(new_ratings, 2)\n", "df_v[\"sla_compliance_rate\"] = np.round(new_sla, 3)\n", "\n", "from scipy.stats import pearsonr\n", "r_rat, _ = pearsonr(df_v[\"price_tier\"], df_v[\"avg_rating\"])\n", "r_sla, _ = pearsonr(df_v[\"price_tier\"], df_v[\"sla_compliance_rate\"])\n", "print(f\"\\n── Step 2: Vendor price-quality correlation ───────────\")\n", "print(f\" Poor performers : {n_poor} vendors ({n_poor/n_vendors*100:.1f}%)\")\n", "print(f\" r(tier, rating) : {r_rat:+.3f} (was ≈ -0.017)\")\n", "print(f\" r(tier, SLA) : {r_sla:+.3f} (was ≈ -0.003)\")\n", "print(f\" Rating range : {df_v['avg_rating'].min():.2f} – {df_v['avg_rating'].max():.2f}\")\n", "print(f\" SLA range : {df_v['sla_compliance_rate'].min():.3f} – {df_v['sla_compliance_rate'].max():.3f}\")\n", "\n", "\n", "# ============================================================\n", "# STEP 3 — EVENT SUCCESS RATING FAT TAIL\n", "# ============================================================\n", "# Original issue: success_rating has a hard floor at 2.5.\n", "# Real event portfolios include genuine failures (flooded venues,\n", "# caterer no-shows, AV crashes) that score 1.0–2.4.\n", "# We inject ~5% of events into this failure zone so the\n", "# comparable-event retrieval engine can learn from disasters.\n", "\n", "n_events = len(df_e)\n", "n_poor_events = int(n_events * 0.05) # 150 events\n", "poor_evt_idx = RNG.choice(n_events, size=n_poor_events, replace=False)\n", "\n", "df_e[\"success_rating\"] = df_e[\"success_rating\"].astype(float)\n", "df_e.loc[poor_evt_idx, \"success_rating\"] = np.round(\n", " RNG.uniform(1.0, 2.4, n_poor_events), 1\n", ")\n", "\n", "print(f\"\\n── Step 3: Event success rating fat tail ──────────────\")\n", "print(f\" Events with rating < 2.5 : {(df_e['success_rating'] < 2.5).sum()}\")\n", "print(f\" New minimum rating : {df_e['success_rating'].min():.1f}\")\n", "\n", "\n", "# ============================================================\n", "# STEP 4 — GEOGRAPHIC & SEASONAL BUDGET PREMIUMS\n", "# ============================================================\n", "# Original issue: Tel Aviv and Beer Sheva cost the same, and\n", "# Summer events cost the same as January events. Real markets\n", "# have strong city-tier and seasonal pricing effects.\n", "#\n", "# Multipliers are applied to total_budget_usd.\n", "# actual_spend_usd is derived later (after util_rate is reset).\n", "\n", "CITY_PREMIUM = {\n", " \"Tel Aviv\": 1.28,\n", " \"Herzliya\": 1.22,\n", " \"Jerusalem\": 1.12,\n", " \"Ramat Gan\": 1.08,\n", " \"Netanya\": 1.05,\n", " \"Petah Tikva\": 1.02,\n", " \"Haifa\": 1.00, # baseline\n", " \"Beer Sheva\": 0.90,\n", "}\n", "\n", "def seasonal_multiplier(month: int) -> float:\n", " \"\"\"Premium by calendar month.\"\"\"\n", " if month in [6, 7, 8]: return 1.18 # Summer\n", " if month == 12: return 1.15 # December holiday\n", " if month in [9, 10, 11]: return 1.05 # Fall\n", " if month in [3, 4, 5]: return 1.00 # Spring (baseline)\n", " return 0.92 # Jan–Feb (off-peak)\n", "\n", "city_mult = df_e[\"city\"].map(CITY_PREMIUM).fillna(1.0).values\n", "season_mult = df_e[\"month\"].apply(seasonal_multiplier).values\n", "combined = city_mult * season_mult\n", "\n", "df_e[\"total_budget_usd\"] = np.round(\n", " df_e[\"total_budget_usd\"].values * combined, -2\n", ")\n", "\n", "print(f\"\\n── Step 4: Geographic & seasonal premiums ─────────────\")\n", "print(f\" Budget multiplier range : {combined.min():.3f} – {combined.max():.3f}\")\n", "print(f\" New budget range : ${df_e['total_budget_usd'].min():,.0f}\"\n", " f\" – ${df_e['total_budget_usd'].max():,.0f}\")\n", "\n", "\n", "# ============================================================\n", "# STEP 5 — EXPAND BUDGET UTILISATION RANGE\n", "# ============================================================\n", "# Original issue: util_rate is bounded [0.92, 1.12] — the\n", "# dataset has never seen a serious overrun. Real events can\n", "# overrun by 30–50% due to last-minute additions or supplier\n", "# surprises.\n", "#\n", "# New distribution:\n", "# 5% of events → util_rate ∈ [1.25, 1.50] (extreme overruns)\n", "# 95% of events → util_rate ∈ [0.80, 1.22] (normal range)\n", "#\n", "# actual_spend_usd = total_budget_usd × util_rate (rounded to $100)\n", "# margin_pct is recomputed from scratch.\n", "\n", "n_extreme = int(n_events * 0.05) # 150 events\n", "extreme_idx = RNG.choice(n_events, size=n_extreme, replace=False)\n", "normal_idx = np.setdiff1d(np.arange(n_events), extreme_idx)\n", "\n", "new_util = np.zeros(n_events)\n", "new_util[extreme_idx] = RNG.uniform(1.25, 1.50, len(extreme_idx))\n", "new_util[normal_idx] = RNG.uniform(0.80, 1.22, len(normal_idx))\n", "\n", "df_e[\"actual_spend_usd\"] = np.round(\n", " df_e[\"total_budget_usd\"].values * new_util, -2\n", ")\n", "df_e[\"margin_pct\"] = np.round(\n", " (df_e[\"total_budget_usd\"] - df_e[\"actual_spend_usd\"])\n", " / df_e[\"total_budget_usd\"] * 100, 2\n", ")\n", "\n", "util_actual = df_e[\"actual_spend_usd\"] / df_e[\"total_budget_usd\"]\n", "print(f\"\\n── Step 5: Budget utilisation range ───────────────────\")\n", "print(f\" util_rate range : {util_actual.min():.3f} – {util_actual.max():.3f}\")\n", "print(f\" Events > 1.25 : {(util_actual > 1.25).sum()} ({(util_actual>1.25).mean()*100:.1f}%)\")\n", "print(f\" Events over budget : {(util_actual > 1.0).sum()} ({(util_actual>1.0).mean()*100:.1f}%)\")\n", "print(f\" Mean util_rate : {util_actual.mean():.4f}\")\n", "\n", "\n", "# ============================================================\n", "# STEP 6 — REBUILD VENDOR COST BREAKDOWN\n", "# ============================================================\n", "# Two sub-tasks:\n", "# A) Apply event-type-specific allocation ratios (instead of\n", "# the uniform ratios from the original generation)\n", "# B) Apply a Plated Fine Dining catering premium (+70%)\n", "# within the allocation, proportionally reducing others\n", "#\n", "# The rebuild guarantees: sum(breakdown.values()) == actual_spend_usd\n", "\n", "EVENT_ALLOC = {\n", " # fmt: ratios must sum to 1.000\n", " \"Tech Summit\": {\"Catering\":0.250, \"AV_Technology\":0.250, \"Venue\":0.220,\n", " \"Security\":0.050, \"Photography_Video\":0.075,\n", " \"Entertainment\":0.080, \"Logistics\":0.075},\n", " \"Corporate Gala\": {\"Catering\":0.320, \"AV_Technology\":0.148, \"Venue\":0.250,\n", " \"Security\":0.060, \"Photography_Video\":0.082,\n", " \"Entertainment\":0.100, \"Logistics\":0.040},\n", " \"Product Launch\": {\"Catering\":0.280, \"AV_Technology\":0.220, \"Venue\":0.200,\n", " \"Security\":0.040, \"Photography_Video\":0.100,\n", " \"Entertainment\":0.080, \"Logistics\":0.080},\n", " \"Annual Conference\": {\"Catering\":0.300, \"AV_Technology\":0.200, \"Venue\":0.240,\n", " \"Security\":0.050, \"Photography_Video\":0.060,\n", " \"Entertainment\":0.070, \"Logistics\":0.080},\n", " \"Award Ceremony\": {\"Catering\":0.280, \"AV_Technology\":0.180, \"Venue\":0.250,\n", " \"Security\":0.060, \"Photography_Video\":0.100,\n", " \"Entertainment\":0.090, \"Logistics\":0.040},\n", " \"Team Building\": {\"Catering\":0.220, \"AV_Technology\":0.100, \"Venue\":0.180,\n", " \"Security\":0.050, \"Photography_Video\":0.080,\n", " \"Entertainment\":0.220, \"Logistics\":0.150},\n", " \"Investor Day\": {\"Catering\":0.250, \"AV_Technology\":0.220, \"Venue\":0.280,\n", " \"Security\":0.070, \"Photography_Video\":0.080,\n", " \"Entertainment\":0.060, \"Logistics\":0.040},\n", " \"Trade Show\": {\"Catering\":0.260, \"AV_Technology\":0.200, \"Venue\":0.220,\n", " \"Security\":0.060, \"Photography_Video\":0.070,\n", " \"Entertainment\":0.080, \"Logistics\":0.110},\n", " \"Workshop Series\": {\"Catering\":0.280, \"AV_Technology\":0.180, \"Venue\":0.220,\n", " \"Security\":0.040, \"Photography_Video\":0.060,\n", " \"Entertainment\":0.100, \"Logistics\":0.120},\n", " \"Brand Activation\": {\"Catering\":0.240, \"AV_Technology\":0.200, \"Venue\":0.200,\n", " \"Security\":0.040, \"Photography_Video\":0.120,\n", " \"Entertainment\":0.140, \"Logistics\":0.060},\n", "}\n", "# Verify all ratios sum to 1.0\n", "for etype, ratios in EVENT_ALLOC.items():\n", " total = sum(ratios.values())\n", " assert abs(total - 1.0) < 1e-6, f\"{etype} ratios sum to {total:.6f}\"\n", "\n", "# Build category lookup from vendor table\n", "cat_map = df_v.set_index(\"vendor_id\")[\"category\"].to_dict()\n", "\n", "FINE_DINING_BOOST = 1.70 # Plated Fine Dining catering premium\n", "\n", "print(f\"\\n── Step 6: Rebuilding vendor cost breakdowns ──────────\")\n", "\n", "new_breakdowns = []\n", "bd_errors = 0\n", "\n", "for _, row in df_e.iterrows():\n", "\n", " # Parse the list of vendor IDs for this event\n", " vendor_ids = json.loads(row[\"vendor_ids_used\"])\n", "\n", " # Map each vendor_id → category\n", " cat_to_vid = {}\n", " for vid in vendor_ids:\n", " cat = cat_map.get(vid)\n", " if cat:\n", " cat_to_vid[cat] = vid\n", "\n", " # Get event-type allocation ratios (copy so we can mutate)\n", " ratios = dict(EVENT_ALLOC.get(row[\"event_type\"], EVENT_ALLOC[\"Annual Conference\"]))\n", "\n", " # Apply Plated Fine Dining catering premium\n", " if row.get(\"catering_style\") == \"Plated Fine Dining\" and \"Catering\" in ratios:\n", " catering_old = ratios[\"Catering\"]\n", " catering_new = catering_old * FINE_DINING_BOOST\n", " excess = catering_new - catering_old # amount to redistribute\n", " other_cats = [c for c in ratios if c != \"Catering\"]\n", " other_sum = sum(ratios[c] for c in other_cats)\n", " if other_sum > 0:\n", " for cat in other_cats:\n", " ratios[cat] -= excess * (ratios[cat] / other_sum)\n", " ratios[\"Catering\"] = catering_new\n", " # Normalize so ratios still sum to exactly 1.0\n", " total = sum(ratios.values())\n", " ratios = {k: v / total for k, v in ratios.items()}\n", "\n", " # Assign costs based on ratios × actual spend\n", " actual_spend = row[\"actual_spend_usd\"]\n", " bd = {}\n", " for cat, ratio in ratios.items():\n", " if cat in cat_to_vid:\n", " bd[cat_to_vid[cat]] = round(actual_spend * ratio, 2)\n", "\n", " # Fix rounding drift (guarantee sum == actual_spend exactly)\n", " if bd:\n", " diff = round(actual_spend - sum(bd.values()), 2)\n", " first_vid = next(iter(bd))\n", " bd[first_vid] = round(bd[first_vid] + diff, 2)\n", "\n", " # Final integrity check\n", " if abs(sum(bd.values()) - actual_spend) >= 1.0:\n", " bd_errors += 1\n", "\n", " new_breakdowns.append(json.dumps(bd))\n", "\n", "df_e[\"vendor_cost_breakdown\"] = new_breakdowns\n", "\n", "print(f\" Breakdowns rebuilt : {len(new_breakdowns):,}\")\n", "print(f\" Integrity errors : {bd_errors} (should be 0)\")\n", "fine_dining_count = (df_e[\"catering_style\"] == \"Plated Fine Dining\").sum()\n", "print(f\" Fine Dining events : {fine_dining_count} (boosted catering allocation)\")\n", "\n", "\n", "# ============================================================\n", "# STEP 7 — SAVE & VALIDATE\n", "# ============================================================\n", "\n", "df_v.to_csv(DATA_DIR / \"dataset_b_vendors.csv\", index=False)\n", "df_e.to_csv(DATA_DIR / \"dataset_a_events.csv\", index=False)\n", "\n", "print(f\"\\n{'='*62}\")\n", "print(f\" ADJUSTMENT COMPLETE — FINAL VALIDATION\")\n", "print(f\"{'='*62}\")\n", "\n", "# Vendor checks\n", "print(f\"\\n── Vendors ─────────────────────────────────────────────\")\n", "print(f\" Rows : {len(df_v):,}\")\n", "print(f\" Rating range : {df_v['avg_rating'].min():.2f} – {df_v['avg_rating'].max():.2f}\")\n", "print(f\" SLA range : {df_v['sla_compliance_rate'].min():.3f} – {df_v['sla_compliance_rate'].max():.3f}\")\n", "print(f\" Poor performers : {(df_v['avg_rating'] < 2.8).sum()} vendors \"\n", " f\"({(df_v['avg_rating']<2.8).mean()*100:.1f}%)\")\n", "\n", "from scipy.stats import pearsonr\n", "r_rat, _ = pearsonr(df_v[\"price_tier\"], df_v[\"avg_rating\"])\n", "r_sla, _ = pearsonr(df_v[\"price_tier\"], df_v[\"sla_compliance_rate\"])\n", "print(f\" r(tier, rating) : {r_rat:+.3f}\")\n", "print(f\" r(tier, SLA) : {r_sla:+.3f}\")\n", "\n", "print(f\"\\n Rating by price tier:\")\n", "for tier in [1, 2, 3, 4, 5]:\n", " sub = df_v[df_v[\"price_tier\"] == tier][\"avg_rating\"]\n", " print(f\" Tier {tier}: mean={sub.mean():.2f} std={sub.std():.2f} \"\n", " f\"min={sub.min():.2f} max={sub.max():.2f}\")\n", "\n", "print(f\"\\n Artifact prefix remaining : \"\n", " f\"{df_v['vendor_profile_text'].str.startswith('**Vendor Profile:**').sum()}\")\n", "\n", "# Event checks\n", "print(f\"\\n── Events ──────────────────────────────────────────────\")\n", "util = df_e[\"actual_spend_usd\"] / df_e[\"total_budget_usd\"]\n", "print(f\" Rows : {len(df_e):,}\")\n", "print(f\" Budget range : ${df_e['total_budget_usd'].min():,.0f}\"\n", " f\" – ${df_e['total_budget_usd'].max():,.0f}\")\n", "print(f\" util_rate range : {util.min():.3f} – {util.max():.3f}\")\n", "print(f\" Events > 1.25 overrun : {(util > 1.25).sum()} ({(util>1.25).mean()*100:.1f}%)\")\n", "print(f\" Events over budget : {(util > 1.0).sum()} ({(util>1.0).mean()*100:.1f}%)\")\n", "print(f\" Success rating < 2.5 : {(df_e['success_rating'] < 2.5).sum()}\")\n", "print(f\" Success rating minimum : {df_e['success_rating'].min():.1f}\")\n", "\n", "# Budget premium sanity check\n", "print(f\"\\n Budget/guest by city:\")\n", "df_e[\"_bpg\"] = df_e[\"total_budget_usd\"] / df_e[\"guest_capacity\"]\n", "city_bpg = df_e.groupby(\"city\")[\"_bpg\"].mean().sort_values(ascending=False)\n", "for city, val in city_bpg.items():\n", " print(f\" {city:<14}: ${val:,.0f}/guest\")\n", "df_e.drop(columns=[\"_bpg\"], inplace=True)\n", "\n", "# Cost breakdown integrity\n", "print(f\"\\n── Cost breakdown integrity ─────────────────────────────\")\n", "errors = sum(\n", " 1 for _, row in df_e.iterrows()\n", " if abs(sum(json.loads(row[\"vendor_cost_breakdown\"]).values())\n", " - row[\"actual_spend_usd\"]) >= 1.0\n", ")\n", "print(f\" Sum-match errors : {errors} {'✅' if errors == 0 else '❌'}\")\n", "\n", "print(f\"\\n── Saved files ─────────────────────────────────────────\")\n", "for f in [DATA_DIR/\"dataset_b_vendors.csv\", DATA_DIR/\"dataset_a_events.csv\"]:\n", " size_mb = f.stat().st_size / 1024 / 1024\n", " print(f\" {f.name:<40s} {size_mb:>6.2f} MB\")\n", "\n", "print(f\"\\n✅ All adjustments applied and saved.\")\n", "print(f\" Originals preserved as *_ORIGINAL.csv\")" ] } ] }