{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "GEM_Hackathon_2021_filters_tutorial.ipynb", "provenance": [], "collapsed_sections": [] }, "kernelspec": { "display_name": "Python 3", "name": "python3" }, "language_info": { "name": "python" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "e4c1e861f8434fa29cff33f367c61d7a": { "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_83f25fd2658142e4a2be06e00a7966cb", "IPY_MODEL_3bbe92c3974641b98d8ef5777dc491de" ], "layout": "IPY_MODEL_d6fcdf4b5c194a7380a8a0df60ae2298" } }, "83f25fd2658142e4a2be06e00a7966cb": { "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": "Downloading: 100%", "description_tooltip": null, "layout": "IPY_MODEL_fc7335335b114e22b33db1a830ea90e4", "max": 5020, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_7402db88b7eb43b38f347384a49b53ec", "value": 5020 } }, "3bbe92c3974641b98d8ef5777dc491de": { "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_d77a514d39a14142a1c51a2e7d136565", "placeholder": "​", "style": "IPY_MODEL_e2f417a1a55a463297ee168f687a29d3", "value": " 5.02k/5.02k [00:08<00:00, 616B/s]" } }, "d6fcdf4b5c194a7380a8a0df60ae2298": { "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 } }, "fc7335335b114e22b33db1a830ea90e4": { "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 } }, "7402db88b7eb43b38f347384a49b53ec": { "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": "initial" } }, "d77a514d39a14142a1c51a2e7d136565": { "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 } }, "e2f417a1a55a463297ee168f687a29d3": { "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": "" } }, "8fce5b95f6db4c13a99886bb178e4c1d": { "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_bfb105f1cfdf4702a4822f207b927d1e", "IPY_MODEL_07386fcb9b8a4a25b4a06136cf2d69c5" ], "layout": "IPY_MODEL_e89ec92a3ae34d239e3b131fc240fc34" } }, "bfb105f1cfdf4702a4822f207b927d1e": { "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": "Downloading: 100%", "description_tooltip": null, "layout": "IPY_MODEL_0ad3dcd165ed43ad800fca8946d7716e", "max": 101226421, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_d0e42ee4fc854b73b2b8929ff2a26cde", "value": 101226421 } }, "07386fcb9b8a4a25b4a06136cf2d69c5": { "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_29f4ba3028a3498ab802f96fb1c42fb8", "placeholder": "​", "style": "IPY_MODEL_fa507001884643a387d7e0a46d498604", "value": " 101M/101M [00:07<00:00, 14.0MB/s]" } }, "e89ec92a3ae34d239e3b131fc240fc34": { "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 } }, "0ad3dcd165ed43ad800fca8946d7716e": { "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 } }, "d0e42ee4fc854b73b2b8929ff2a26cde": { "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": "initial" } }, "29f4ba3028a3498ab802f96fb1c42fb8": { "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 } }, "fa507001884643a387d7e0a46d498604": { "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": "" } }, "90e1a383e3354125bd158c5952920ad3": { "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_99dd5c88984f4952ad65f5ba1e5becc2", "IPY_MODEL_249a2b434fa4421fbcaee04512306ef5" ], "layout": "IPY_MODEL_e9f93c50c219406a82f55127ad09b555" } }, "99dd5c88984f4952ad65f5ba1e5becc2": { "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": "Downloading: 100%", "description_tooltip": null, "layout": "IPY_MODEL_a4812e4c447c4288bff063b6bd86ee66", "max": 43457905, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_c068b76648fa47b5a30c251c0630160c", "value": 43457905 } }, "249a2b434fa4421fbcaee04512306ef5": { "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_56a75ac849ef4e22a02de0b56d05d13e", "placeholder": "​", "style": "IPY_MODEL_532c0b0e92ad4323bfada2ad17cd64c3", "value": " 43.5M/43.5M [00:02<00:00, 20.4MB/s]" } }, "e9f93c50c219406a82f55127ad09b555": { "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 } }, "a4812e4c447c4288bff063b6bd86ee66": { "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 } }, "c068b76648fa47b5a30c251c0630160c": { "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": "initial" } }, "56a75ac849ef4e22a02de0b56d05d13e": { "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 } }, "532c0b0e92ad4323bfada2ad17cd64c3": { "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": "" } }, "8307844b3fda4eb68eebc048c5f9eb11": { "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_815255b488c745519de3e645e96d7d19", "IPY_MODEL_9ec7464fe62d4f359fb007eb47fa2343" ], "layout": "IPY_MODEL_5463eaab09e640ce851d457ffc3ba2bb" } }, "815255b488c745519de3e645e96d7d19": { "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": "Downloading: 100%", "description_tooltip": null, "layout": "IPY_MODEL_85d410e7c9024609bd80a54b449093e6", "max": 14480863, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_7663b3bd79db43a1982c4c46d2d6a83a", "value": 14480863 } }, "9ec7464fe62d4f359fb007eb47fa2343": { "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_5feec27442e74914aa98c7b05a55af21", "placeholder": "​", "style": "IPY_MODEL_18e6b91315504e95b45faf94698b4ab5", "value": " 14.5M/14.5M [00:01<00:00, 10.5MB/s]" } }, "5463eaab09e640ce851d457ffc3ba2bb": { "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 } }, "85d410e7c9024609bd80a54b449093e6": { "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 } }, "7663b3bd79db43a1982c4c46d2d6a83a": { "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": "initial" } }, "5feec27442e74914aa98c7b05a55af21": { "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 } }, "18e6b91315504e95b45faf94698b4ab5": { "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": "" } }, "9886e2d3e8114db39cc4adf098a50be5": { "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_ca1c50a7ea1c47469339a0eab4c32fb8", "IPY_MODEL_7bf0345f9db84e468ccb58901c881f39" ], "layout": "IPY_MODEL_b68d75b7ad23470e9d5d1aa3f7639ecd" } }, "ca1c50a7ea1c47469339a0eab4c32fb8": { "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": "info", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_b3887cde43174c40b5cc5575aba0f106", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_7070284d09a640f296ad5337698a5e68", "value": 1 } }, "7bf0345f9db84e468ccb58901c881f39": { "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_83fb9bb42d734abe9878f7c4fcb212e9", "placeholder": "​", "style": "IPY_MODEL_e4139a008d574efb9a5b1cec6790d848", "value": "90403 examples [00:16, 15097.76 examples/s]" } }, "b68d75b7ad23470e9d5d1aa3f7639ecd": { "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 } }, "b3887cde43174c40b5cc5575aba0f106": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": "20px" } }, "7070284d09a640f296ad5337698a5e68": { "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": "initial" } }, "83fb9bb42d734abe9878f7c4fcb212e9": { "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 } }, "e4139a008d574efb9a5b1cec6790d848": { "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": "" } }, "59abc07b8f594485a4cbe01360341705": { "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_cea605e546a14d70bfb23cf6568eee27", "IPY_MODEL_c269d4210e754a75a45e4995e4f9c3b5" ], "layout": "IPY_MODEL_4b4984daa68a4cd6953539e58b763bdb" } }, "cea605e546a14d70bfb23cf6568eee27": { "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": "info", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_0fe578cb04654fae89322571049c48e7", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_89d31e1e5f99473485f4025971ed6a1d", "value": 1 } }, "c269d4210e754a75a45e4995e4f9c3b5": { "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_4c3312c6902e4436a5368f1e86eed65a", "placeholder": "​", "style": "IPY_MODEL_91930c1187a04a91b4c59e0ceb883d56", "value": "11873 examples [00:01, 110.35 examples/s]" } }, "4b4984daa68a4cd6953539e58b763bdb": { "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 } }, "0fe578cb04654fae89322571049c48e7": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": "20px" } }, "89d31e1e5f99473485f4025971ed6a1d": { "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": "initial" } }, "4c3312c6902e4436a5368f1e86eed65a": { "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 } }, "91930c1187a04a91b4c59e0ceb883d56": { "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": "" } }, "3abd5ba4771248d796a890b8ed055f01": { "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_25034a9f750c442599809bed8f47a029", "IPY_MODEL_1f2594d50c8c4df6ada87486ae897f58" ], "layout": "IPY_MODEL_7d35cb7d0127409a9dc8b9203b228c79" } }, "25034a9f750c442599809bed8f47a029": { "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": "info", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_7475e328a906408492734428a2d5157d", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_20aa9ff64ac5483095c849a35676958e", "value": 1 } }, "1f2594d50c8c4df6ada87486ae897f58": { "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_99dbd39ad800493aa21656eaba325c68", "placeholder": "​", "style": "IPY_MODEL_b3591d13bc4647b4b122244686f01793", "value": "39916 examples [00:03, 8913.27 examples/s]" } }, "7d35cb7d0127409a9dc8b9203b228c79": { "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 } }, "7475e328a906408492734428a2d5157d": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": "20px" } }, "20aa9ff64ac5483095c849a35676958e": { "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": "initial" } }, "99dbd39ad800493aa21656eaba325c68": { "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 } }, "b3591d13bc4647b4b122244686f01793": { "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", "metadata": { "id": "d86DXrMMd1_X" }, "source": [ "# 1. Get NL-Augmenter and install dependencies" ] }, { "cell_type": "markdown", "metadata": { "id": "AZHffzbAfii2" }, "source": [ "## Copy git repository of NL-Augmenter" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "6itEUtbWiYr8", "outputId": "090b81f5-d40d-4e5f-89cc-e214ca908a77" }, "source": [ "!git clone https://www.github.com/GEM-benchmark/NL-Augmenter" ], "execution_count": null, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Cloning into 'NL-Augmenter'...\n", "warning: redirecting to https://github.com/GEM-benchmark/NL-Augmenter.git/\n", "remote: Enumerating objects: 11984, done.\u001b[K\n", "remote: Counting objects: 100% (655/655), done.\u001b[K\n", "remote: Compressing objects: 100% (443/443), done.\u001b[K\n", "remote: Total 11984 (delta 366), reused 399 (delta 211), pack-reused 11329\u001b[K\n", "Receiving objects: 100% (11984/11984), 91.26 MiB | 20.42 MiB/s, done.\n", "Resolving deltas: 100% (7821/7821), done.\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "0tPppU_HfrkS" }, "source": [ "## Go to newly copied directory" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "dR62jWALiZrn", "outputId": "60bc71a6-32c5-4424-eb2a-39de848e9bb2" }, "source": [ "cd NL-Augmenter" ], "execution_count": null, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/content/NL-Augmenter\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "XVYUdoj2f7xW" }, "source": [ "## Install requirements" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "bUVJQTXRigRR", "outputId": "a446b5c8-b8b2-4c1a-defc-c80fba3b4c2d" }, "source": [ "!pip install -r requirements.txt --quiet\n", "!pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz" ], "execution_count": null, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[K |████████████████████████████████| 12.1 MB 4.8 MB/s \n", "\u001b[K |████████████████████████████████| 12.7 MB 37.4 MB/s \n", "\u001b[K |████████████████████████████████| 101 kB 7.6 MB/s \n", "\u001b[K |████████████████████████████████| 280 kB 46.6 MB/s \n", "\u001b[K |████████████████████████████████| 234 kB 50.5 MB/s \n", "\u001b[K |████████████████████████████████| 2.2 MB 43.7 MB/s \n", "\u001b[K |████████████████████████████████| 54 kB 2.9 MB/s \n", "\u001b[K |████████████████████████████████| 43 kB 1.9 MB/s \n", "\u001b[K |████████████████████████████████| 1.2 MB 35.9 MB/s \n", "\u001b[K |████████████████████████████████| 138 kB 49.2 MB/s \n", "\u001b[K |████████████████████████████████| 190 kB 37.9 MB/s \n", "\u001b[K |████████████████████████████████| 73 kB 1.6 MB/s \n", "\u001b[K |████████████████████████████████| 105 kB 49.7 MB/s \n", "\u001b[K |████████████████████████████████| 22.3 MB 60.1 MB/s \n", "\u001b[K |████████████████████████████████| 167 kB 57.4 MB/s \n", "\u001b[K |████████████████████████████████| 628 kB 48.5 MB/s \n", "\u001b[K |████████████████████████████████| 9.1 MB 44.5 MB/s \n", "\u001b[K |████████████████████████████████| 42 kB 1.3 MB/s \n", "\u001b[K |████████████████████████████████| 451 kB 41.4 MB/s \n", "\u001b[K |████████████████████████████████| 213 kB 47.3 MB/s \n", "\u001b[K |████████████████████████████████| 56 kB 3.9 MB/s \n", "\u001b[K |████████████████████████████████| 132 kB 48.7 MB/s \n", "\u001b[K |████████████████████████████████| 69 kB 6.7 MB/s \n", "\u001b[K |████████████████████████████████| 243 kB 44.8 MB/s \n", "\u001b[K |████████████████████████████████| 895 kB 39.9 MB/s \n", "\u001b[K |████████████████████████████████| 3.3 MB 38.6 MB/s \n", "\u001b[K |████████████████████████████████| 843 kB 39.9 MB/s \n", "\u001b[K |████████████████████████████████| 749 kB 37.6 MB/s \n", "\u001b[K |████████████████████████████████| 98 kB 7.7 MB/s \n", "\u001b[K |████████████████████████████████| 5.6 MB 26.4 MB/s \n", "\u001b[K |████████████████████████████████| 596 kB 42.2 MB/s \n", "\u001b[K |████████████████████████████████| 41 kB 591 kB/s \n", "\u001b[K |████████████████████████████████| 68 kB 6.8 MB/s \n", "\u001b[K |████████████████████████████████| 496 kB 38.1 MB/s \n", "\u001b[K |████████████████████████████████| 81 kB 8.4 MB/s \n", "\u001b[K |████████████████████████████████| 5.6 MB 32.1 MB/s \n", "\u001b[K |████████████████████████████████| 5.6 MB 32.8 MB/s \n", "\u001b[K |████████████████████████████████| 419 kB 44.2 MB/s \n", "\u001b[K |████████████████████████████████| 97 kB 6.3 MB/s \n", "\u001b[K |████████████████████████████████| 3.6 MB 27.7 MB/s \n", "\u001b[?25h Building wheel for checklist (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Building wheel for word2number (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Building wheel for seqeval (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Building wheel for iso-639 (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Building wheel for patternfork-nosql (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Building wheel for python-docx (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Building wheel for sgmllib3k (setup.py) ... \u001b[?25l\u001b[?25hdone\n", "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", "datascience 0.10.6 requires coverage==3.7.1, but you have coverage 6.2 which is incompatible.\n", "datascience 0.10.6 requires folium==0.2.1, but you have folium 0.8.3 which is incompatible.\n", "coveralls 0.5 requires coverage<3.999,>=3.6, but you have coverage 6.2 which is incompatible.\u001b[0m\n", "Collecting https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz\n", " Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz (13.7 MB)\n", "\u001b[K |████████████████████████████████| 13.7 MB 5.5 MB/s \n", "\u001b[?25hRequirement already satisfied: spacy<3.1.0,>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from en-core-web-sm==3.0.0) (3.0.0)\n", "Requirement already satisfied: typing-extensions>=3.7.4 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (3.10.0.2)\n", "Requirement already satisfied: wasabi<1.1.0,>=0.8.1 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (0.8.2)\n", "Requirement already satisfied: requests<3.0.0,>=2.13.0 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (2.23.0)\n", "Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (2.0.6)\n", "Requirement already satisfied: jinja2 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (2.11.3)\n", "Requirement already satisfied: setuptools in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (57.4.0)\n", "Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (4.49.0)\n", "Requirement already satisfied: numpy>=1.15.0 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (1.19.5)\n", "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (21.3)\n", "Requirement already satisfied: thinc<8.1.0,>=8.0.0 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (8.0.13)\n", "Requirement already satisfied: catalogue<2.1.0,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (2.0.6)\n", "Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (3.0.6)\n", "Requirement already satisfied: srsly<3.0.0,>=2.4.0 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (2.4.2)\n", "Requirement already satisfied: typer<0.4.0,>=0.3.0 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (0.3.2)\n", "Requirement already satisfied: pydantic<1.8.0,>=1.7.1 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (1.7.4)\n", "Requirement already satisfied: spacy-legacy<3.1.0,>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (3.0.8)\n", "Requirement already satisfied: importlib-metadata>=0.20 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (4.8.2)\n", "Requirement already satisfied: blis<0.8.0,>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (0.4.1)\n", "Requirement already satisfied: pathy in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (0.6.1)\n", "Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /usr/local/lib/python3.7/dist-packages (from spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (1.0.6)\n", "Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from catalogue<2.1.0,>=2.0.1->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (3.6.0)\n", "Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from packaging>=20.0->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (3.0.6)\n", "Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests<3.0.0,>=2.13.0->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (3.0.4)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests<3.0.0,>=2.13.0->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (2021.10.8)\n", "Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests<3.0.0,>=2.13.0->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (1.24.3)\n", "Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests<3.0.0,>=2.13.0->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (2.10)\n", "Requirement already satisfied: click<7.2.0,>=7.1.1 in /usr/local/lib/python3.7/dist-packages (from typer<0.4.0,>=0.3.0->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (7.1.2)\n", "Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/dist-packages (from jinja2->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (2.0.1)\n", "Requirement already satisfied: smart-open<6.0.0,>=5.0.0 in /usr/local/lib/python3.7/dist-packages (from pathy->spacy<3.1.0,>=3.0.0->en-core-web-sm==3.0.0) (5.2.1)\n", "Building wheels for collected packages: en-core-web-sm\n", " Building wheel for en-core-web-sm (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Created wheel for en-core-web-sm: filename=en_core_web_sm-3.0.0-py3-none-any.whl size=13704318 sha256=024655289c95d06a6630329fdc1dee46676c9ac4c285e9ea9e1b2a02142d8bc4\n", " Stored in directory: /root/.cache/pip/wheels/2d/86/ba/c33ceff8af5cb8a963e86131912039d39b37227f9787661bca\n", "Successfully built en-core-web-sm\n", "Installing collected packages: en-core-web-sm\n", " Attempting uninstall: en-core-web-sm\n", " Found existing installation: en-core-web-sm 2.2.5\n", " Uninstalling en-core-web-sm-2.2.5:\n", " Successfully uninstalled en-core-web-sm-2.2.5\n", "Successfully installed en-core-web-sm-3.0.0\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "A4n-PqAAfJes" }, "source": [ "# 2. Load the data" ] }, { "cell_type": "markdown", "metadata": { "id": "T_GV8XWlgMMr" }, "source": [ "## Get dataloader and use it to load CommonGen dataset" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 383, "referenced_widgets": [ "e4c1e861f8434fa29cff33f367c61d7a", "83f25fd2658142e4a2be06e00a7966cb", "3bbe92c3974641b98d8ef5777dc491de", "d6fcdf4b5c194a7380a8a0df60ae2298", "fc7335335b114e22b33db1a830ea90e4", "7402db88b7eb43b38f347384a49b53ec", "d77a514d39a14142a1c51a2e7d136565", "e2f417a1a55a463297ee168f687a29d3", "8fce5b95f6db4c13a99886bb178e4c1d", "bfb105f1cfdf4702a4822f207b927d1e", "07386fcb9b8a4a25b4a06136cf2d69c5", "e89ec92a3ae34d239e3b131fc240fc34", "0ad3dcd165ed43ad800fca8946d7716e", "d0e42ee4fc854b73b2b8929ff2a26cde", "29f4ba3028a3498ab802f96fb1c42fb8", "fa507001884643a387d7e0a46d498604", "90e1a383e3354125bd158c5952920ad3", "99dd5c88984f4952ad65f5ba1e5becc2", "249a2b434fa4421fbcaee04512306ef5", "e9f93c50c219406a82f55127ad09b555", "a4812e4c447c4288bff063b6bd86ee66", "c068b76648fa47b5a30c251c0630160c", "56a75ac849ef4e22a02de0b56d05d13e", "532c0b0e92ad4323bfada2ad17cd64c3", "8307844b3fda4eb68eebc048c5f9eb11", "815255b488c745519de3e645e96d7d19", "9ec7464fe62d4f359fb007eb47fa2343", "5463eaab09e640ce851d457ffc3ba2bb", "85d410e7c9024609bd80a54b449093e6", "7663b3bd79db43a1982c4c46d2d6a83a", "5feec27442e74914aa98c7b05a55af21", "18e6b91315504e95b45faf94698b4ab5", "9886e2d3e8114db39cc4adf098a50be5", "ca1c50a7ea1c47469339a0eab4c32fb8", "7bf0345f9db84e468ccb58901c881f39", "b68d75b7ad23470e9d5d1aa3f7639ecd", "b3887cde43174c40b5cc5575aba0f106", "7070284d09a640f296ad5337698a5e68", "83fb9bb42d734abe9878f7c4fcb212e9", "e4139a008d574efb9a5b1cec6790d848", "59abc07b8f594485a4cbe01360341705", "cea605e546a14d70bfb23cf6568eee27", "c269d4210e754a75a45e4995e4f9c3b5", "4b4984daa68a4cd6953539e58b763bdb", "0fe578cb04654fae89322571049c48e7", "89d31e1e5f99473485f4025971ed6a1d", "4c3312c6902e4436a5368f1e86eed65a", "91930c1187a04a91b4c59e0ceb883d56", "3abd5ba4771248d796a890b8ed055f01", "25034a9f750c442599809bed8f47a029", "1f2594d50c8c4df6ada87486ae897f58", "7d35cb7d0127409a9dc8b9203b228c79", "7475e328a906408492734428a2d5157d", "20aa9ff64ac5483095c849a35676958e", "99dbd39ad800493aa21656eaba325c68", "b3591d13bc4647b4b122244686f01793" ] }, "id": "VrIfrgGNj6WQ", "outputId": "4f261007-bb01-48b0-8ef6-7e289f305fd8" }, "source": [ "from datasets import load_dataset\n", "\n", "data = load_dataset(\"GEM/squad_v2\")" ], "execution_count": null, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "e4c1e861f8434fa29cff33f367c61d7a", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(FloatProgress(value=0.0, description='Downloading', max=5020.0, style=ProgressStyle(description…" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stderr", "output_type": "stream", "text": [ "Using custom data configuration default\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "Downloading and preparing dataset squad_v2/default (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /root/.cache/huggingface/datasets/squad_v2/default/0.0.0/f5f48a1a69d6d37fb09e1d978247e78f1885a13ac6f4ad4c8c6388cb79c76cdd...\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8fce5b95f6db4c13a99886bb178e4c1d", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(FloatProgress(value=0.0, description='Downloading', max=101226421.0, style=ProgressStyle(descri…" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "90e1a383e3354125bd158c5952920ad3", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(FloatProgress(value=0.0, description='Downloading', max=43457905.0, style=ProgressStyle(descrip…" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8307844b3fda4eb68eebc048c5f9eb11", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(FloatProgress(value=0.0, description='Downloading', max=14480863.0, style=ProgressStyle(descrip…" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "9886e2d3e8114db39cc4adf098a50be5", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(FloatProgress(value=1.0, bar_style='info', layout=Layout(width='20px'), max=1.0), HTML(value=''…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "59abc07b8f594485a4cbe01360341705", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(FloatProgress(value=1.0, bar_style='info', layout=Layout(width='20px'), max=1.0), HTML(value=''…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "3abd5ba4771248d796a890b8ed055f01", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(FloatProgress(value=1.0, bar_style='info', layout=Layout(width='20px'), max=1.0), HTML(value=''…" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Dataset squad_v2 downloaded and prepared to /root/.cache/huggingface/datasets/squad_v2/default/0.0.0/f5f48a1a69d6d37fb09e1d978247e78f1885a13ac6f4ad4c8c6388cb79c76cdd. Subsequent calls will reuse this data.\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "TpkLKbsvgeQp" }, "source": [ "## Explore data structure" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "9TononzpkSc2", "outputId": "6ceb023f-91e8-4485-a214-4781469d2c19" }, "source": [ "data" ], "execution_count": null, "outputs": [ { "data": { "text/plain": [ "DatasetDict({\n", " train: Dataset({\n", " features: ['gem_id', 'id', 'title', 'context', 'question', 'answers'],\n", " num_rows: 90403\n", " })\n", " validation: Dataset({\n", " features: ['gem_id', 'id', 'title', 'context', 'question', 'answers'],\n", " num_rows: 11873\n", " })\n", " test: Dataset({\n", " features: ['gem_id', 'id', 'title', 'context', 'question', 'answers'],\n", " num_rows: 39916\n", " })\n", "})" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ] }, { "cell_type": "markdown", "metadata": { "id": "jWaFVlMtg3iG" }, "source": [ "## Retrieve one entry from a train subset" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "D0Q3gMyMkcxt", "outputId": "16531896-0184-43f3-fd47-bf97ce69c662" }, "source": [ "train_instance = data['train'][0]\n", "train_instance" ], "execution_count": null, "outputs": [ { "data": { "text/plain": [ "{'answers': {'answer_start': [18], 'text': ['Dublin, Ireland']},\n", " 'context': \"Burke was born in Dublin, Ireland. His mother Mary née Nagle (c. 1702 – 1770) was a Roman Catholic who hailed from a déclassé County Cork family (and a cousin of Nano Nagle), whereas his father, a successful solicitor, Richard (died 1761), was a member of the Church of Ireland; it remains unclear whether this is the same Richard Burke who converted from Catholicism. The Burke dynasty descends from an Anglo-Norman knight surnamed de Burgh (latinised as de Burgo) who arrived in Ireland in 1185 following Henry II of England's 1171 invasion of Ireland.\",\n", " 'gem_id': 'gem-squad_v2-train-0',\n", " 'id': '572699c4dd62a815002e8ab2',\n", " 'question': 'Where was Burke born?',\n", " 'title': 'Edmund_Burke'}" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ] }, { "cell_type": "markdown", "metadata": { "id": "QMJXgYtEhQkI" }, "source": [ "## Retrieve a target sentence from this entry object" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 35 }, "id": "_vwM1nq2k_U3", "outputId": "b7e28d45-f2d1-4c5c-a334-007fcf99ab85" }, "source": [ "sentence = train_instance.get(\"question\")\n", "sentence" ], "execution_count": null, "outputs": [ { "data": { "application/vnd.google.colaboratory.intrinsic+json": { "type": "string" }, "text/plain": [ "'Where was Burke born?'" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ] }, { "cell_type": "markdown", "metadata": { "id": "gjXQnhLShpin" }, "source": [ "# 3. Test the filter" ] }, { "cell_type": "markdown", "metadata": { "id": "YpLi1-9Thyxk" }, "source": [ "## Load a filter class from a corresponding ditectory and try the example from its ReadMe" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "GxpwSB9Uiim3", "outputId": "c8edeaed-6a90-4772-cbb0-14b5461fc5f9" }, "source": [ "from filters.question_filter import *\n", "\n", "f1 = WhereQuestion()\n", "f2 = WhatQuestion()\n", "f3 = WhoQuestion()\n", "f4 = WhichQuestion()\n", "f5 = WhyQuestion()\n", "f6 = WhenQuestion()\n", "filter_obj = [f1, f2, f3, f4, f5, f6]\n", "for f in filter_obj:\n", " print(f.filter(question=sentence))" ], "execution_count": null, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "True\n", "False\n", "False\n", "False\n", "False\n", "False\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "KgMK5NZ3iIMc" }, "source": [ "## Take a subset of target sentences from CommonGem dataset \n" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "jM8b6hQ1rG_w", "outputId": "36be13fe-85bb-417d-82d4-97687d1f4ab0" }, "source": [ "def get_sentences(split_name, num_iter):\n", " sentences = []\n", " for i in range(num_iter):\n", " sentence = data[split_name][i].get(\"question\")\n", " sentences.append(sentence)\n", " return sentences\n", "\n", "sentences = get_sentences('train', 100)\n", "sentences" ], "execution_count": null, "outputs": [ { "data": { "text/plain": [ "['Where was Burke born?',\n", " \"What was Burke's mother's maiden name?\",\n", " \"When did Burke's mother die?\",\n", " \"When did Burke's father die?\",\n", " \"When did Burke's ancestors arrive in Ireland?\",\n", " 'What city was Mary nee Nagle born in?',\n", " 'When was Richard Burke born?',\n", " 'What is the latinised form of the last name Burke?',\n", " 'When did Henry II invade England?',\n", " 'Who converted into Catholicism?',\n", " 'When did Burke begin attending Trinity College Dublin?',\n", " 'What type of people did Trinity College Dublin not allow to earn degrees there?',\n", " 'When did Edmund Burke start a debate club?',\n", " \"What club did Edmund Burke's debate club merge with in 1770?\",\n", " 'When did Edmund Burke graduate?',\n", " 'When was Trinity College Dublin established?',\n", " 'In what year did Trinity College ban Catholics?',\n", " \"Who did Edmund Burke's Club split from?\",\n", " 'What group of people did Middle Temple refuse to grant degrees to?',\n", " 'What year did Burke abandon law?',\n", " \"Which bishop didn't realize the satirical nature of Burke's book?\",\n", " \"Which lord didn't realize the satirical nature of Burke's book?\",\n", " \"When was the 2nd edition of Burke's book published?\",\n", " 'Where did Burke make it clear that his book was a satire?',\n", " 'What did Bolingbroke argue for?',\n", " \"What did Lord Chesterfield believe Bolingbroke's arguments could also apply to?\",\n", " \"What did critics particularly protest of Burke's work?\",\n", " 'What did Burke note in the preface of the first edition of the book?',\n", " \"Which bishop wrote the preface for Burke's book?\",\n", " \"Who thought that Burke's imitation was too perfect to be effective ridicule?\",\n", " \"Why did a few scholars think Burke hadn't intended his book as a satire yet later claimed it was a satire?\",\n", " 'Whose principles did Burke imitate?',\n", " \"What did Richard Hurd claim made Burke's satire perfect?\",\n", " 'What is the name of one of the scholars who believe Burke wrote the Vindication in earnest?',\n", " 'What is the name of the book Richard Hurd wrote?',\n", " \"Why did Hurd believe Burke's imitation was near perfect?\",\n", " 'Whose principles did L. Bol imitate?',\n", " 'When did Burke sign a contract for a history of England?',\n", " \"How many words long was Burke's history of England contracted to be?\",\n", " \"How many pages long was Burke's history of England contracted to be?\",\n", " \"When was Burke's history of England published?\",\n", " \"Which author's history of England being published before Burke's might have dissuaded Burke from continuing his?\",\n", " \"What is the name of David Hume's history?\",\n", " \"What critic praised the Frenchness of Burke's text?\",\n", " \"When was Hume's history of England published?\",\n", " 'How long was the book Robert Dodsley wrote?',\n", " \"How many words was Lord Acton's commentary?\",\n", " 'What publication did Burke found?',\n", " 'The Annual Register covered international events of what type?',\n", " 'Burke was the only known writer for the Register until what year?',\n", " 'Burke was the chief editor for the Register until at least what year?',\n", " 'Who wrote a biography of Burke?',\n", " 'What was founded the year before the contract?',\n", " 'Whose biography did Burke write?',\n", " 'When did Burke become the chief editor?',\n", " \"Who wrote Dodsley's biography?\",\n", " 'Dodsley was the only writer for the register until what year?',\n", " \"What was William Gerard Hamilton's nickname?\",\n", " \"Who was William Gerard Hamilton's private secretary?\",\n", " \"When did Burke become the Prime Minister's private secretary?\",\n", " 'Who invited Burke to join the Freemasons?',\n", " 'What political party was Charles, Marquess of Rockingham in?',\n", " \"What was Burke's nickname?\",\n", " \"Who was Burke's secretary?\",\n", " 'What country was Burke the Chief Secretary for?',\n", " 'What year did Burke go with Hamilton to Dublin?',\n", " 'When did Hamilton die?',\n", " 'Who did Burke want constitutional limits on the power of?',\n", " 'What type of institution did Burke think could offer opposition to abuses of power?',\n", " 'What type of group were the \"king\\'s friends\"?',\n", " \"What was Burke's most important publication about limiting royal power?\",\n", " 'Who wanted to limit the powers of the political parties?',\n", " 'What was the name of the paper the neo-Tories published?',\n", " 'When did Burke take the leading role in the debate?',\n", " 'What party did Burke believe would have strong principles?',\n", " 'What were Burke and his friends nicknamed?',\n", " 'What country did Burke propose restricting trade with?',\n", " 'What city did Burke represent in parliament?',\n", " 'When did Burke make a motion to restrict Irish trade?',\n", " \"What was Bristol's most important industry?\",\n", " 'What country did Burke wish to decrease trade with?',\n", " \"What city supported Burke's decisions?\",\n", " 'When was trade with Ireland originally restricted?',\n", " 'Why did Burke say he acquiesced to his constituents?',\n", " 'Where was Burke worried Britain might not win a war?',\n", " 'How many reasons against violence did Burke present?',\n", " 'How far away was the potential conflict Burke argued against?',\n", " 'What area could the American colonists retreat to?',\n", " 'Who did Burke think Britain could beat at war?',\n", " 'What did Burke say was a victory?',\n", " 'How many reasons in favor of the use of force did Burke present?',\n", " 'What type of war did Burke endorse for the government?',\n", " 'What geographical feature would prevent the Americans from retreating?',\n", " 'When did Lord Bathurst die?',\n", " 'When did an angel supposedly speak to Bathurst?',\n", " 'What political position did Samuel Johnson say would soon poison America?',\n", " 'When was Lord Bathurst born?',\n", " \"In Samuel Johnson's writing, who appeared to a Whig?\",\n", " 'What did Bathurst prophesy? ',\n", " 'When did Samuel Johnson die?']" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ] }, { "cell_type": "markdown", "metadata": { "id": "itxrvpogigSD" }, "source": [ "## Apply a filter to this small subset" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "vZN-yXquuP-j", "outputId": "2f6e8697-5642-44ee-b3fc-cb433988ee58" }, "source": [ "for f in filter_obj:\n", " print([f.filter(question=entry) for entry in sentences])" ], "execution_count": null, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]\n", "[False, True, False, False, False, True, False, True, False, False, False, True, False, True, False, False, True, False, True, True, False, False, False, False, True, True, True, True, False, False, False, False, True, True, True, False, False, False, False, False, False, False, True, True, False, False, False, True, True, True, True, False, True, False, False, False, True, True, False, False, False, True, True, False, True, True, False, False, True, True, True, False, True, False, True, True, True, True, False, True, True, True, False, False, False, False, False, True, False, True, False, True, True, False, False, True, False, False, True, False]\n", "[False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, True, False, False, True, False, True, False, False, True, False, False, False, True, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, True, False, False]\n", "[False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]\n", "[False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]\n", "[False, False, True, True, True, False, True, False, True, False, True, False, True, False, True, True, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, True, False, False, False, True, False, False, False, False, False, False, False, False, False, True, False, False, False, False, True, False, False, False, False, False, False, True, False, False, False, False, False, False, True, False, False, False, False, True, False, False, False, True, False, False, False, False, False, False, False, False, False, False, True, True, False, True, False, False, True]\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "UUVKSJuhirRX" }, "source": [ "## Explore statistics which makes a filter returning the presence of gender bias" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "98iL8OjXuliC", "outputId": "94901909-cf15-4b04-c7df-7eaa76d84c47" }, "source": [ "def get_stats(text, filter_obj):\n", " for f in filter_obj:\n", " print(f\"{f.__class__.__name__} flagged questions : {sum([f.filter(question=entry) for entry in sentences])}\")\n", "\n", "get_stats(sentences, filter_obj)" ], "execution_count": null, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "WhereQuestion flagged questions : 3\n", "WhatQuestion flagged questions : 45\n", "WhoQuestion flagged questions : 13\n", "WhichQuestion flagged questions : 4\n", "WhyQuestion flagged questions : 3\n", "WhenQuestion flagged questions : 23\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "x8Fyq4Qui5eU" }, "source": [ "## Retrieve the sentences, corresponding to the statistics" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "R3qw6zORu-TI", "outputId": "b51711c7-9598-4ca0-cfee-8c0c01e829cd" }, "source": [ "def get_phrases(sentences, filter_obj):\n", " group = []\n", " for f in filter_obj:\n", " sent_list = {}\n", " sent_list[f.__class__.__name__] = [entry for entry in sentences if f.filter(question=entry)]\n", " group.append(sent_list)\n", " return group\n", "\n", "grouped_list = get_phrases(sentences, filter_obj)\n", "grouped_list" ], "execution_count": null, "outputs": [ { "data": { "text/plain": [ "[{'WhereQuestion': ['Where was Burke born?',\n", " 'Where did Burke make it clear that his book was a satire?',\n", " 'Where was Burke worried Britain might not win a war?']},\n", " {'WhatQuestion': [\"What was Burke's mother's maiden name?\",\n", " 'What city was Mary nee Nagle born in?',\n", " 'What is the latinised form of the last name Burke?',\n", " 'What type of people did Trinity College Dublin not allow to earn degrees there?',\n", " \"What club did Edmund Burke's debate club merge with in 1770?\",\n", " 'In what year did Trinity College ban Catholics?',\n", " 'What group of people did Middle Temple refuse to grant degrees to?',\n", " 'What year did Burke abandon law?',\n", " 'What did Bolingbroke argue for?',\n", " \"What did Lord Chesterfield believe Bolingbroke's arguments could also apply to?\",\n", " \"What did critics particularly protest of Burke's work?\",\n", " 'What did Burke note in the preface of the first edition of the book?',\n", " \"What did Richard Hurd claim made Burke's satire perfect?\",\n", " 'What is the name of one of the scholars who believe Burke wrote the Vindication in earnest?',\n", " 'What is the name of the book Richard Hurd wrote?',\n", " \"What is the name of David Hume's history?\",\n", " \"What critic praised the Frenchness of Burke's text?\",\n", " 'What publication did Burke found?',\n", " 'The Annual Register covered international events of what type?',\n", " 'Burke was the only known writer for the Register until what year?',\n", " 'Burke was the chief editor for the Register until at least what year?',\n", " 'What was founded the year before the contract?',\n", " 'Dodsley was the only writer for the register until what year?',\n", " \"What was William Gerard Hamilton's nickname?\",\n", " 'What political party was Charles, Marquess of Rockingham in?',\n", " \"What was Burke's nickname?\",\n", " 'What country was Burke the Chief Secretary for?',\n", " 'What year did Burke go with Hamilton to Dublin?',\n", " 'What type of institution did Burke think could offer opposition to abuses of power?',\n", " 'What type of group were the \"king\\'s friends\"?',\n", " \"What was Burke's most important publication about limiting royal power?\",\n", " 'What was the name of the paper the neo-Tories published?',\n", " 'What party did Burke believe would have strong principles?',\n", " 'What were Burke and his friends nicknamed?',\n", " 'What country did Burke propose restricting trade with?',\n", " 'What city did Burke represent in parliament?',\n", " \"What was Bristol's most important industry?\",\n", " 'What country did Burke wish to decrease trade with?',\n", " \"What city supported Burke's decisions?\",\n", " 'What area could the American colonists retreat to?',\n", " 'What did Burke say was a victory?',\n", " 'What type of war did Burke endorse for the government?',\n", " 'What geographical feature would prevent the Americans from retreating?',\n", " 'What political position did Samuel Johnson say would soon poison America?',\n", " 'What did Bathurst prophesy? ']},\n", " {'WhoQuestion': ['Who converted into Catholicism?',\n", " \"Who did Edmund Burke's Club split from?\",\n", " \"Who thought that Burke's imitation was too perfect to be effective ridicule?\",\n", " 'What is the name of one of the scholars who believe Burke wrote the Vindication in earnest?',\n", " 'Who wrote a biography of Burke?',\n", " \"Who wrote Dodsley's biography?\",\n", " \"Who was William Gerard Hamilton's private secretary?\",\n", " 'Who invited Burke to join the Freemasons?',\n", " \"Who was Burke's secretary?\",\n", " 'Who did Burke want constitutional limits on the power of?',\n", " 'Who wanted to limit the powers of the political parties?',\n", " 'Who did Burke think Britain could beat at war?',\n", " \"In Samuel Johnson's writing, who appeared to a Whig?\"]},\n", " {'WhichQuestion': [\"Which bishop didn't realize the satirical nature of Burke's book?\",\n", " \"Which lord didn't realize the satirical nature of Burke's book?\",\n", " \"Which bishop wrote the preface for Burke's book?\",\n", " \"Which author's history of England being published before Burke's might have dissuaded Burke from continuing his?\"]},\n", " {'WhyQuestion': [\"Why did a few scholars think Burke hadn't intended his book as a satire yet later claimed it was a satire?\",\n", " \"Why did Hurd believe Burke's imitation was near perfect?\",\n", " 'Why did Burke say he acquiesced to his constituents?']},\n", " {'WhenQuestion': [\"When did Burke's mother die?\",\n", " \"When did Burke's father die?\",\n", " \"When did Burke's ancestors arrive in Ireland?\",\n", " 'When was Richard Burke born?',\n", " 'When did Henry II invade England?',\n", " 'When did Burke begin attending Trinity College Dublin?',\n", " 'When did Edmund Burke start a debate club?',\n", " 'When did Edmund Burke graduate?',\n", " 'When was Trinity College Dublin established?',\n", " \"When was the 2nd edition of Burke's book published?\",\n", " 'When did Burke sign a contract for a history of England?',\n", " \"When was Burke's history of England published?\",\n", " \"When was Hume's history of England published?\",\n", " 'When did Burke become the chief editor?',\n", " \"When did Burke become the Prime Minister's private secretary?\",\n", " 'When did Hamilton die?',\n", " 'When did Burke take the leading role in the debate?',\n", " 'When did Burke make a motion to restrict Irish trade?',\n", " 'When was trade with Ireland originally restricted?',\n", " 'When did Lord Bathurst die?',\n", " 'When did an angel supposedly speak to Bathurst?',\n", " 'When was Lord Bathurst born?',\n", " 'When did Samuel Johnson die?']}]" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ] }, { "cell_type": "code", "metadata": { "id": "ecA9wIMZCQHX" }, "source": [ "def create_filtered(split_name, num_iter, grouped_list):\n", " filtered_object = {'QuestionFilter':{}}\n", " for group in grouped_list:\n", " id_list = {}\n", " id_list[list(group)[0]] = [data[split_name][i].get(\"gem_id\") for i in range(num_iter) if data[split_name][i].get(\"question\") in group[list(group)[0]]]\n", " filtered_object['QuestionFilter'].update(id_list) \n", " return filtered_object\n" ], "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "H1UQKf2dHctt" }, "source": [ "## Create final object with filtered data" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "_neZXkvnFumE", "outputId": "f9ba67c6-979c-431b-9b10-12c9ea6d7394" }, "source": [ "filtered_object = create_filtered(\"train\", grouped_list)\n", "filtered_object" ], "execution_count": null, "outputs": [ { "data": { "text/plain": [ "{'QuestionFilter': {'WhatQuestion': ['gem-squad_v2-train-1',\n", " 'gem-squad_v2-train-5',\n", " 'gem-squad_v2-train-7'],\n", " 'WhenQuestion': ['gem-squad_v2-train-2',\n", " 'gem-squad_v2-train-3',\n", " 'gem-squad_v2-train-4',\n", " 'gem-squad_v2-train-6',\n", " 'gem-squad_v2-train-8'],\n", " 'WhereQuestion': ['gem-squad_v2-train-0'],\n", " 'WhichQuestion': [],\n", " 'WhoQuestion': ['gem-squad_v2-train-9'],\n", " 'WhyQuestion': []}}" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ] }, { "cell_type": "markdown", "metadata": { "id": "1grVKh4ZHjtu" }, "source": [ "## Store the object in a json file" ] }, { "cell_type": "code", "metadata": { "id": "mhsiQWcAFo1H" }, "source": [ "import json\n", "\n", "with open('question_filter_train.json', 'w') as outfile:\n", " json.dump(filtered_object, outfile)" ], "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "Ybx2Dw51vS-z" }, "source": [ "# 4. Apply the process to multiple entries" ] }, { "cell_type": "code", "metadata": { "id": "dmDf962j3Ar0" }, "source": [ "sentences = get_sentences('validation', len(data[\"validation\"]))" ], "execution_count": 37, "outputs": [] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "V4-8LRjD3erW", "outputId": "3954ed61-37a4-4f95-e628-bbd97d2d55ae" }, "source": [ "get_stats(sentences, filter_obj)" ], "execution_count": 40, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "WhereQuestion flagged questions : 516\n", "WhatQuestion flagged questions : 7498\n", "WhoQuestion flagged questions : 1073\n", "WhichQuestion flagged questions : 568\n", "WhyQuestion flagged questions : 197\n", "WhenQuestion flagged questions : 952\n" ] } ] }, { "cell_type": "code", "metadata": { "id": "faO5Dh7Q3nZo" }, "source": [ "grouped_list = get_phrases(sentences, filter_obj)" ], "execution_count": 41, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "INFDYWULH1Gg" }, "source": [ "filtered_object = create_filtered(\"validation\", len(data[\"validation\"]), grouped_list)" ], "execution_count": 42, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "dbBRKpgCMnCq" }, "source": [ "with open('challenge_sets/challenge_question_filter_validation.json', 'w') as outfile:\n", " json.dump(filtered_object, outfile)" ], "execution_count": 43, "outputs": [] } ] }