{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "toc_visible": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "accelerator": "GPU", "widgets": { "application/vnd.jupyter.widget-state+json": { "a366daa8a5724ef5911a78e1e9ffd39c": { "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_a4fc66940fee41c890cd1365ab09bb9c", "IPY_MODEL_80ba5dc94bb241728e86a8650e2d72b8", "IPY_MODEL_b34c9f052d334133a598c8dc3b09659d" ], "layout": "IPY_MODEL_f169dbb09d80415fb6b396bb3b373faf" } }, "a4fc66940fee41c890cd1365ab09bb9c": { "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_551f86c4cac14e4898f9a31642ffce03", "placeholder": "​", "style": "IPY_MODEL_1c2664c6ddcd480381b993e49fd4471f", "value": "Downloading (…)olve/main/source.spm: 100%" } }, "80ba5dc94bb241728e86a8650e2d72b8": { "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_8ca1ea420b3d4537a83e7d20b7f0cd3c", "max": 802397, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_a4802e67d79d41a6a138bce8391df68d", "value": 802397 } }, "b34c9f052d334133a598c8dc3b09659d": { "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_786177d5050e4d42a057833c3396e9f2", "placeholder": "​", "style": "IPY_MODEL_7ef46cc8b82742e38b7881de1298119d", "value": " 802k/802k [00:00<00:00, 3.88MB/s]" } }, "f169dbb09d80415fb6b396bb3b373faf": { "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 } }, "551f86c4cac14e4898f9a31642ffce03": { "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 } }, "1c2664c6ddcd480381b993e49fd4471f": { "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": "" } }, "8ca1ea420b3d4537a83e7d20b7f0cd3c": { "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 } }, "a4802e67d79d41a6a138bce8391df68d": { "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": "" } }, "786177d5050e4d42a057833c3396e9f2": { "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 } }, "7ef46cc8b82742e38b7881de1298119d": { "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": "" } }, "d23405a3d6ac4ed4b8cd23f2f52616cd": { "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_61dd52bb0c5f4f1899552afd37d0e95e", "IPY_MODEL_6980a6cf10e543a78a3942da0574e7da", "IPY_MODEL_5edf97ce410d45f4a982464b5de7c4ca" ], "layout": "IPY_MODEL_3d441fccf07148c194e76c3567b50338" } }, "61dd52bb0c5f4f1899552afd37d0e95e": { "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_5f43a463a28c4b62829381e9c30a173d", "placeholder": "​", "style": "IPY_MODEL_5ea7db53cb9e4cb88270e189da94649e", "value": "Downloading (…)olve/main/target.spm: 100%" } }, "6980a6cf10e543a78a3942da0574e7da": { "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_21082a6a1fdd4170a78f8d56fca4399e", "max": 778395, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_56689cfe77064e8b973c80389eb1f6a1", "value": 778395 } }, "5edf97ce410d45f4a982464b5de7c4ca": { "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_1f0d105b89c345ada3e6c59fbf5be00c", "placeholder": "​", "style": "IPY_MODEL_ba4e01ebbfb54b0f98efa0d9a0735df4", "value": " 778k/778k [00:00<00:00, 3.91MB/s]" } }, "3d441fccf07148c194e76c3567b50338": { "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 } }, "5f43a463a28c4b62829381e9c30a173d": { "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 } }, "5ea7db53cb9e4cb88270e189da94649e": { "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": "" } }, "21082a6a1fdd4170a78f8d56fca4399e": { "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 } }, "56689cfe77064e8b973c80389eb1f6a1": { "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": "" } }, "1f0d105b89c345ada3e6c59fbf5be00c": { "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 } }, "ba4e01ebbfb54b0f98efa0d9a0735df4": { "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": "" } }, "d1f0d98e85f64836b6e21896ab342de6": { "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_3a1146da456345a0ae2d4f6e8c27d903", "IPY_MODEL_ab9b616aa5e3457b9875ce70b614ddcf", "IPY_MODEL_02b247fc179643ec9aca8321855aab94" ], "layout": "IPY_MODEL_59f466e226bc41a8ac1ea878c7b7be1d" } }, "3a1146da456345a0ae2d4f6e8c27d903": { "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_46c6aab6997548cba550a8818a677748", "placeholder": "​", "style": "IPY_MODEL_8c76f99347134249ac888eaee23e2ad8", "value": "Downloading (…)olve/main/vocab.json: 100%" } }, "ab9b616aa5e3457b9875ce70b614ddcf": { "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_5fc912b1da2f48b69de578f5015b82f9", "max": 1339166, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_e7860a8b6b3943948d9b0928d4864744", "value": 1339166 } }, "02b247fc179643ec9aca8321855aab94": { "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_fda43e7cbcf1460cbaff8e1666e2a72e", "placeholder": "​", "style": "IPY_MODEL_b3a4fe4f70054a9c8e2faef9644388db", "value": " 1.34M/1.34M [00:00<00:00, 6.47MB/s]" } }, "59f466e226bc41a8ac1ea878c7b7be1d": { "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 } }, "46c6aab6997548cba550a8818a677748": { "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 } }, "8c76f99347134249ac888eaee23e2ad8": { "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": "" } }, "5fc912b1da2f48b69de578f5015b82f9": { "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 } }, "e7860a8b6b3943948d9b0928d4864744": { "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": "" } }, "fda43e7cbcf1460cbaff8e1666e2a72e": { "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 } }, "b3a4fe4f70054a9c8e2faef9644388db": { "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": "markdown", "source": [ "## **INITIALIZATION:**\n", "- I use these three lines of code on top of my each notebooks because it will help to prevent any problems while reloading the same project. And the third line of code helps to make visualization within the notebook." ], "metadata": { "id": "s_rod7u5Z3Bk" } }, { "cell_type": "code", "execution_count": 1, "metadata": { "id": "7-c8RRG5XCK7" }, "outputs": [], "source": [ "#@ INITIALIZATION: \n", "%reload_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "source": [ "## **LIBRARIES AND DEPENDENCIES:**\n", "- I have downloaded all the libraries and dependencies required for the project in one particular cell.\n", "- Make sure to install `transformers[sentencepiece]` in order to use `pipeline(\"translation\", model=\"Helsinki-NLP/opus-mt-fr-en\")`, e.g. language translation task" ], "metadata": { "id": "n9I8VhyfaBr7" } }, { "cell_type": "code", "source": [ "#@ INSTALLING DEPENDENCIES: UNCOMMENT BELOW: \n", "!pip install transformers[sentencepiece]" ], "metadata": { "id": "6xlT0WUMZ-62", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "6c4a497f-1b01-4956-c2ae-5ea1bc9787be" }, "execution_count": 2, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n", "Requirement already satisfied: transformers[sentencepiece] in /usr/local/lib/python3.9/dist-packages (4.27.4)\n", "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.9/dist-packages (from transformers[sentencepiece]) (1.22.4)\n", "Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /usr/local/lib/python3.9/dist-packages (from transformers[sentencepiece]) (0.13.3)\n", "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.9/dist-packages (from transformers[sentencepiece]) (2022.10.31)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.9/dist-packages (from transformers[sentencepiece]) (2.27.1)\n", "Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.9/dist-packages (from transformers[sentencepiece]) (4.65.0)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.9/dist-packages (from transformers[sentencepiece]) (3.10.7)\n", "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.9/dist-packages (from transformers[sentencepiece]) (23.0)\n", "Requirement already satisfied: huggingface-hub<1.0,>=0.11.0 in /usr/local/lib/python3.9/dist-packages (from transformers[sentencepiece]) (0.13.4)\n", "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.9/dist-packages (from transformers[sentencepiece]) (6.0)\n", "Requirement already satisfied: protobuf<=3.20.2 in /usr/local/lib/python3.9/dist-packages (from transformers[sentencepiece]) (3.20.2)\n", "Requirement already satisfied: sentencepiece!=0.1.92,>=0.1.91 in /usr/local/lib/python3.9/dist-packages (from transformers[sentencepiece]) (0.1.97)\n", "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.9/dist-packages (from huggingface-hub<1.0,>=0.11.0->transformers[sentencepiece]) (4.5.0)\n", "Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.9/dist-packages (from requests->transformers[sentencepiece]) (2.0.12)\n", "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.9/dist-packages (from requests->transformers[sentencepiece]) (1.26.15)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/dist-packages (from requests->transformers[sentencepiece]) (2022.12.7)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.9/dist-packages (from requests->transformers[sentencepiece]) (3.4)\n" ] } ] }, { "cell_type": "code", "source": [ "#@ DOWNLOADING LIBRARIES AND DEPENDENCIES:\n", "import transformers\n", "from transformers import pipeline" ], "metadata": { "id": "NOL1UW_vaWtG" }, "execution_count": 3, "outputs": [] }, { "cell_type": "markdown", "source": [ "## **Natural Language Processing**\n", "\n", "- **NLP** is a field of linguistics and machine learning focused on understanding everything related to human language. The aim of **NLP** tasks is not only to understand single words individually, but to be able to understand the context of those words. " ], "metadata": { "id": "CECqmYGOawxR" } }, { "cell_type": "markdown", "source": [ "### **SENTIMENT ANALYSIS:**\n", "\n", "The line of code `classifier = pipeline(\"sentiment-analysis\")` creates a sentiment analysis classifier using the Hugging Face Transformers library.\n", "\n", "The `pipeline()` function is a convenience method provided by the Transformers library that allows developers to quickly instantiate pre-trained models for various natural language processing (NLP) tasks, including sentiment analysis.\n", "\n", "In this case, the `pipeline()` function is used to create a `sentiment-analysis` pipeline, which is a pre-configured pipeline that includes a pre-trained transformer model for sentiment analysis.\n", "\n", "The resulting classifier object is an instance of the pipeline class, which has a convenient method called `__call__()` that allows you to use the pre-trained sentiment analysis model to analyze the sentiment of input text.\n", "\n", "Overall, this line of code provides a quick and easy way to create a pre-trained sentiment analysis model for use in NLP applications." ], "metadata": { "id": "RkznUFUOcY3F" } }, { "cell_type": "markdown", "source": [ "### **WHAT MODEL**\n", "\n", "The specific model being used by the sentiment analysis pipeline created by the code `classifier = pipeline(\"sentiment-analysis\")` depends on the default model specified by the Hugging Face Transformers library at the time the code is executed.\n", "\n", "However, by default, the sentiment analysis pipeline uses the pre-trained DistilBERT model, which is a smaller, faster, and lighter version of the popular BERT (Bidirectional Encoder Representations from Transformers) model. The DistilBERT model was introduced in the paper \"DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter\" by Sanh et al. in 2020.\n", "\n", "The DistilBERT model was trained on a masked language modeling objective, which involves predicting masked words in text, and fine-tuned on a sentiment analysis task using the IMDb dataset, which contains movie reviews labeled as positive or negative.\n", "\n", "While the specific implementation of the sentiment analysis pipeline created by the code `classifier = pipeline(\"sentiment-analysis\")` may not have a dedicated research paper, the underlying pre-trained DistilBERT model has been extensively evaluated and published in the aforementioned paper. Additionally, the Hugging Face Transformers library provides extensive documentation and examples of how to use the model and pipeline for various NLP tasks.\n", "\n", "\n", "\n" ], "metadata": { "id": "N7rmfAbqTTAA" } }, { "cell_type": "code", "source": [ "#@ IMPLEMENTATION OF SENTIMENT ANALYSIS PIPELINE:\n", "classifier = pipeline(\"sentiment-analysis\") # Initializing Classifier Object. \n", "classifier(\"I've started the HuggingFace course which fascinates me.\") # Inspecting Sentiment. " ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "ibYIi6HBatZn", "outputId": "8942c5ac-91e4-48e6-f2a4-8f9bdfc92a10" }, "execution_count": 4, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "No model was supplied, defaulted to distilbert-base-uncased-finetuned-sst-2-english and revision af0f99b (https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english).\n", "Using a pipeline without specifying a model name and revision in production is not recommended.\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "[{'label': 'POSITIVE', 'score': 0.9997233748435974}]" ] }, "metadata": {}, "execution_count": 4 } ] }, { "cell_type": "code", "source": [ "#@ IMPLEMENTATION OF SENTIMENT ANALYSIS PIPELINE: MULTIPLE:\n", "classifier(\n", " [\n", " \"I've started the HuggingFace course which fascinates me.\",\n", " \"I will no longer read it's documentation.\",\n", " \"I think the course is awesome!\"\n", " ]\n", ") # Inspecting Sentiment. " ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "pYpdpAjXc4dH", "outputId": "952ede02-025c-4cb6-ff0e-c4a0b117681f" }, "execution_count": 5, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "[{'label': 'POSITIVE', 'score': 0.9997233748435974},\n", " {'label': 'NEGATIVE', 'score': 0.9994686245918274},\n", " {'label': 'POSITIVE', 'score': 0.9998465776443481}]" ] }, "metadata": {}, "execution_count": 5 } ] }, { "cell_type": "markdown", "source": [ "#### **Pipelines**\n", "\n", "- The three main steps involved when we pass some text to a `pipeline` are: \n", " - The text is preprocessed into a format the model can understand.\n", " - The preprocessed inputs are passed to the model. \n", " - The predictions of the model are post-processed, so we can make sense of them. " ], "metadata": { "id": "bp4Yx3MffEw6" } }, { "cell_type": "markdown", "source": [ "### **ZERO-SHOT CLASSIFICATION:**\n", "\n", "- The `zero-shot-classification` pipeline is very powerful, as it allows us to specify which labels to use for the classification, so we don't have to rely on the labels of the pretrained model. This `pipeline` is called `zero-shot` because we don't need to fine-tune the model on our data to use it. It can directly return probability scores for any list of labels we want. \n", "\n", "The zero-shot-classification pipeline is a pre-configured pipeline that uses a pre-trained transformer model for classification tasks. Unlike traditional classification pipelines, the zero-shot classification pipeline can classify input text based on classes that are not explicitly defined in the training data.\n", "\n", "The pipeline works by encoding the input text and a list of candidate labels using a pre-trained transformer model. The candidate labels represent the classes that the input text may belong to, but they are not used to train the model. Instead, the model predicts the likelihood of the input text belonging to each of the candidate labels by comparing the encoded input text with the encoded candidate labels.\n", "\n" ], "metadata": { "id": "natPtwAFgD9T" } }, { "cell_type": "code", "source": [ "#@ IMPLEMENTATION OF ZERO SHOT CLASSIFICATION PIPELINE: \n", "classifier = pipeline(\"zero-shot-classification\") # Initializing Classifier Object. \n", "classifier(\"This is a course about Transformers library\", \n", " candidate_labels=[\"education\", \"health\", \"programming\"]) # Inspecting Classification. " ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Wt8ilH9VeW1A", "outputId": "c6a08e9d-4258-472b-ff85-382107a15181" }, "execution_count": 6, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "No model was supplied, defaulted to facebook/bart-large-mnli and revision c626438 (https://huggingface.co/facebook/bart-large-mnli).\n", "Using a pipeline without specifying a model name and revision in production is not recommended.\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "{'sequence': 'This is a course about Transformers library',\n", " 'labels': ['education', 'programming', 'health'],\n", " 'scores': [0.6901501417160034, 0.1908414661884308, 0.1190083846449852]}" ] }, "metadata": {}, "execution_count": 6 } ] }, { "cell_type": "markdown", "source": [ "### **TEXT GENERATION:**\n", "\n", "- The main idea here is that when we provide a prompt and the model will auto-complete it by generating the remaining text. " ], "metadata": { "id": "HSCQbBQdylz6" } }, { "cell_type": "code", "source": [ "#@ IMPLEMENTATION OF TEXT GENERATION PIPELINE: \n", "generator = pipeline(\"text-generation\") # Initializing Generator Object. \n", "generator(\"In this course, you will learn to\") # Inspecting Generated Text. " ], "metadata": { "id": "GS1r-kAQirUE", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "712b29f9-d1c9-4945-cdc2-65870714ebda" }, "execution_count": 7, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "No model was supplied, defaulted to gpt2 and revision 6c0e608 (https://huggingface.co/gpt2).\n", "Using a pipeline without specifying a model name and revision in production is not recommended.\n", "/usr/local/lib/python3.9/dist-packages/transformers/generation/utils.py:1201: UserWarning: You have modified the pretrained model configuration to control generation. This is a deprecated strategy to control generation and will be removed soon, in a future version. Please use a generation configuration file (see https://huggingface.co/docs/transformers/main_classes/text_generation)\n", " warnings.warn(\n", "Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.\n", "/usr/local/lib/python3.9/dist-packages/transformers/generation/utils.py:1288: UserWarning: Using `max_length`'s default (50) to control the generation length. This behaviour is deprecated and will be removed from the config in v5 of Transformers -- we recommend using `max_new_tokens` to control the maximum length of the generation.\n", " warnings.warn(\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "[{'generated_text': 'In this course, you will learn to take on each new project with real-world use cases, making it easier to follow through with your concepts. Students will go through what you need to work with in detail before you start using your new project.'}]" ] }, "metadata": {}, "execution_count": 7 } ] }, { "cell_type": "code", "source": [ "#@ IMPLEMENTATION OF TEXT GENERATION PIPELINE: \n", "generator(\"I like python because\", num_return_sequences=2, max_length=15) # Inspecting Generated Sequences. " ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "YeJPE8k5zjPL", "outputId": "f637e744-863b-4dd2-baf5-98e062707c2e" }, "execution_count": 8, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "[{'generated_text': 'I like python because it\\'s open source,\" said Cipriano.'},\n", " {'generated_text': 'I like python because of the interface. For that I found myself getting errors'}]" ] }, "metadata": {}, "execution_count": 8 } ] }, { "cell_type": "code", "source": [ "#@ IMPLEMENTATION OF TEXT GENERATION PIPELINE: DISTILGPT2:\n", "generator = pipeline(\"text-generation\", model=\"distilgpt2\") # Initializing Generator Object. \n", "generator(\"I want to be a programmer so that\", \n", " num_return_sequences=2, max_length=30) # Inspecting Generated Sequences. " ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "i8tULAYiz_1g", "outputId": "b868156f-13c4-4c65-8b62-4eec2218bb01" }, "execution_count": 9, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "[{'generated_text': 'I want to be a programmer so that this will be used. It\\u202cs a real hard work to deal with. That\\u202cs a'},\n", " {'generated_text': 'I want to be a programmer so that you can do anything you want, but with such a great deal of resources and time, I would love to'}]" ] }, "metadata": {}, "execution_count": 9 } ] }, { "cell_type": "markdown", "source": [ "### **MASK FILLING:**\n", "\n", "- The idea of this task is to fill in the blanks in a given text. " ], "metadata": { "id": "J0zsBIMFCwDw" } }, { "cell_type": "code", "source": [ "#@ IMPLEMENTATION OF MASK FILLING PIPELINE:\n", "unmasker = pipeline(\"fill-mask\") # Initilizing Mask Filling Object. \n", "unmasker(\"This course will teach you all about models.\", \n", " top_k=2) # Inspecting Mask Token." ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "4c1UCi9C2kI6", "outputId": "9263c813-0a48-409a-e026-7c9bcc3e3172" }, "execution_count": 10, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "No model was supplied, defaulted to distilroberta-base and revision ec58a5b (https://huggingface.co/distilroberta-base).\n", "Using a pipeline without specifying a model name and revision in production is not recommended.\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "[{'score': 0.19619806110858917,\n", " 'token': 30412,\n", " 'token_str': ' mathematical',\n", " 'sequence': 'This course will teach you all about mathematical models.'},\n", " {'score': 0.04052723944187164,\n", " 'token': 38163,\n", " 'token_str': ' computational',\n", " 'sequence': 'This course will teach you all about computational models.'}]" ] }, "metadata": {}, "execution_count": 10 } ] }, { "cell_type": "code", "source": [ "#@ IMPLEMENTATION OF MASK FILLING PIPELINE:\n", "unmasker = pipeline(\"fill-mask\", model=\"bert-base-cased\") # Initilizing Mask Filling Object. \n", "unmasker(\"This course will teach you all about [MASK] models.\", \n", " top_k=2) # Inspecting Mask Token." ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "kjvAPF2zHCgt", "outputId": "442e5075-bc75-4efe-a079-42abac41802d" }, "execution_count": 11, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "Some weights of the model checkpoint at bert-base-cased were not used when initializing BertForMaskedLM: ['cls.seq_relationship.bias', 'cls.seq_relationship.weight']\n", "- This IS expected if you are initializing BertForMaskedLM from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n", "- This IS NOT expected if you are initializing BertForMaskedLM from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "[{'score': 0.25963184237480164,\n", " 'token': 1648,\n", " 'token_str': 'role',\n", " 'sequence': 'This course will teach you all about role models.'},\n", " {'score': 0.09427252411842346,\n", " 'token': 1103,\n", " 'token_str': 'the',\n", " 'sequence': 'This course will teach you all about the models.'}]" ] }, "metadata": {}, "execution_count": 11 } ] }, { "cell_type": "markdown", "source": [ "### **NAMED ENTITY RECOGNITION:**\n", "\n", "- **NER** is a task where the model has to find which parts of the input text correspond to entities such as persons, locations, or organizations. " ], "metadata": { "id": "T1IuXZA-Fdrd" } }, { "cell_type": "code", "source": [ "#@ IMPLEMENTATION OF NER PIPELINE:\n", "ner = pipeline(\"ner\", grouped_entities=True) # Initializing NER Object. \n", "ner(\"I am Thinam Tamang and I am from Kathmandu, Nepal.\") # Inspecting Entities. " ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "xkHKDYCPFEZT", "outputId": "2f454b99-6a6b-4f74-88a8-274c9c3321ae" }, "execution_count": 12, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "No model was supplied, defaulted to dbmdz/bert-large-cased-finetuned-conll03-english and revision f2482bf (https://huggingface.co/dbmdz/bert-large-cased-finetuned-conll03-english).\n", "Using a pipeline without specifying a model name and revision in production is not recommended.\n", "/usr/local/lib/python3.9/dist-packages/transformers/pipelines/token_classification.py:157: UserWarning: `grouped_entities` is deprecated and will be removed in version v5.0.0, defaulted to `aggregation_strategy=\"simple\"` instead.\n", " warnings.warn(\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "[{'entity_group': 'PER',\n", " 'score': 0.9967239,\n", " 'word': 'Thinam Tamang',\n", " 'start': 5,\n", " 'end': 18},\n", " {'entity_group': 'LOC',\n", " 'score': 0.9990222,\n", " 'word': 'Kathmandu',\n", " 'start': 33,\n", " 'end': 42},\n", " {'entity_group': 'LOC',\n", " 'score': 0.9997008,\n", " 'word': 'Nepal',\n", " 'start': 44,\n", " 'end': 49}]" ] }, "metadata": {}, "execution_count": 12 } ] }, { "cell_type": "markdown", "source": [ "###**QUESTION ANSWERING:**\n", "\n", "- The `question-answering` pipeline answers questions using information from a given context. " ], "metadata": { "id": "G85OQxxHIBQp" } }, { "cell_type": "code", "source": [ "#@ IMPLEMENTATION OF QUESTION ANSWERING PIPELINE: \n", "question_answerer = pipeline(\"question-answering\") # Initialization. \n", "question_answerer(\n", " question=\"What is my name?\",\n", " context=\"I am Thinam from Nepal.\") # Inspecting Answer. " ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "F4q1loPYH3pB", "outputId": "a3bab9ef-d0e3-4280-c813-f8a969f02e1a" }, "execution_count": 13, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "No model was supplied, defaulted to distilbert-base-cased-distilled-squad and revision 626af31 (https://huggingface.co/distilbert-base-cased-distilled-squad).\n", "Using a pipeline without specifying a model name and revision in production is not recommended.\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "{'score': 0.8733125925064087, 'start': 5, 'end': 11, 'answer': 'Thinam'}" ] }, "metadata": {}, "execution_count": 13 } ] }, { "cell_type": "markdown", "source": [ "### **SUMMARIZATION:**\n", "\n", "- Summarization is the task of reducing a text into a shorter text while keeping all or most of the important aspects referenced in the text. " ], "metadata": { "id": "uxANYti2Jzen" } }, { "cell_type": "code", "source": [ "#@ IMPLEMENTATION OF SUMMARIZATION PIPELINE:\n", "summarizer = pipeline(\"summarization\") # Initializing Summarizer Object. \n", "summarizer(\n", " \"\"\"\n", " America has changed dramatically during recent years. Not only has the number of \n", " graduates in traditional engineering disciplines such as mechanical, civil, \n", " electrical, chemical, and aeronautical engineering declined, but in most of \n", " the premier American universities engineering curricula now concentrate on \n", " and encourage largely the study of engineering science. As a result, there \n", " are declining offerings in engineering subjects dealing with infrastructure, \n", " the environment, and related issues, and greater concentration on high \n", " technology subjects, largely supporting increasingly complex scientific \n", " developments. While the latter is important, it should not be at the expense \n", " of more traditional engineering.\n", "\n", " Rapidly developing economies such as China and India, as well as other \n", " industrial countries in Europe and Asia, continue to encourage and advance \n", " the teaching of engineering. Both China and India, respectively, graduate \n", " six and eight times as many traditional engineers as does the United States. \n", " Other industrial countries at minimum maintain their output, while America \n", " suffers an increasingly serious decline in the number of engineering graduates \n", " and a lack of well-educated engineers.\n", "\"\"\"\n", ") # Inspecting Summarized Text. " ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "2-jGKeWkJeVa", "outputId": "b79e1d03-8b39-45d1-b098-fd22efce7fab" }, "execution_count": 14, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "No model was supplied, defaulted to sshleifer/distilbart-cnn-12-6 and revision a4f8f3e (https://huggingface.co/sshleifer/distilbart-cnn-12-6).\n", "Using a pipeline without specifying a model name and revision in production is not recommended.\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "[{'summary_text': ' America has changed dramatically during recent years . The number of engineering graduates in the U.S. has declined in traditional engineering disciplines such as mechanical, civil, electrical, chemical, and aeronautical engineering . Rapidly developing economies such as China and India continue to encourage and advance the teaching of engineering .'}]" ] }, "metadata": {}, "execution_count": 14 } ] }, { "cell_type": "markdown", "source": [ "### **TRANSLATION:**" ], "metadata": { "id": "JukLFMN6LGRq" } }, { "cell_type": "code", "source": [ "#@ IMPLEMENTATION OF TRANSLATION PIPELINE: \n", "translator = pipeline(\"translation\", model=\"Helsinki-NLP/opus-mt-fr-en\") # Initializing Translator Object. \n", "translator(\"Ce cours est produit par Hugging Face.\") # Inspecting Translation. " ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 168, "referenced_widgets": [ "a366daa8a5724ef5911a78e1e9ffd39c", "a4fc66940fee41c890cd1365ab09bb9c", "80ba5dc94bb241728e86a8650e2d72b8", "b34c9f052d334133a598c8dc3b09659d", "f169dbb09d80415fb6b396bb3b373faf", "551f86c4cac14e4898f9a31642ffce03", "1c2664c6ddcd480381b993e49fd4471f", "8ca1ea420b3d4537a83e7d20b7f0cd3c", "a4802e67d79d41a6a138bce8391df68d", "786177d5050e4d42a057833c3396e9f2", "7ef46cc8b82742e38b7881de1298119d", "d23405a3d6ac4ed4b8cd23f2f52616cd", "61dd52bb0c5f4f1899552afd37d0e95e", "6980a6cf10e543a78a3942da0574e7da", "5edf97ce410d45f4a982464b5de7c4ca", "3d441fccf07148c194e76c3567b50338", "5f43a463a28c4b62829381e9c30a173d", "5ea7db53cb9e4cb88270e189da94649e", "21082a6a1fdd4170a78f8d56fca4399e", "56689cfe77064e8b973c80389eb1f6a1", "1f0d105b89c345ada3e6c59fbf5be00c", "ba4e01ebbfb54b0f98efa0d9a0735df4", "d1f0d98e85f64836b6e21896ab342de6", "3a1146da456345a0ae2d4f6e8c27d903", "ab9b616aa5e3457b9875ce70b614ddcf", "02b247fc179643ec9aca8321855aab94", "59f466e226bc41a8ac1ea878c7b7be1d", "46c6aab6997548cba550a8818a677748", "8c76f99347134249ac888eaee23e2ad8", "5fc912b1da2f48b69de578f5015b82f9", "e7860a8b6b3943948d9b0928d4864744", "fda43e7cbcf1460cbaff8e1666e2a72e", "b3a4fe4f70054a9c8e2faef9644388db" ] }, "id": "aEcD0rquKsMx", "outputId": "c8deaac9-6cfe-4a8a-ee48-be18576b8f84" }, "execution_count": 15, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "Downloading (…)olve/main/source.spm: 0%| | 0.00/802k [00:00