{ "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": { "025b845ba49e423cbfc757252db02381": { "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_e29ef8d387a94e6990343111c600d40f", "IPY_MODEL_bd085d627a404aac90bb6336f74d22a9", "IPY_MODEL_06c62bd2fcc346a197c3579d00ca0d44" ], "layout": "IPY_MODEL_df3990918f424c60be35b4c5be90ac34" } }, "e29ef8d387a94e6990343111c600d40f": { "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_3c88eea7ce64430e94e998a81463143e", "placeholder": "​", "style": "IPY_MODEL_0f38dc6f89064ec49950502e32a5cc53", "value": "hyperparams.yaml: 100%" } }, "bd085d627a404aac90bb6336f74d22a9": { "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_f6d0a0357ac048d9ad5ef31056fb65a1", "max": 1666, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_a570c3b7f01a4906a51eff36d264bb26", "value": 1666 } }, "06c62bd2fcc346a197c3579d00ca0d44": { "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_4e352cff53fa49069d0131578fd3248d", "placeholder": "​", "style": "IPY_MODEL_2ca94275b52b488fa7755de3c7b03216", "value": " 1.67k/1.67k [00:00<00:00, 169kB/s]" } }, "df3990918f424c60be35b4c5be90ac34": { "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 } }, "3c88eea7ce64430e94e998a81463143e": { "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 } }, "0f38dc6f89064ec49950502e32a5cc53": { "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": "" } }, "f6d0a0357ac048d9ad5ef31056fb65a1": { "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 } }, "a570c3b7f01a4906a51eff36d264bb26": { "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": "" } }, "4e352cff53fa49069d0131578fd3248d": { "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 } }, "2ca94275b52b488fa7755de3c7b03216": { "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": "" } }, "d7a05ee4c7c24eacbddf57ab6644639b": { "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_9e2406e1e42d42068d99c706484bab9a", "IPY_MODEL_2d49939f1d264b59906278bf4939ab2a", "IPY_MODEL_87a3a050b04e4e5b941951780926d36c" ], "layout": "IPY_MODEL_f0d5a89ad850448abcd506d6de86fff9" } }, "9e2406e1e42d42068d99c706484bab9a": { "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_16ccf523e9c24390ba654e282241831d", "placeholder": "​", "style": "IPY_MODEL_25da015c20f8426db38b3853245b37a4", "value": "embedding_model.ckpt: 100%" } }, "2d49939f1d264b59906278bf4939ab2a": { "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_77c6272fc49448529d7a7a919b1cc418", "max": 83310835, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_a9c2643b4c3f4af7b54b9c3940377519", "value": 83310835 } }, "87a3a050b04e4e5b941951780926d36c": { "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_75b859dc0f5642408cf318d6583a8da3", "placeholder": "​", "style": "IPY_MODEL_424c140f22c142988c5e95114c4680d7", "value": " 83.3M/83.3M [00:00<00:00, 156MB/s]" } }, "f0d5a89ad850448abcd506d6de86fff9": { "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 } }, "16ccf523e9c24390ba654e282241831d": { "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 } }, "25da015c20f8426db38b3853245b37a4": { "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": "" } }, "77c6272fc49448529d7a7a919b1cc418": { "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 } }, "a9c2643b4c3f4af7b54b9c3940377519": { "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": "" } }, "75b859dc0f5642408cf318d6583a8da3": { "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 } }, "424c140f22c142988c5e95114c4680d7": { "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": "" } }, "a0ae653cdf364d528ff132a48c1020c4": { "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_353f33d613d34b13944aaca5017752e1", "IPY_MODEL_bb24cf37e9d948bb81527968af1194c9", "IPY_MODEL_c2e2a5f07c594707a215a3f3c5e673b9" ], "layout": "IPY_MODEL_ae843746277c43e5bbe68390ad8ea887" } }, "353f33d613d34b13944aaca5017752e1": { "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_901c650e39ea4ddc8148e80f087b40e5", "placeholder": "​", "style": "IPY_MODEL_71ffe21e8fe04be3ab6bfb4c10ae2403", "value": "classifier.ckpt: 100%" } }, "bb24cf37e9d948bb81527968af1194c9": { "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_a749c4a8500c45c4b083918cac225bc0", "max": 35371, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_9182ff55244542aa9f77a7fefa181f49", "value": 35371 } }, "c2e2a5f07c594707a215a3f3c5e673b9": { "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_a9c504808b7c4b87919dfc976342fe0e", "placeholder": "​", "style": "IPY_MODEL_7f6e9e7d12574620a04e3ce7040f40d6", "value": " 35.4k/35.4k [00:00<00:00, 2.55MB/s]" } }, "ae843746277c43e5bbe68390ad8ea887": { "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 } }, "901c650e39ea4ddc8148e80f087b40e5": { "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 } }, "71ffe21e8fe04be3ab6bfb4c10ae2403": { "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": "" } }, "a749c4a8500c45c4b083918cac225bc0": { "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 } }, "9182ff55244542aa9f77a7fefa181f49": { "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": "" } }, "a9c504808b7c4b87919dfc976342fe0e": { "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 } }, "7f6e9e7d12574620a04e3ce7040f40d6": { "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": "" } }, "0028087e124840ce93d36b8bd482bb57": { "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_b1e9160b4b4b45798d9519bdfc9495a8", "IPY_MODEL_0bc64a9e7911471f87a0d96b1c7f0e92", "IPY_MODEL_b1c1e8f2fc854d0699cb1db59cfae2a1" ], "layout": "IPY_MODEL_82d76c4cdcf14a4ba5f34b49e9bd66d8" } }, "b1e9160b4b4b45798d9519bdfc9495a8": { "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_a39ac82e411b481893061534b82783d6", "placeholder": "​", "style": "IPY_MODEL_f49d6a8841544fbeb1b3a01826d5d230", "value": "label_encoder.txt: 100%" } }, "0bc64a9e7911471f87a0d96b1c7f0e92": { "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_8ef83c7b9f49497dbe1cfaa7a4f898b2", "max": 788, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_68339024f0bc410c8f1bd95184ff7d0b", "value": 788 } }, "b1c1e8f2fc854d0699cb1db59cfae2a1": { "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_93516c9e85bb4f82a493be0bcb25120a", "placeholder": "​", "style": "IPY_MODEL_57b73755ea0246d98995c774e129e422", "value": " 788/788 [00:00<00:00, 86.7kB/s]" } }, "82d76c4cdcf14a4ba5f34b49e9bd66d8": { "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 } }, "a39ac82e411b481893061534b82783d6": { "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 } }, "f49d6a8841544fbeb1b3a01826d5d230": { "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": "" } }, "8ef83c7b9f49497dbe1cfaa7a4f898b2": { "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 } }, "68339024f0bc410c8f1bd95184ff7d0b": { "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": "" } }, "93516c9e85bb4f82a493be0bcb25120a": { "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 } }, "57b73755ea0246d98995c774e129e422": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } } } } }, "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "gB5y6aC-H5_R", "outputId": "3331d670-461e-4aba-eb3d-6f28d3c66377" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m174.3/174.3 kB\u001b[0m \u001b[31m4.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m44.3/44.3 kB\u001b[0m \u001b[31m2.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.3/3.3 MB\u001b[0m \u001b[31m59.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m363.4/363.4 MB\u001b[0m \u001b[31m3.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m13.8/13.8 MB\u001b[0m \u001b[31m101.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m24.6/24.6 MB\u001b[0m \u001b[31m92.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m883.7/883.7 kB\u001b[0m \u001b[31m57.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m664.8/664.8 MB\u001b[0m \u001b[31m2.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m211.5/211.5 MB\u001b[0m \u001b[31m5.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m56.3/56.3 MB\u001b[0m \u001b[31m12.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m127.9/127.9 MB\u001b[0m \u001b[31m7.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m207.5/207.5 MB\u001b[0m \u001b[31m5.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m21.1/21.1 MB\u001b[0m \u001b[31m84.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[31m93.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m864.1/864.1 kB\u001b[0m \u001b[31m42.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.9/6.9 MB\u001b[0m \u001b[31m132.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m79.1/79.1 kB\u001b[0m \u001b[31m7.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m118.3/118.3 kB\u001b[0m \u001b[31m11.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m739.1/739.1 kB\u001b[0m \u001b[31m53.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h" ] } ], "source": [ "# Install needed libraries (run this cell first!)\n", "!pip install --quiet yt-dlp ffmpeg-python torch torchaudio transformers streamlit speechbrain\n" ] }, { "cell_type": "code", "source": [ "import os\n", "import subprocess\n", "import torchaudio\n", "import torch\n", "from speechbrain.pretrained import EncoderClassifier\n", "import yt_dlp\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "BDKT_c4rI07R", "outputId": "8083d2c5-eade-4424-db57-a640ce85bcb8" }, "execution_count": 5, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint save hook for _speechbrain_save\n", "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint load hook for _speechbrain_load\n", "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint save hook for save\n", "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint load hook for load\n", "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint save hook for _save\n", "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint load hook for _recover\n", ":5: UserWarning: Module 'speechbrain.pretrained' was deprecated, redirecting to 'speechbrain.inference'. Please update your script. This is a change from SpeechBrain 1.0. See: https://github.com/speechbrain/speechbrain/releases/tag/v1.0.0\n", " from speechbrain.pretrained import EncoderClassifier\n" ] } ] }, { "cell_type": "code", "source": [ "# Paste your video URL here (YouTube or direct MP4 link)\n", "VIDEO_URL = \"https://youtu.be/DDjWTWHHkpk?si=oIj6Fuy8Hg2E8U_l\" # Example: Replace with your actual link!\n" ], "metadata": { "id": "dco77Q2CI45K" }, "execution_count": 2, "outputs": [] }, { "cell_type": "code", "source": [ "def download_video(url, out_path=\"input_video.mp4\"):\n", " \"\"\"\n", " Downloads a video from YouTube or direct MP4 link.\n", " Returns the filename of the downloaded video.\n", " \"\"\"\n", " # If it's a YouTube link, use yt-dlp\n", " if \"youtube.com\" in url or \"youtu.be\" in url:\n", " ydl_opts = {'outtmpl': out_path}\n", " with yt_dlp.YoutubeDL(ydl_opts) as ydl:\n", " ydl.download([url])\n", " else:\n", " # For direct links, use wget/curl fallback\n", " os.system(f\"wget -O {out_path} {url}\")\n", " return out_path\n", "\n", "video_file = download_video(VIDEO_URL)\n", "print(f\"Downloaded video: {video_file}\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "RpWlsFnUJECZ", "outputId": "c8795ebf-01de-40ae-c80c-02cfa09a1357" }, "execution_count": 6, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "[youtube] Extracting URL: https://youtu.be/DDjWTWHHkpk?si=oIj6Fuy8Hg2E8U_l\n", "[youtube] DDjWTWHHkpk: Downloading webpage\n", "[youtube] DDjWTWHHkpk: Downloading tv client config\n", "[youtube] DDjWTWHHkpk: Downloading player f203bbc8-main\n", "[youtube] DDjWTWHHkpk: Downloading tv player API JSON\n", "[youtube] DDjWTWHHkpk: Downloading ios player API JSON\n", "[youtube] DDjWTWHHkpk: Downloading m3u8 information\n", "[info] DDjWTWHHkpk: Downloading 1 format(s): 399+251\n", "[download] Destination: input_video.mp4.f399.mp4\n", "[download] 100% of 62.45MiB in 00:00:01 at 31.78MiB/s \n", "[download] Destination: input_video.mp4.f251.webm\n", "[download] 100% of 4.57MiB in 00:00:00 at 9.99MiB/s \n", "[Merger] Merging formats into \"input_video.mp4.webm\"\n", "Deleting original file input_video.mp4.f399.mp4 (pass -k to keep)\n", "Deleting original file input_video.mp4.f251.webm (pass -k to keep)\n", "Downloaded video: input_video.mp4\n" ] } ] }, { "cell_type": "code", "source": [ "def extract_audio(video_path, audio_path=\"audio.wav\"):\n", " \"\"\"\n", " Extracts audio from a video file using ffmpeg.\n", " Returns the filename of the audio file.\n", " \"\"\"\n", " # Remove if already exists\n", " if os.path.exists(audio_path):\n", " os.remove(audio_path)\n", " # Extract audio with ffmpeg\n", " cmd = f\"ffmpeg -y -i {video_path} -ar 16000 -ac 1 -vn {audio_path}\"\n", " subprocess.call(cmd, shell=True)\n", " return audio_path\n", "\n", "audio_file = extract_audio(video_file)\n", "print(f\"Extracted audio file: {audio_file}\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "4a40jh5sJLMR", "outputId": "9756fbf1-2666-4271-bfd4-78de81d92b27" }, "execution_count": 7, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Extracted audio file: audio.wav\n" ] } ] }, { "cell_type": "code", "source": [ "def extract_audio(video_path, audio_path=\"/content/audio.wav\"):\n", " \"\"\"\n", " Extracts audio from a video file using ffmpeg.\n", " Returns the filename of the audio file.\n", " \"\"\"\n", " # Remove if already exists\n", " if os.path.exists(audio_path):\n", " os.remove(audio_path)\n", " # Extract audio with ffmpeg\n", " cmd = f\"ffmpeg -y -i {video_path} -ar 16000 -ac 1 -vn {audio_path}\"\n", " # Use subprocess.run to capture output and check the return code\n", " result = subprocess.run(cmd, shell=True, capture_output=True, text=True)\n", "\n", " if result.returncode != 0:\n", " print(f\"FFmpeg command failed with error code {result.returncode}\")\n", " print(\"FFmpeg stderr:\")\n", " print(result.stderr)\n", " # Optionally, raise an error or exit if audio extraction fails\n", " raise RuntimeError(f\"Failed to extract audio using FFmpeg. See stderr above.\")\n", " else:\n", " print(\"FFmpeg stdout:\")\n", " print(result.stdout)\n", " print(\"FFmpeg stderr:\")\n", " print(result.stderr) # ffmpeg often outputs info/warnings to stderr\n", "\n", " # Check if the audio file was actually created\n", " if not os.path.exists(audio_path):\n", " raise FileNotFoundError(f\"Audio file '{audio_path}' was not created after FFmpeg execution.\")\n", "\n", " return audio_path" ], "metadata": { "id": "ID_TzSsMJsqF" }, "execution_count": 8, "outputs": [] }, { "cell_type": "code", "source": [ "# Download the pre-trained English accent classifier (SpeechBrain)\n", "accent_model = EncoderClassifier.from_hparams(\n", " source=\"speechbrain/lang-id-commonlanguage_ecapa\",\n", " savedir=\"tmp_accent_model\"\n", ")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 599, "referenced_widgets": [ "025b845ba49e423cbfc757252db02381", "e29ef8d387a94e6990343111c600d40f", "bd085d627a404aac90bb6336f74d22a9", "06c62bd2fcc346a197c3579d00ca0d44", "df3990918f424c60be35b4c5be90ac34", "3c88eea7ce64430e94e998a81463143e", "0f38dc6f89064ec49950502e32a5cc53", "f6d0a0357ac048d9ad5ef31056fb65a1", "a570c3b7f01a4906a51eff36d264bb26", "4e352cff53fa49069d0131578fd3248d", "2ca94275b52b488fa7755de3c7b03216", "d7a05ee4c7c24eacbddf57ab6644639b", "9e2406e1e42d42068d99c706484bab9a", "2d49939f1d264b59906278bf4939ab2a", "87a3a050b04e4e5b941951780926d36c", "f0d5a89ad850448abcd506d6de86fff9", "16ccf523e9c24390ba654e282241831d", "25da015c20f8426db38b3853245b37a4", "77c6272fc49448529d7a7a919b1cc418", "a9c2643b4c3f4af7b54b9c3940377519", "75b859dc0f5642408cf318d6583a8da3", "424c140f22c142988c5e95114c4680d7", "a0ae653cdf364d528ff132a48c1020c4", "353f33d613d34b13944aaca5017752e1", "bb24cf37e9d948bb81527968af1194c9", "c2e2a5f07c594707a215a3f3c5e673b9", "ae843746277c43e5bbe68390ad8ea887", "901c650e39ea4ddc8148e80f087b40e5", "71ffe21e8fe04be3ab6bfb4c10ae2403", "a749c4a8500c45c4b083918cac225bc0", "9182ff55244542aa9f77a7fefa181f49", "a9c504808b7c4b87919dfc976342fe0e", "7f6e9e7d12574620a04e3ce7040f40d6", "0028087e124840ce93d36b8bd482bb57", "b1e9160b4b4b45798d9519bdfc9495a8", "0bc64a9e7911471f87a0d96b1c7f0e92", "b1c1e8f2fc854d0699cb1db59cfae2a1", "82d76c4cdcf14a4ba5f34b49e9bd66d8", "a39ac82e411b481893061534b82783d6", "f49d6a8841544fbeb1b3a01826d5d230", "8ef83c7b9f49497dbe1cfaa7a4f898b2", "68339024f0bc410c8f1bd95184ff7d0b", "93516c9e85bb4f82a493be0bcb25120a", "57b73755ea0246d98995c774e129e422" ] }, "id": "NioBBuqiJSyA", "outputId": "01d37290-1a05-42d0-b74c-587eb8a71885" }, "execution_count": 9, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "INFO:speechbrain.utils.fetching:Fetch hyperparams.yaml: Fetching from HuggingFace Hub 'speechbrain/lang-id-commonlanguage_ecapa' if not cached\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "hyperparams.yaml: 0%| | 0.00/1.67k [00:00 '/content/tmp_accent_model/hyperparams.yaml'\n", "INFO:speechbrain.utils.fetching:Fetch custom.py: Fetching from HuggingFace Hub 'speechbrain/lang-id-commonlanguage_ecapa' if not cached\n", "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint save hook for _save\n", "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint load hook for _load\n", "DEBUG:speechbrain.utils.checkpoints:Registered parameter transfer hook for _load\n", "/usr/local/lib/python3.11/dist-packages/speechbrain/utils/autocast.py:188: FutureWarning: `torch.cuda.amp.custom_fwd(args...)` is deprecated. Please use `torch.amp.custom_fwd(args..., device_type='cuda')` instead.\n", " wrapped_fwd = torch.cuda.amp.custom_fwd(fwd, cast_inputs=cast_inputs)\n", "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint save hook for save\n", "DEBUG:speechbrain.utils.checkpoints:Registered checkpoint load hook for load_if_possible\n", "DEBUG:speechbrain.utils.parameter_transfer:Collecting files (or symlinks) for pretraining in tmp_accent_model.\n", "INFO:speechbrain.utils.fetching:Fetch embedding_model.ckpt: Fetching from HuggingFace Hub 'speechbrain/lang-id-commonlanguage_ecapa' if not cached\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "embedding_model.ckpt: 0%| | 0.00/83.3M [00:00 '/content/tmp_accent_model/embedding_model.ckpt'\n", "DEBUG:speechbrain.utils.parameter_transfer:Set local path in self.paths[\"embedding_model\"] = /content/tmp_accent_model/embedding_model.ckpt\n", "INFO:speechbrain.utils.fetching:Fetch classifier.ckpt: Fetching from HuggingFace Hub 'speechbrain/lang-id-commonlanguage_ecapa' if not cached\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "classifier.ckpt: 0%| | 0.00/35.4k [00:00 '/content/tmp_accent_model/classifier.ckpt'\n", "DEBUG:speechbrain.utils.parameter_transfer:Set local path in self.paths[\"classifier\"] = /content/tmp_accent_model/classifier.ckpt\n", "INFO:speechbrain.utils.fetching:Fetch label_encoder.txt: Fetching from HuggingFace Hub 'speechbrain/lang-id-commonlanguage_ecapa' if not cached\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "label_encoder.txt: 0%| | 0.00/788 [00:00 '/content/tmp_accent_model/label_encoder.ckpt'\n", "DEBUG:speechbrain.utils.parameter_transfer:Set local path in self.paths[\"label_encoder\"] = /content/tmp_accent_model/label_encoder.ckpt\n", "INFO:speechbrain.utils.parameter_transfer:Loading pretrained files for: embedding_model, classifier, label_encoder\n", "DEBUG:speechbrain.utils.parameter_transfer:Redirecting (loading from local path): embedding_model -> /content/tmp_accent_model/embedding_model.ckpt\n", "DEBUG:speechbrain.utils.parameter_transfer:Redirecting (loading from local path): classifier -> /content/tmp_accent_model/classifier.ckpt\n", "DEBUG:speechbrain.utils.parameter_transfer:Redirecting (loading from local path): label_encoder -> /content/tmp_accent_model/label_encoder.ckpt\n", "DEBUG:speechbrain.dataio.encoder:Loaded categorical encoding from /content/tmp_accent_model/label_encoder.ckpt\n" ] } ] }, { "cell_type": "markdown", "source": [ "Used to Debuging the code" ], "metadata": { "id": "Tu9Wo4k6K-EK" } }, { "cell_type": "code", "source": [ "# List the files to see if input_video.mp4 is present\n", "import os\n", "print(os.listdir('.'))\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "iuY4MTUmKDmx", "outputId": "e325dbb9-3e01-4e17-a832-3180a8c809e3" }, "execution_count": 10, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "['.config', 'tmp_accent_model', 'input_video.mp4.webm', 'sample_data']\n" ] } ] }, { "cell_type": "markdown", "source": [ "TO check the debug file path" ], "metadata": { "id": "H2pjikAiLCqM" } }, { "cell_type": "code", "source": [ "# Try extracting audio again, but print output to check for errors\n", "video_path = \"/content/input_video.mp4.webm\" # or whatever your filename is!\n", "audio_path = \"audio.wav\"\n", "\n", "os.system(f\"ffmpeg -y -i {video_path} -ar 16000 -ac 1 -vn {audio_path}\")\n", "\n", "# See if audio.wav was created\n", "print(os.listdir('.'))\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "_5huLKQoKMec", "outputId": "fca4a365-4745-46f0-cf29-80f754af6c59" }, "execution_count": 11, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "['.config', 'tmp_accent_model', 'input_video.mp4.webm', 'audio.wav', 'sample_data']\n" ] } ] }, { "cell_type": "markdown", "source": [ "Check the Size of the file" ], "metadata": { "id": "6tbUtgFDLGQq" } }, { "cell_type": "code", "source": [ "# Check if the file now exists and get its size\n", "import os\n", "print(\"audio.wav exists:\", os.path.exists(audio_path))\n", "if os.path.exists(audio_path):\n", " print(\"audio.wav size (bytes):\", os.path.getsize(audio_path))\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "dnyXSxAmKZN2", "outputId": "9616b8da-62c3-4a77-8983-16a193f7ee0f" }, "execution_count": 12, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "audio.wav exists: True\n", "audio.wav size (bytes): 9308494\n" ] } ] }, { "cell_type": "code", "source": [ "# Load the audio file (must be 16kHz mono)\n", "signal, fs = torchaudio.load(audio_file)\n", "\n", "# If stereo, take only the first channel\n", "if signal.shape[0] > 1:\n", " signal = signal[0].unsqueeze(0)\n", "\n", "# Run classification\n", "prediction = accent_model.classify_batch(signal)\n", "pred_label = prediction[3][0]\n", "pred_scores = prediction[1][0]\n", "\n", "# Convert score to percentage\n", "confidence = float(pred_scores.max()) * 100\n", "\n", "# Display top label and score\n", "print(f\"Predicted Accent: {pred_label}\")\n", "print(f\"Confidence: {confidence:.1f}%\")\n", "print(\"Possible accent labels:\", accent_model.hparams.label_encoder.lab2ind.keys())\n", "\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "dib87e25JZkd", "outputId": "1ddd1991-148b-461b-94d4-845c401365d7" }, "execution_count": 13, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "WARNING:speechbrain.dataio.encoder:CategoricalEncoder.expect_len was never called: assuming category count of 45 to be correct! Sanity check your encoder using `.expect_len`. Ensure that downstream code also uses the correct size. If you are sure this does not apply to you, use `.ignore_len`.\n" ] }, { "output_type": "stream", "name": "stdout", "text": [ "Predicted Accent: English\n", "Confidence: 66.8%\n", "Possible accent labels: dict_keys(['Basque', 'Romansh_Sursilvan', 'Sakha', 'Georgian', 'Greek', 'Hakha_Chin', 'Ukrainian', 'Interlingua', 'Persian', 'Polish', 'Dutch', 'Chinese_Hongkong', 'Japanese', 'Portuguese', 'Italian', 'Catalan', 'Chuvash', 'Swedish', 'Spanish', 'Slovenian', 'Tamil', 'Breton', 'Russian', 'Czech', 'English', 'French', 'Tatar', 'Welsh', 'Kyrgyz', 'Esperanto', 'Kinyarwanda', 'Dhivehi', 'Turkish', 'Latvian', 'Estonian', 'Arabic', 'Frisian', 'Mongolian', 'Chinese_Taiwan', 'Indonesian', 'Maltese', 'Kabyle', 'Romanian', 'Chinese_China', 'German'])\n" ] } ] }, { "cell_type": "code", "source": [ "explanation = f\"The speaker's English accent was classified as '{pred_label}' with a confidence score of {confidence:.1f}%. This means the model is {confidence:.0f}% sure the person sounds most similar to this accent group.\"\n", "\n", "print(explanation)\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "YchZqUzSLna9", "outputId": "91d6f6ae-0247-4e0e-a9c1-d0e9d379a8e0" }, "execution_count": 14, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "The speaker's English accent was classified as 'English' with a confidence score of 66.8%. This means the model is 67% sure the person sounds most similar to this accent group.\n" ] } ] }, { "cell_type": "code", "source": [ "# Save as app.py in Colab for launching a simple web UI\n", "with open(\"app.py\", \"w\") as f:\n", " f.write('''\n", "import streamlit as st\n", "import os\n", "import subprocess\n", "import torchaudio\n", "from speechbrain.pretrained import EncoderClassifier\n", "\n", "st.title(\"🗣️ English Accent Classifier (Proof of Concept)\")\n", "\n", "url = st.text_input(\"Enter public video URL (YouTube or direct MP4):\")\n", "if st.button(\"Analyze\"):\n", " with st.spinner(\"Downloading video...\"):\n", " if \"youtube.com\" in url or \"youtu.be\" in url:\n", " os.system(f'yt-dlp -o input_video.mp4 \"{url}\"')\n", " else:\n", " os.system(f'wget -O input_video.mp4 \"{url}\"')\n", " with st.spinner(\"Extracting audio...\"):\n", " os.system(\"ffmpeg -y -i input_video.mp4 -ar 16000 -ac 1 -vn audio.wav\")\n", " with st.spinner(\"Classifying accent...\"):\n", " accent_model = EncoderClassifier.from_hparams(\n", " source=\"speechbrain/lang-id-commonlanguage_ecapa\",\n", " savedir=\"tmp_accent_model\"\n", " )\n", " signal, fs = torchaudio.load(\"audio.wav\")\n", " if signal.shape[0] > 1:\n", " signal = signal[0].unsqueeze(0)\n", " prediction = accent_model.classify_batch(signal)\n", " pred_label = prediction[3][0]\n", " pred_scores = prediction[1][0]\n", " confidence = float(pred_scores.max()) * 100\n", " st.success(f\"Predicted Accent: {pred_label} ({confidence:.1f}%)\")\n", " st.info(f\"The model is {confidence:.0f}% confident this is a {pred_label} English accent.\")\n", "''')\n", "\n", "print(\"Streamlit app code saved as app.py!\")\n", "print(\"To launch the UI, run: !streamlit run app.py --server.headless true --server.port 8501\")\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "K7TCPSn8MLcN", "outputId": "5c4d3e3a-191e-4b61-97e0-739626eb6263" }, "execution_count": 15, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Streamlit app code saved as app.py!\n", "To launch the UI, run: !streamlit run app.py --server.headless true --server.port 8501\n" ] } ] } ] }