Skip to content

Instantly share code, notes, and snippets.

@AkashC-goML
Last active June 18, 2024 03:03
Show Gist options
  • Save AkashC-goML/3ffed5192f9548bb3f73a208f4908672 to your computer and use it in GitHub Desktop.
Save AkashC-goML/3ffed5192f9548bb3f73a208f4908672 to your computer and use it in GitHub Desktop.
dspy.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"3c27665627b54a0d857f19253869fa16": {
"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_de89f3fcd5a14b0490662f525f765e6f",
"IPY_MODEL_b90d7d10544e4e5c81020de89e2bc674",
"IPY_MODEL_123c2cc8a8994690943a0c68656dbf42"
],
"layout": "IPY_MODEL_e510925c29b043a7bc4c80d07beeb918"
}
},
"de89f3fcd5a14b0490662f525f765e6f": {
"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_67bffc4847b4497e81def64f14f02026",
"placeholder": "​",
"style": "IPY_MODEL_2fff082f8d7145818913f5bcf6840295",
"value": "Downloading builder script: 100%"
}
},
"b90d7d10544e4e5c81020de89e2bc674": {
"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_7d64c3e007944d29b9d4db2b04f70c80",
"max": 6422,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_0a7becdb144e4f82b3127b66f6489db5",
"value": 6422
}
},
"123c2cc8a8994690943a0c68656dbf42": {
"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_2cc9af5d57ec42ceb1ecd18b8653a2a8",
"placeholder": "​",
"style": "IPY_MODEL_c532bf8c0687420a9945176ba512dd6c",
"value": " 6.42k/6.42k [00:00<00:00, 323kB/s]"
}
},
"e510925c29b043a7bc4c80d07beeb918": {
"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
}
},
"67bffc4847b4497e81def64f14f02026": {
"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
}
},
"2fff082f8d7145818913f5bcf6840295": {
"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": ""
}
},
"7d64c3e007944d29b9d4db2b04f70c80": {
"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
}
},
"0a7becdb144e4f82b3127b66f6489db5": {
"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": ""
}
},
"2cc9af5d57ec42ceb1ecd18b8653a2a8": {
"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
}
},
"c532bf8c0687420a9945176ba512dd6c": {
"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": ""
}
},
"1ed9e08e82864a2f964267f16e6ff29a": {
"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_a289fd85fd594de8b4020a6888256f38",
"IPY_MODEL_e824b4e81b734cd6a1b582d29fae063d",
"IPY_MODEL_845c3d9ffd864222978fbfb0a4e69bc1"
],
"layout": "IPY_MODEL_97579d6c441a4cb89ab96c637d76a016"
}
},
"a289fd85fd594de8b4020a6888256f38": {
"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_7c0553c22f0040058e1d44ffa9e4d4db",
"placeholder": "​",
"style": "IPY_MODEL_bd349c4e373d44b1adb0caa6ca098a13",
"value": "Downloading readme: 100%"
}
},
"e824b4e81b734cd6a1b582d29fae063d": {
"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_b479bd5b41ec42d6be59fe6fc62a48e6",
"max": 9193,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_2531e8dfd31b4229a47f0262a147e361",
"value": 9193
}
},
"845c3d9ffd864222978fbfb0a4e69bc1": {
"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_953a4bf3743943f0923e05a3a674647b",
"placeholder": "​",
"style": "IPY_MODEL_7af1394149054dabba210ddb0e79d06a",
"value": " 9.19k/9.19k [00:00<00:00, 378kB/s]"
}
},
"97579d6c441a4cb89ab96c637d76a016": {
"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
}
},
"7c0553c22f0040058e1d44ffa9e4d4db": {
"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
}
},
"bd349c4e373d44b1adb0caa6ca098a13": {
"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": ""
}
},
"b479bd5b41ec42d6be59fe6fc62a48e6": {
"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
}
},
"2531e8dfd31b4229a47f0262a147e361": {
"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": ""
}
},
"953a4bf3743943f0923e05a3a674647b": {
"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
}
},
"7af1394149054dabba210ddb0e79d06a": {
"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": ""
}
},
"879f4da6ad784ef19731a03afcd60a2d": {
"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_8ae71c4676264b8a9b174ed918abeb80",
"IPY_MODEL_6ab528db93964268a9b778bb9f9055b8",
"IPY_MODEL_c6d5b0bab2de4522a27bfacf6727ffb6"
],
"layout": "IPY_MODEL_03166f232b1d4464a12084768931c63d"
}
},
"8ae71c4676264b8a9b174ed918abeb80": {
"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_d649a402e431418aa14048a186baef6f",
"placeholder": "​",
"style": "IPY_MODEL_233dcfcf47b24e9a941d75bdac998c51",
"value": "Downloading data files: 100%"
}
},
"6ab528db93964268a9b778bb9f9055b8": {
"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_9a68a3c820cd46e499b0752d03a05fbd",
"max": 3,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_2590322334524bcc9233d58803d7e944",
"value": 3
}
},
"c6d5b0bab2de4522a27bfacf6727ffb6": {
"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_27caca28da024cfbbe8d920820ba31f1",
"placeholder": "​",
"style": "IPY_MODEL_060138549c1645d39f7fa786f7b214f5",
"value": " 3/3 [00:12<00:00,  3.08s/it]"
}
},
"03166f232b1d4464a12084768931c63d": {
"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
}
},
"d649a402e431418aa14048a186baef6f": {
"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
}
},
"233dcfcf47b24e9a941d75bdac998c51": {
"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": ""
}
},
"9a68a3c820cd46e499b0752d03a05fbd": {
"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
}
},
"2590322334524bcc9233d58803d7e944": {
"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": ""
}
},
"27caca28da024cfbbe8d920820ba31f1": {
"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
}
},
"060138549c1645d39f7fa786f7b214f5": {
"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": ""
}
},
"23a3da7f94ff4febb1e3b615f7ea181c": {
"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_fe8f7b150d0942a484ca3763c8f873a7",
"IPY_MODEL_5e48a7ad7ac148a69233bd9764efd910",
"IPY_MODEL_c9fe2d41346c4636804314f7f1d8fcaf"
],
"layout": "IPY_MODEL_aabf734111de40d4ade4994179f61e3b"
}
},
"fe8f7b150d0942a484ca3763c8f873a7": {
"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_e160ef6546de4dfda9b6aabac3611d57",
"placeholder": "​",
"style": "IPY_MODEL_7decfa585cf24979978ed22707bb0483",
"value": "Downloading data: 100%"
}
},
"5e48a7ad7ac148a69233bd9764efd910": {
"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_f02e9e7bb1584c8fad68d7280f98e0f9",
"max": 566426227,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_327533047b1d4f7fa0db81ccd88e78a6",
"value": 566426227
}
},
"c9fe2d41346c4636804314f7f1d8fcaf": {
"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_4ac56a416d494574848b593188d5eca3",
"placeholder": "​",
"style": "IPY_MODEL_48384ae1f24c4007948756584c04049e",
"value": " 566M/566M [00:10<00:00, 66.2MB/s]"
}
},
"aabf734111de40d4ade4994179f61e3b": {
"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
}
},
"e160ef6546de4dfda9b6aabac3611d57": {
"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
}
},
"7decfa585cf24979978ed22707bb0483": {
"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": ""
}
},
"f02e9e7bb1584c8fad68d7280f98e0f9": {
"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
}
},
"327533047b1d4f7fa0db81ccd88e78a6": {
"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": ""
}
},
"4ac56a416d494574848b593188d5eca3": {
"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
}
},
"48384ae1f24c4007948756584c04049e": {
"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": ""
}
},
"27467974563b431c9c8d8fcebb9b8c35": {
"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_63d24bcbee784dbdb2381b31ef6cf6c5",
"IPY_MODEL_f1513da2f43b4d7788a8b1f458951173",
"IPY_MODEL_0863ba266b5e4fc492f42039ef50ddf0"
],
"layout": "IPY_MODEL_2b2e889bf0a74de0986aa546d352201a"
}
},
"63d24bcbee784dbdb2381b31ef6cf6c5": {
"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_20ea87255bb3429aa018b2de356ba801",
"placeholder": "​",
"style": "IPY_MODEL_2877b1bb5dd64def9c71316812704dee",
"value": "Downloading data: 100%"
}
},
"f1513da2f43b4d7788a8b1f458951173": {
"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_dfea2bea7e004c2989423742c095381f",
"max": 47454698,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_645277ad0d3e483a99a05f4d5d2b1103",
"value": 47454698
}
},
"0863ba266b5e4fc492f42039ef50ddf0": {
"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_246782090f754d639e5da148787f8e4b",
"placeholder": "​",
"style": "IPY_MODEL_e3dbd7704c384c9582bff6cd9d8049e6",
"value": " 47.5M/47.5M [00:00<00:00, 59.4MB/s]"
}
},
"2b2e889bf0a74de0986aa546d352201a": {
"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
}
},
"20ea87255bb3429aa018b2de356ba801": {
"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
}
},
"2877b1bb5dd64def9c71316812704dee": {
"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": ""
}
},
"dfea2bea7e004c2989423742c095381f": {
"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
}
},
"645277ad0d3e483a99a05f4d5d2b1103": {
"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": ""
}
},
"246782090f754d639e5da148787f8e4b": {
"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
}
},
"e3dbd7704c384c9582bff6cd9d8049e6": {
"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": ""
}
},
"9c988c0c67244e9f9f8b162ec3834afa": {
"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_82ba9a548e3249ee9e0ae7e3093ed158",
"IPY_MODEL_481c989a34a54570a222db0d8684e80a",
"IPY_MODEL_09049860c8f04e93becfdc9a9c066cbf"
],
"layout": "IPY_MODEL_ef3bd4966de64b3eb29b26bc8a0b7119"
}
},
"82ba9a548e3249ee9e0ae7e3093ed158": {
"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_d9dd81d12380497cab55e1f5508592c1",
"placeholder": "​",
"style": "IPY_MODEL_b20fa4fcbf0f464abf43389641604812",
"value": "Downloading data: 100%"
}
},
"481c989a34a54570a222db0d8684e80a": {
"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_692a4c6be17641cbad59a8f21d76b295",
"max": 46213747,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_10015b33b21f4086955ace2f0444376a",
"value": 46213747
}
},
"09049860c8f04e93becfdc9a9c066cbf": {
"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_86e15ea6fb2e424b8e1caff62c523a51",
"placeholder": "​",
"style": "IPY_MODEL_385791efc61e4ee0b6a8f3bedeed73dc",
"value": " 46.2M/46.2M [00:00<00:00, 60.2MB/s]"
}
},
"ef3bd4966de64b3eb29b26bc8a0b7119": {
"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
}
},
"d9dd81d12380497cab55e1f5508592c1": {
"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
}
},
"b20fa4fcbf0f464abf43389641604812": {
"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": ""
}
},
"692a4c6be17641cbad59a8f21d76b295": {
"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
}
},
"10015b33b21f4086955ace2f0444376a": {
"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": ""
}
},
"86e15ea6fb2e424b8e1caff62c523a51": {
"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
}
},
"385791efc61e4ee0b6a8f3bedeed73dc": {
"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": ""
}
},
"21a791be733c4a70bed380c96e5c5464": {
"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_b46d51f15aba4c47ba51dad0cfede1e2",
"IPY_MODEL_eb390dbd1a49412e9912932f4ca1aca4",
"IPY_MODEL_4d80cdf80d8b47d3a3c76cdd9db3eb8f"
],
"layout": "IPY_MODEL_2d6d7f5d50ad4e6e87974ec9dcb9aa12"
}
},
"b46d51f15aba4c47ba51dad0cfede1e2": {
"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_f5a7505c498f4fab97df23b42bf5a8ca",
"placeholder": "​",
"style": "IPY_MODEL_53cd210ea7544209bb71e4efac17cb36",
"value": "Generating train split: 100%"
}
},
"eb390dbd1a49412e9912932f4ca1aca4": {
"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_3629f1759c9b48a28ed61604e22c05a7",
"max": 90447,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_de0620cb66544607954560b65c2cd319",
"value": 90447
}
},
"4d80cdf80d8b47d3a3c76cdd9db3eb8f": {
"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_25e9bd5f4a7a4f37ab4bb33f6f008f42",
"placeholder": "​",
"style": "IPY_MODEL_c2e9968f8e75472cbf684b384aa3154e",
"value": " 90447/90447 [00:42<00:00, 3053.58 examples/s]"
}
},
"2d6d7f5d50ad4e6e87974ec9dcb9aa12": {
"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
}
},
"f5a7505c498f4fab97df23b42bf5a8ca": {
"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
}
},
"53cd210ea7544209bb71e4efac17cb36": {
"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": ""
}
},
"3629f1759c9b48a28ed61604e22c05a7": {
"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
}
},
"de0620cb66544607954560b65c2cd319": {
"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": ""
}
},
"25e9bd5f4a7a4f37ab4bb33f6f008f42": {
"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
}
},
"c2e9968f8e75472cbf684b384aa3154e": {
"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": ""
}
},
"dcb828c16d6d482e963ea4bf8d8c9218": {
"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_15bc66aef7654cf7a71ed22f1f1f87ed",
"IPY_MODEL_7f52d813451747429287f84ffca3cc57",
"IPY_MODEL_4c6773f203a04478ae32d9131a9287da"
],
"layout": "IPY_MODEL_e7e2eef19eea41dd984754f0c579b6fd"
}
},
"15bc66aef7654cf7a71ed22f1f1f87ed": {
"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_e2d8fcc4d12c45808271c82b78ec0b86",
"placeholder": "​",
"style": "IPY_MODEL_a717283d03064bcaaf10551cd0cf75c7",
"value": "Generating validation split: 100%"
}
},
"7f52d813451747429287f84ffca3cc57": {
"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_05c25c3df7334a2fa151f370c5c184b0",
"max": 7405,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_f3642e0b87064e5e8d72b798837b306f",
"value": 7405
}
},
"4c6773f203a04478ae32d9131a9287da": {
"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_e12ce8e4e59c4dc892e9f9d2a207da77",
"placeholder": "​",
"style": "IPY_MODEL_d57539875e124764a14b74ab4bef5ba3",
"value": " 7405/7405 [00:02<00:00, 3058.18 examples/s]"
}
},
"e7e2eef19eea41dd984754f0c579b6fd": {
"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
}
},
"e2d8fcc4d12c45808271c82b78ec0b86": {
"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
}
},
"a717283d03064bcaaf10551cd0cf75c7": {
"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": ""
}
},
"05c25c3df7334a2fa151f370c5c184b0": {
"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
}
},
"f3642e0b87064e5e8d72b798837b306f": {
"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": ""
}
},
"e12ce8e4e59c4dc892e9f9d2a207da77": {
"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
}
},
"d57539875e124764a14b74ab4bef5ba3": {
"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": ""
}
},
"73abb24e1440435ab4151710691a9349": {
"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_e93a1e88fe3a430ca0f1ca0fd7056ea7",
"IPY_MODEL_e081386e66414c55909a503581859048",
"IPY_MODEL_8fe1cb1b61604fbcbd233c86f2283ac5"
],
"layout": "IPY_MODEL_b663c7e3d4664c3f995bca7529cecd8d"
}
},
"e93a1e88fe3a430ca0f1ca0fd7056ea7": {
"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_42918abf6d6345a69c5b271d25d22256",
"placeholder": "​",
"style": "IPY_MODEL_67fb7249b999422495f3a287fa6e309e",
"value": "Generating test split: 100%"
}
},
"e081386e66414c55909a503581859048": {
"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_86d1e4b2e12f4bde81d3e001fe88644c",
"max": 7405,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_13f0a77c8dd042f7b24a0ba7d8c5cced",
"value": 7405
}
},
"8fe1cb1b61604fbcbd233c86f2283ac5": {
"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_270e49b0301f4e6b9933e414bc5c5469",
"placeholder": "​",
"style": "IPY_MODEL_b7769bcb67fd42db9681c9198d559284",
"value": " 7405/7405 [00:03<00:00, 1358.95 examples/s]"
}
},
"b663c7e3d4664c3f995bca7529cecd8d": {
"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
}
},
"42918abf6d6345a69c5b271d25d22256": {
"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
}
},
"67fb7249b999422495f3a287fa6e309e": {
"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": ""
}
},
"86d1e4b2e12f4bde81d3e001fe88644c": {
"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
}
},
"13f0a77c8dd042f7b24a0ba7d8c5cced": {
"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": ""
}
},
"270e49b0301f4e6b9933e414bc5c5469": {
"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
}
},
"b7769bcb67fd42db9681c9198d559284": {
"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": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/AkashC-goML/3ffed5192f9548bb3f73a208f4908672/dspy.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"source": [
"!pip install dspy"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "UuM0gueXGXj1",
"outputId": "627b0cd3-383b-4bea-88cf-531d1015aa07"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Collecting dspy\n",
" Downloading dspy-0.1.5-py3-none-any.whl (1.3 kB)\n",
"Collecting dspy-ai==2.4.5 (from dspy)\n",
" Downloading dspy_ai-2.4.5-py3-none-any.whl (197 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m197.5/197.5 kB\u001b[0m \u001b[31m5.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting backoff~=2.2.1 (from dspy-ai==2.4.5->dspy)\n",
" Downloading backoff-2.2.1-py3-none-any.whl (15 kB)\n",
"Collecting joblib~=1.3.2 (from dspy-ai==2.4.5->dspy)\n",
" Downloading joblib-1.3.2-py3-none-any.whl (302 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m302.2/302.2 kB\u001b[0m \u001b[31m35.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting openai<2.0.0,>=0.28.1 (from dspy-ai==2.4.5->dspy)\n",
" Downloading openai-1.32.0-py3-none-any.whl (325 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m325.2/325.2 kB\u001b[0m \u001b[31m39.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from dspy-ai==2.4.5->dspy) (2.0.3)\n",
"Requirement already satisfied: regex in /usr/local/lib/python3.10/dist-packages (from dspy-ai==2.4.5->dspy) (2024.5.15)\n",
"Collecting ujson (from dspy-ai==2.4.5->dspy)\n",
" Downloading ujson-5.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (53 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m53.6/53.6 kB\u001b[0m \u001b[31m3.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from dspy-ai==2.4.5->dspy) (4.66.4)\n",
"Collecting datasets<3.0.0,~=2.14.6 (from dspy-ai==2.4.5->dspy)\n",
" Downloading datasets-2.14.7-py3-none-any.whl (520 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m520.4/520.4 kB\u001b[0m \u001b[31m46.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from dspy-ai==2.4.5->dspy) (2.31.0)\n",
"Collecting optuna (from dspy-ai==2.4.5->dspy)\n",
" Downloading optuna-3.6.1-py3-none-any.whl (380 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m380.1/380.1 kB\u001b[0m \u001b[31m43.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting pydantic==2.5.0 (from dspy-ai==2.4.5->dspy)\n",
" Downloading pydantic-2.5.0-py3-none-any.whl (407 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m407.5/407.5 kB\u001b[0m \u001b[31m39.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: annotated-types>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from pydantic==2.5.0->dspy-ai==2.4.5->dspy) (0.7.0)\n",
"Collecting pydantic-core==2.14.1 (from pydantic==2.5.0->dspy-ai==2.4.5->dspy)\n",
" Downloading pydantic_core-2.14.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.1/2.1 MB\u001b[0m \u001b[31m70.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: typing-extensions>=4.6.1 in /usr/local/lib/python3.10/dist-packages (from pydantic==2.5.0->dspy-ai==2.4.5->dspy) (4.12.1)\n",
"Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (1.25.2)\n",
"Requirement already satisfied: pyarrow>=8.0.0 in /usr/local/lib/python3.10/dist-packages (from datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (14.0.2)\n",
"Requirement already satisfied: pyarrow-hotfix in /usr/local/lib/python3.10/dist-packages (from datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (0.6)\n",
"Collecting dill<0.3.8,>=0.3.0 (from datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy)\n",
" Downloading dill-0.3.7-py3-none-any.whl (115 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m115.3/115.3 kB\u001b[0m \u001b[31m17.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting xxhash (from datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy)\n",
" Downloading xxhash-3.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (194 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m194.1/194.1 kB\u001b[0m \u001b[31m27.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting multiprocess (from datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy)\n",
" Downloading multiprocess-0.70.16-py310-none-any.whl (134 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m134.8/134.8 kB\u001b[0m \u001b[31m20.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: fsspec[http]<=2023.10.0,>=2023.1.0 in /usr/local/lib/python3.10/dist-packages (from datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (2023.6.0)\n",
"Requirement already satisfied: aiohttp in /usr/local/lib/python3.10/dist-packages (from datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (3.9.5)\n",
"Requirement already satisfied: huggingface-hub<1.0.0,>=0.14.0 in /usr/local/lib/python3.10/dist-packages (from datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (0.23.2)\n",
"Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (24.0)\n",
"Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (6.0.1)\n",
"Requirement already satisfied: anyio<5,>=3.5.0 in /usr/local/lib/python3.10/dist-packages (from openai<2.0.0,>=0.28.1->dspy-ai==2.4.5->dspy) (3.7.1)\n",
"Requirement already satisfied: distro<2,>=1.7.0 in /usr/lib/python3/dist-packages (from openai<2.0.0,>=0.28.1->dspy-ai==2.4.5->dspy) (1.7.0)\n",
"Collecting httpx<1,>=0.23.0 (from openai<2.0.0,>=0.28.1->dspy-ai==2.4.5->dspy)\n",
" Downloading httpx-0.27.0-py3-none-any.whl (75 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m75.6/75.6 kB\u001b[0m \u001b[31m12.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from openai<2.0.0,>=0.28.1->dspy-ai==2.4.5->dspy) (1.3.1)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->dspy-ai==2.4.5->dspy) (3.3.2)\n",
"Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->dspy-ai==2.4.5->dspy) (3.7)\n",
"Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->dspy-ai==2.4.5->dspy) (2.0.7)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->dspy-ai==2.4.5->dspy) (2024.6.2)\n",
"Collecting alembic>=1.5.0 (from optuna->dspy-ai==2.4.5->dspy)\n",
" Downloading alembic-1.13.1-py3-none-any.whl (233 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m233.4/233.4 kB\u001b[0m \u001b[31m24.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting colorlog (from optuna->dspy-ai==2.4.5->dspy)\n",
" Downloading colorlog-6.8.2-py3-none-any.whl (11 kB)\n",
"Requirement already satisfied: sqlalchemy>=1.3.0 in /usr/local/lib/python3.10/dist-packages (from optuna->dspy-ai==2.4.5->dspy) (2.0.30)\n",
"Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.10/dist-packages (from pandas->dspy-ai==2.4.5->dspy) (2.8.2)\n",
"Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->dspy-ai==2.4.5->dspy) (2023.4)\n",
"Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas->dspy-ai==2.4.5->dspy) (2024.1)\n",
"Collecting Mako (from alembic>=1.5.0->optuna->dspy-ai==2.4.5->dspy)\n",
" Downloading Mako-1.3.5-py3-none-any.whl (78 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m78.6/78.6 kB\u001b[0m \u001b[31m11.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: exceptiongroup in /usr/local/lib/python3.10/dist-packages (from anyio<5,>=3.5.0->openai<2.0.0,>=0.28.1->dspy-ai==2.4.5->dspy) (1.2.1)\n",
"Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (1.3.1)\n",
"Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (23.2.0)\n",
"Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (1.4.1)\n",
"Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (6.0.5)\n",
"Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (1.9.4)\n",
"Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (4.0.3)\n",
"Collecting httpcore==1.* (from httpx<1,>=0.23.0->openai<2.0.0,>=0.28.1->dspy-ai==2.4.5->dspy)\n",
" Downloading httpcore-1.0.5-py3-none-any.whl (77 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m77.9/77.9 kB\u001b[0m \u001b[31m12.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting h11<0.15,>=0.13 (from httpcore==1.*->httpx<1,>=0.23.0->openai<2.0.0,>=0.28.1->dspy-ai==2.4.5->dspy)\n",
" Downloading h11-0.14.0-py3-none-any.whl (58 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m9.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface-hub<1.0.0,>=0.14.0->datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy) (3.14.0)\n",
"Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.2->pandas->dspy-ai==2.4.5->dspy) (1.16.0)\n",
"Requirement already satisfied: greenlet!=0.4.17 in /usr/local/lib/python3.10/dist-packages (from sqlalchemy>=1.3.0->optuna->dspy-ai==2.4.5->dspy) (3.0.3)\n",
"INFO: pip is looking at multiple versions of multiprocess to determine which version is compatible with other requirements. This could take a while.\n",
"Collecting multiprocess (from datasets<3.0.0,~=2.14.6->dspy-ai==2.4.5->dspy)\n",
" Downloading multiprocess-0.70.15-py310-none-any.whl (134 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m134.8/134.8 kB\u001b[0m \u001b[31m20.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: MarkupSafe>=0.9.2 in /usr/local/lib/python3.10/dist-packages (from Mako->alembic>=1.5.0->optuna->dspy-ai==2.4.5->dspy) (2.1.5)\n",
"Installing collected packages: xxhash, ujson, pydantic-core, Mako, joblib, h11, dill, colorlog, backoff, pydantic, multiprocess, httpcore, alembic, optuna, httpx, openai, datasets, dspy-ai, dspy\n",
" Attempting uninstall: pydantic-core\n",
" Found existing installation: pydantic_core 2.18.4\n",
" Uninstalling pydantic_core-2.18.4:\n",
" Successfully uninstalled pydantic_core-2.18.4\n",
" Attempting uninstall: joblib\n",
" Found existing installation: joblib 1.4.2\n",
" Uninstalling joblib-1.4.2:\n",
" Successfully uninstalled joblib-1.4.2\n",
" Attempting uninstall: pydantic\n",
" Found existing installation: pydantic 2.7.3\n",
" Uninstalling pydantic-2.7.3:\n",
" Successfully uninstalled pydantic-2.7.3\n",
"Successfully installed Mako-1.3.5 alembic-1.13.1 backoff-2.2.1 colorlog-6.8.2 datasets-2.14.7 dill-0.3.7 dspy-0.1.5 dspy-ai-2.4.5 h11-0.14.0 httpcore-1.0.5 httpx-0.27.0 joblib-1.3.2 multiprocess-0.70.15 openai-1.32.0 optuna-3.6.1 pydantic-2.5.0 pydantic-core-2.14.1 ujson-5.10.0 xxhash-3.4.1\n"
]
}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "6JOJG9Tq8fGt"
},
"outputs": [],
"source": [
"import sys\n",
"import os\n",
"import dspy\n",
"from dspy.datasets import HotPotQA\n",
"from dspy.teleprompt import BootstrapFewShot\n",
"from dspy.evaluate.evaluate import Evaluate\n",
"from dsp.utils import deduplicate\n",
"from rich import print"
]
},
{
"cell_type": "code",
"source": [
"# 1. Configuration & Data Loading\n",
"turbo = dspy.OpenAI(model='gpt-3.5-turbo')\n",
"colbertv2_wiki17_abstracts = dspy.ColBERTv2(url='http://20.102.90.50:2017/wiki17_abstracts')\n",
"dspy.settings.configure(lm=turbo, rm=colbertv2_wiki17_abstracts)\n",
"dataset = HotPotQA(train_seed=1, train_size=20, eval_seed=2023, dev_size=50, test_size=0)\n",
"\n",
"trainset = [x.with_inputs('question') for x in dataset.train]\n",
"devset = [x.with_inputs('question') for x in dataset.dev]"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 464,
"referenced_widgets": [
"3c27665627b54a0d857f19253869fa16",
"de89f3fcd5a14b0490662f525f765e6f",
"b90d7d10544e4e5c81020de89e2bc674",
"123c2cc8a8994690943a0c68656dbf42",
"e510925c29b043a7bc4c80d07beeb918",
"67bffc4847b4497e81def64f14f02026",
"2fff082f8d7145818913f5bcf6840295",
"7d64c3e007944d29b9d4db2b04f70c80",
"0a7becdb144e4f82b3127b66f6489db5",
"2cc9af5d57ec42ceb1ecd18b8653a2a8",
"c532bf8c0687420a9945176ba512dd6c",
"1ed9e08e82864a2f964267f16e6ff29a",
"a289fd85fd594de8b4020a6888256f38",
"e824b4e81b734cd6a1b582d29fae063d",
"845c3d9ffd864222978fbfb0a4e69bc1",
"97579d6c441a4cb89ab96c637d76a016",
"7c0553c22f0040058e1d44ffa9e4d4db",
"bd349c4e373d44b1adb0caa6ca098a13",
"b479bd5b41ec42d6be59fe6fc62a48e6",
"2531e8dfd31b4229a47f0262a147e361",
"953a4bf3743943f0923e05a3a674647b",
"7af1394149054dabba210ddb0e79d06a",
"879f4da6ad784ef19731a03afcd60a2d",
"8ae71c4676264b8a9b174ed918abeb80",
"6ab528db93964268a9b778bb9f9055b8",
"c6d5b0bab2de4522a27bfacf6727ffb6",
"03166f232b1d4464a12084768931c63d",
"d649a402e431418aa14048a186baef6f",
"233dcfcf47b24e9a941d75bdac998c51",
"9a68a3c820cd46e499b0752d03a05fbd",
"2590322334524bcc9233d58803d7e944",
"27caca28da024cfbbe8d920820ba31f1",
"060138549c1645d39f7fa786f7b214f5",
"23a3da7f94ff4febb1e3b615f7ea181c",
"fe8f7b150d0942a484ca3763c8f873a7",
"5e48a7ad7ac148a69233bd9764efd910",
"c9fe2d41346c4636804314f7f1d8fcaf",
"aabf734111de40d4ade4994179f61e3b",
"e160ef6546de4dfda9b6aabac3611d57",
"7decfa585cf24979978ed22707bb0483",
"f02e9e7bb1584c8fad68d7280f98e0f9",
"327533047b1d4f7fa0db81ccd88e78a6",
"4ac56a416d494574848b593188d5eca3",
"48384ae1f24c4007948756584c04049e",
"27467974563b431c9c8d8fcebb9b8c35",
"63d24bcbee784dbdb2381b31ef6cf6c5",
"f1513da2f43b4d7788a8b1f458951173",
"0863ba266b5e4fc492f42039ef50ddf0",
"2b2e889bf0a74de0986aa546d352201a",
"20ea87255bb3429aa018b2de356ba801",
"2877b1bb5dd64def9c71316812704dee",
"dfea2bea7e004c2989423742c095381f",
"645277ad0d3e483a99a05f4d5d2b1103",
"246782090f754d639e5da148787f8e4b",
"e3dbd7704c384c9582bff6cd9d8049e6",
"9c988c0c67244e9f9f8b162ec3834afa",
"82ba9a548e3249ee9e0ae7e3093ed158",
"481c989a34a54570a222db0d8684e80a",
"09049860c8f04e93becfdc9a9c066cbf",
"ef3bd4966de64b3eb29b26bc8a0b7119",
"d9dd81d12380497cab55e1f5508592c1",
"b20fa4fcbf0f464abf43389641604812",
"692a4c6be17641cbad59a8f21d76b295",
"10015b33b21f4086955ace2f0444376a",
"86e15ea6fb2e424b8e1caff62c523a51",
"385791efc61e4ee0b6a8f3bedeed73dc",
"21a791be733c4a70bed380c96e5c5464",
"b46d51f15aba4c47ba51dad0cfede1e2",
"eb390dbd1a49412e9912932f4ca1aca4",
"4d80cdf80d8b47d3a3c76cdd9db3eb8f",
"2d6d7f5d50ad4e6e87974ec9dcb9aa12",
"f5a7505c498f4fab97df23b42bf5a8ca",
"53cd210ea7544209bb71e4efac17cb36",
"3629f1759c9b48a28ed61604e22c05a7",
"de0620cb66544607954560b65c2cd319",
"25e9bd5f4a7a4f37ab4bb33f6f008f42",
"c2e9968f8e75472cbf684b384aa3154e",
"dcb828c16d6d482e963ea4bf8d8c9218",
"15bc66aef7654cf7a71ed22f1f1f87ed",
"7f52d813451747429287f84ffca3cc57",
"4c6773f203a04478ae32d9131a9287da",
"e7e2eef19eea41dd984754f0c579b6fd",
"e2d8fcc4d12c45808271c82b78ec0b86",
"a717283d03064bcaaf10551cd0cf75c7",
"05c25c3df7334a2fa151f370c5c184b0",
"f3642e0b87064e5e8d72b798837b306f",
"e12ce8e4e59c4dc892e9f9d2a207da77",
"d57539875e124764a14b74ab4bef5ba3",
"73abb24e1440435ab4151710691a9349",
"e93a1e88fe3a430ca0f1ca0fd7056ea7",
"e081386e66414c55909a503581859048",
"8fe1cb1b61604fbcbd233c86f2283ac5",
"b663c7e3d4664c3f995bca7529cecd8d",
"42918abf6d6345a69c5b271d25d22256",
"67fb7249b999422495f3a287fa6e309e",
"86d1e4b2e12f4bde81d3e001fe88644c",
"13f0a77c8dd042f7b24a0ba7d8c5cced",
"270e49b0301f4e6b9933e414bc5c5469",
"b7769bcb67fd42db9681c9198d559284"
]
},
"id": "rW28_yVZGVdG",
"outputId": "01821247-a232-4591-93a6-f9adaa517e34"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_token.py:89: UserWarning: \n",
"The secret `HF_TOKEN` does not exist in your Colab secrets.\n",
"To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.\n",
"You will be able to reuse this secret in all of your notebooks.\n",
"Please note that authentication is recommended but still optional to access public models or datasets.\n",
" warnings.warn(\n"
]
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading builder script: 0%| | 0.00/6.42k [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "3c27665627b54a0d857f19253869fa16"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading readme: 0%| | 0.00/9.19k [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "1ed9e08e82864a2f964267f16e6ff29a"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading data files: 0%| | 0/3 [00:00<?, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "879f4da6ad784ef19731a03afcd60a2d"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading data: 0%| | 0.00/566M [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "23a3da7f94ff4febb1e3b615f7ea181c"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading data: 0%| | 0.00/47.5M [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "27467974563b431c9c8d8fcebb9b8c35"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading data: 0%| | 0.00/46.2M [00:00<?, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "9c988c0c67244e9f9f8b162ec3834afa"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Generating train split: 0%| | 0/90447 [00:00<?, ? examples/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "21a791be733c4a70bed380c96e5c5464"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Generating validation split: 0%| | 0/7405 [00:00<?, ? examples/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "dcb828c16d6d482e963ea4bf8d8c9218"
}
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Generating test split: 0%| | 0/7405 [00:00<?, ? examples/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "73abb24e1440435ab4151710691a9349"
}
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"/usr/local/lib/python3.10/dist-packages/datasets/table.py:1421: FutureWarning: promote has been superseded by mode='default'.\n",
" table = cls._concat_blocks(blocks, axis=0)\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"print(len(trainset), len(devset))\n",
"print(f\"Trainset Data {trainset[:5]}\")\n",
"print(f\"Devset Data {devset[:5]}\")\n",
"\n",
"print(\"\\n### Example Question with Answer ###\\n\")\n",
"example = devset[18]\n",
"print(f\"Question: {example.question}\")\n",
"print(f\"Answer: {example.answer}\")\n",
"print(f\"Relevant Wikipedia Titles: {example.gold_titles}\")\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 480
},
"id": "eaVX5sXDGloH",
"outputId": "79813e35-e202-46d7-f401-b38ad018dafd"
},
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"\u001b[1;36m20\u001b[0m \u001b[1;36m50\u001b[0m\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">20</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">50</span>\n",
"</pre>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Trainset Data \u001b[1m[\u001b[0m\u001b[1;35mExample\u001b[0m\u001b[1m(\u001b[0m\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m: \u001b[32m'At My Window was released by which American singer-songwriter?'\u001b[0m, \u001b[32m'answer'\u001b[0m: \n",
"\u001b[32m'John Townes Van Zandt'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m \u001b[1m(\u001b[0m\u001b[33minput_keys\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m, \u001b[1;35mExample\u001b[0m\u001b[1m(\u001b[0m\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m: \u001b[32m'which American actor was Candace Kita \u001b[0m\n",
"\u001b[32mguest starred with '\u001b[0m, \u001b[32m'answer'\u001b[0m: \u001b[32m'Bill Murray'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m \u001b[1m(\u001b[0m\u001b[33minput_keys\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m, \u001b[1;35mExample\u001b[0m\u001b[1m(\u001b[0m\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m: \u001b[32m'Which of these \u001b[0m\n",
"\u001b[32mpublications was most recently published, Who Put the Bomp or Self?'\u001b[0m, \u001b[32m'answer'\u001b[0m: \u001b[32m'Self'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m \u001b[1m(\u001b[0m\u001b[33minput_keys\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m,\n",
"\u001b[1;35mExample\u001b[0m\u001b[1m(\u001b[0m\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m: \u001b[32m'The Victorians - Their Story In Pictures is a documentary series written by an author born in\u001b[0m\n",
"\u001b[32mwhat year?'\u001b[0m, \u001b[32m'answer'\u001b[0m: \u001b[32m'1950'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m \u001b[1m(\u001b[0m\u001b[33minput_keys\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m, \u001b[1;35mExample\u001b[0m\u001b[1m(\u001b[0m\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m: \u001b[32m'Which magazine has published \u001b[0m\n",
"\u001b[32marticles by Scott Shaw, Tae Kwon Do Times or Southwest Art?'\u001b[0m, \u001b[32m'answer'\u001b[0m: \u001b[32m'Tae Kwon Do Times'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m \n",
"\u001b[1m(\u001b[0m\u001b[33minput_keys\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Trainset Data <span style=\"font-weight: bold\">[</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Example</span><span style=\"font-weight: bold\">({</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'At My Window was released by which American singer-songwriter?'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'answer'</span>: \n",
"<span style=\"color: #008000; text-decoration-color: #008000\">'John Townes Van Zandt'</span><span style=\"font-weight: bold\">})</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">input_keys</span>=<span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span><span style=\"font-weight: bold\">})</span>, <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Example</span><span style=\"font-weight: bold\">({</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'which American actor was Candace Kita </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">guest starred with '</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'answer'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'Bill Murray'</span><span style=\"font-weight: bold\">})</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">input_keys</span>=<span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span><span style=\"font-weight: bold\">})</span>, <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Example</span><span style=\"font-weight: bold\">({</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'Which of these </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">publications was most recently published, Who Put the Bomp or Self?'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'answer'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'Self'</span><span style=\"font-weight: bold\">})</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">input_keys</span>=<span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span><span style=\"font-weight: bold\">})</span>,\n",
"<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Example</span><span style=\"font-weight: bold\">({</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'The Victorians - Their Story In Pictures is a documentary series written by an author born in</span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">what year?'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'answer'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'1950'</span><span style=\"font-weight: bold\">})</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">input_keys</span>=<span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span><span style=\"font-weight: bold\">})</span>, <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Example</span><span style=\"font-weight: bold\">({</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'Which magazine has published </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">articles by Scott Shaw, Tae Kwon Do Times or Southwest Art?'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'answer'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'Tae Kwon Do Times'</span><span style=\"font-weight: bold\">})</span> \n",
"<span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">input_keys</span>=<span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span><span style=\"font-weight: bold\">})]</span>\n",
"</pre>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Devset Data \u001b[1m[\u001b[0m\u001b[1;35mExample\u001b[0m\u001b[1m(\u001b[0m\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m: \u001b[32m'Are both Cangzhou and Qionghai in the Hebei province of China?'\u001b[0m, \u001b[32m'answer'\u001b[0m: \u001b[32m'no'\u001b[0m,\n",
"\u001b[32m'gold_titles'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'Qionghai'\u001b[0m, \u001b[32m'Cangzhou'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m \u001b[1m(\u001b[0m\u001b[33minput_keys\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m, \u001b[1;35mExample\u001b[0m\u001b[1m(\u001b[0m\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m: \u001b[32m'Who conducts the draft \u001b[0m\n",
"\u001b[32min which Marc-Andre Fleury was drafted to the Vegas Golden Knights for the 2017-18 season?'\u001b[0m, \u001b[32m'answer'\u001b[0m: \u001b[32m'National \u001b[0m\n",
"\u001b[32mHockey League'\u001b[0m, \u001b[32m'gold_titles'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'2017 NHL Expansion Draft'\u001b[0m, \u001b[32m'2017–18 Pittsburgh Penguins season'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m \n",
"\u001b[1m(\u001b[0m\u001b[33minput_keys\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m, \u001b[1;35mExample\u001b[0m\u001b[1m(\u001b[0m\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m: \u001b[32m'The Wings entered a new era, following the retirement of which \u001b[0m\n",
"\u001b[32mCanadian retired professional ice hockey player and current general manager of the Tampa Bay Lightning of the \u001b[0m\n",
"\u001b[32mNational Hockey League \u001b[0m\u001b[32m(\u001b[0m\u001b[32mNHL\u001b[0m\u001b[32m)\u001b[0m\u001b[32m?'\u001b[0m, \u001b[32m'answer'\u001b[0m: \u001b[32m'Steve Yzerman'\u001b[0m, \u001b[32m'gold_titles'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'2006–07 Detroit Red Wings season'\u001b[0m, \n",
"\u001b[32m'Steve Yzerman'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m \u001b[1m(\u001b[0m\u001b[33minput_keys\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m, \u001b[1;35mExample\u001b[0m\u001b[1m(\u001b[0m\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m: \u001b[32m'What river is near the Crichton Collegiate \u001b[0m\n",
"\u001b[32mChurch?'\u001b[0m, \u001b[32m'answer'\u001b[0m: \u001b[32m'the River Tyne'\u001b[0m, \u001b[32m'gold_titles'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'Crichton Collegiate Church'\u001b[0m, \u001b[32m'Crichton Castle'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m \n",
"\u001b[1m(\u001b[0m\u001b[33minput_keys\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m, \u001b[1;35mExample\u001b[0m\u001b[1m(\u001b[0m\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m: \u001b[32m'In the 10th Century A.D. Ealhswith had a son called Æthelweard by \u001b[0m\n",
"\u001b[32mwhich English king?'\u001b[0m, \u001b[32m'answer'\u001b[0m: \u001b[32m'King Alfred the Great'\u001b[0m, \u001b[32m'gold_titles'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'Ealhswith'\u001b[0m, \u001b[32m'Æthelweard \u001b[0m\u001b[32m(\u001b[0m\u001b[32mson of \u001b[0m\n",
"\u001b[32mAlfred\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m \u001b[1m(\u001b[0m\u001b[33minput_keys\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'question'\u001b[0m\u001b[1m}\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Devset Data <span style=\"font-weight: bold\">[</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Example</span><span style=\"font-weight: bold\">({</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'Are both Cangzhou and Qionghai in the Hebei province of China?'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'answer'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'no'</span>,\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">'gold_titles'</span>: <span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'Qionghai'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'Cangzhou'</span><span style=\"font-weight: bold\">}})</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">input_keys</span>=<span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span><span style=\"font-weight: bold\">})</span>, <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Example</span><span style=\"font-weight: bold\">({</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'Who conducts the draft </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">in which Marc-Andre Fleury was drafted to the Vegas Golden Knights for the 2017-18 season?'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'answer'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'National </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">Hockey League'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'gold_titles'</span>: <span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'2017 NHL Expansion Draft'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'2017–18 Pittsburgh Penguins season'</span><span style=\"font-weight: bold\">}})</span> \n",
"<span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">input_keys</span>=<span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span><span style=\"font-weight: bold\">})</span>, <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Example</span><span style=\"font-weight: bold\">({</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'The Wings entered a new era, following the retirement of which </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">Canadian retired professional ice hockey player and current general manager of the Tampa Bay Lightning of the </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">National Hockey League (NHL)?'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'answer'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'Steve Yzerman'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'gold_titles'</span>: <span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'2006–07 Detroit Red Wings season'</span>, \n",
"<span style=\"color: #008000; text-decoration-color: #008000\">'Steve Yzerman'</span><span style=\"font-weight: bold\">}})</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">input_keys</span>=<span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span><span style=\"font-weight: bold\">})</span>, <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Example</span><span style=\"font-weight: bold\">({</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'What river is near the Crichton Collegiate </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">Church?'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'answer'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'the River Tyne'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'gold_titles'</span>: <span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'Crichton Collegiate Church'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'Crichton Castle'</span><span style=\"font-weight: bold\">}})</span> \n",
"<span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">input_keys</span>=<span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span><span style=\"font-weight: bold\">})</span>, <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">Example</span><span style=\"font-weight: bold\">({</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'In the 10th Century A.D. Ealhswith had a son called Æthelweard by </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">which English king?'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'answer'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'King Alfred the Great'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'gold_titles'</span>: <span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'Ealhswith'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'Æthelweard (son of </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">Alfred)'</span><span style=\"font-weight: bold\">}})</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">input_keys</span>=<span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'question'</span><span style=\"font-weight: bold\">})]</span>\n",
"</pre>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"\n",
"### Example Question with Answer ###\n",
"\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
"### Example Question with Answer ###\n",
"\n",
"</pre>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Question: What is the nationality of the chef and restaurateur featured in Restaurant: Impossible?\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Question: What is the nationality of the chef and restaurateur featured in Restaurant: Impossible?\n",
"</pre>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Answer: English\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Answer: English\n",
"</pre>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Relevant Wikipedia Titles: \u001b[1m{\u001b[0m\u001b[32m'Robert Irvine'\u001b[0m, \u001b[32m'Restaurant: Impossible'\u001b[0m\u001b[1m}\u001b[0m\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Relevant Wikipedia Titles: <span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'Robert Irvine'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'Restaurant: Impossible'</span><span style=\"font-weight: bold\">}</span>\n",
"</pre>\n"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"# 2. Basic Chatbot\n",
"class BasicQA(dspy.Signature): # A. Signature\n",
" \"\"\"Answer questions with short factoid answers.\"\"\"\n",
" question = dspy.InputField()\n",
" answer = dspy.OutputField(desc=\"often between 1 and 5 words\")\n"
],
"metadata": {
"id": "vrGcuX7OGoT1"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"import openai\n",
"openai.api_key = \"sk-\""
],
"metadata": {
"id": "KesPAjDMIoh3"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"\n",
"print(\"\\n### Generate Response ###\\n\")\n",
"generate_answer = dspy.Predict(BasicQA)\n",
"pred = generate_answer(question=example.question)\n",
"print(f\"Question: {example.question}\\nPredicted Answer: {pred.answer}\")\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 97
},
"id": "8Zgq_51ZG9vt",
"outputId": "ce8b5153-24ef-4502-d17f-8cda5d2b1333"
},
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"\n",
"### Generate Response ###\n",
"\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
"### Generate Response ###\n",
"\n",
"</pre>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Question: What is the nationality of the chef and restaurateur featured in Restaurant: Impossible?\n",
"Predicted Answer: American\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Question: What is the nationality of the chef and restaurateur featured in Restaurant: Impossible?\n",
"Predicted Answer: American\n",
"</pre>\n"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"# 3. Chatbot with Chain of Thought\n",
"print(\"\\n### Generate Response with Chain of Thought ###\\n\")\n",
"generate_answer_with_chain_of_thought = dspy.ChainOfThought(BasicQA)\n",
"pred = generate_answer_with_chain_of_thought(question=example.question)\n",
"print(f\"Question: {example.question}\\nThought: {pred.rationale.split('.', 1)[1].strip()}\\nPredicted Answer: {pred.answer}\")\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 113
},
"id": "Cl8rNQaNHGXN",
"outputId": "0b571e2c-3202-4639-fedd-8f21e6a605fa"
},
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"\n",
"### Generate Response with Chain of Thought ###\n",
"\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
"### Generate Response with Chain of Thought ###\n",
"\n",
"</pre>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Question: What is the nationality of the chef and restaurateur featured in Restaurant: Impossible?\n",
"Thought: We know that the chef and restaurateur featured in Restaurant: Impossible is British.\n",
"Predicted Answer: British\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Question: What is the nationality of the chef and restaurateur featured in Restaurant: Impossible?\n",
"Thought: We know that the chef and restaurateur featured in Restaurant: Impossible is British.\n",
"Predicted Answer: British\n",
"</pre>\n"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"# 4. Chatbot with Chain of Thought and Context = RAG --> (Retrieve, Generate Response)\n",
"print(\"\\n### RAG: Generate Response with Chain of Thought and Context ###\\n\")\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 49
},
"id": "KOhzf85BHG7O",
"outputId": "57a6380c-5b12-4760-d891-92fb95a492fd"
},
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"\n",
"### RAG: Generate Response with Chain of Thought and Context ###\n",
"\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
"### RAG: Generate Response with Chain of Thought and Context ###\n",
"\n",
"</pre>\n"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"# 4a. Signature\n",
"class GenerateAnswer(dspy.Signature):\n",
" \"\"\"Answer questions with short factoid answers.\"\"\"\n",
" context = dspy.InputField(desc=\"may contain relevant facts\")\n",
" question = dspy.InputField()\n",
" answer = dspy.OutputField(desc=\"often between 1 and 5 words\")\n"
],
"metadata": {
"id": "HRIXcjQCJE6P"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# 4b. Module / Pipeline\n",
"class RAG(dspy.Module):\n",
" def __init__(self, num_passages=3):\n",
" super().__init__()\n",
" self.retrieve = dspy.Retrieve(k=num_passages)\n",
" self.generate_answer = dspy.ChainOfThought(GenerateAnswer)\n",
"\n",
" def forward(self, question):\n",
" context = self.retrieve(question).passages\n",
" prediction = self.generate_answer(context=context, question=question)\n",
" return dspy.Prediction(context=context, answer=prediction.answer)\n"
],
"metadata": {
"id": "5N4HTXyxJG6C"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# 4c. Optimizer / Optimising Pipeline\n",
"def validate_context_and_answer(example, pred, trace=None):\n",
" answer_EM = dspy.evaluate.answer_exact_match(example, pred)\n",
" answer_PM = dspy.evaluate.answer_passage_match(example, pred)\n",
" return answer_EM and answer_PM\n",
"\n",
"teleprompter = BootstrapFewShot(metric=validate_context_and_answer)\n",
"compiled_rag = teleprompter.compile(RAG(), trainset=trainset)\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "MpM_STSlJI80",
"outputId": "2abbd054-e9f0-4672-d458-179021660f7a"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
" 55%|█████▌ | 11/20 [00:11<00:09, 1.08s/it]"
]
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Bootstrapped 4 full traces after 12 examples in round 0.\n"
]
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# 4d. Executing Pipeline\n",
"my_question = \"What castle did David Gregory inherit?\"\n",
"pred = compiled_rag(my_question)\n",
"\n",
"print(f\"Question: {my_question}\")\n",
"print(f\"Predicted Answer: {pred.answer}\")\n",
"print(f\"Retrieved Contexts (truncated): {[c[:200] + '...' for c in pred.context]}\")\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 161
},
"id": "I0KRD9VHJLGv",
"outputId": "ea0eedfd-2e58-4485-ac7d-2214b043321f"
},
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"Question: What castle did David Gregory inherit?\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Question: What castle did David Gregory inherit?\n",
"</pre>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Predicted Answer: Kinnairdy Castle\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Predicted Answer: Kinnairdy Castle\n",
"</pre>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Retrieved Contexts \u001b[1m(\u001b[0mtruncated\u001b[1m)\u001b[0m: \u001b[1m[\u001b[0m\u001b[32m'David Gregory \u001b[0m\u001b[32m(\u001b[0m\u001b[32mphysician\u001b[0m\u001b[32m)\u001b[0m\u001b[32m | David Gregory \u001b[0m\u001b[32m(\u001b[0m\u001b[32m20 December 1625 – 1720\u001b[0m\u001b[32m)\u001b[0m\u001b[32m was a \u001b[0m\n",
"\u001b[32mScottish physician and inventor. His surname is sometimes spelt as Gregorie, the original Scottish spelling. He \u001b[0m\n",
"\u001b[32minherited Kinn...'\u001b[0m, \u001b[32m'Gregory Tarchaneiotes | Gregory Tarchaneiotes \u001b[0m\u001b[32m(\u001b[0m\u001b[32mGreek: Γρηγόριος Ταρχανειώτης , Italian: \u001b[0m\n",
"\u001b[32m\"Gregorio Tracanioto\" or \"Tracamoto\" \u001b[0m\u001b[32m)\u001b[0m\u001b[32m was a \"protospatharius\" and the long-reigning catepan of Italy from 998 \u001b[0m\n",
"\u001b[32mt...'\u001b[0m, \u001b[32m'David Gregory \u001b[0m\u001b[32m(\u001b[0m\u001b[32mmathematician\u001b[0m\u001b[32m)\u001b[0m\u001b[32m | David Gregory \u001b[0m\u001b[32m(\u001b[0m\u001b[32moriginally spelt Gregorie\u001b[0m\u001b[32m)\u001b[0m\u001b[32m FRS \u001b[0m\u001b[32m(\u001b[0m\u001b[32m? 1659 – 10 October 1708\u001b[0m\u001b[32m)\u001b[0m\u001b[32m \u001b[0m\n",
"\u001b[32mwas a Scottish mathematician and astronomer. He was professor of mathematics at the University ...'\u001b[0m\u001b[1m]\u001b[0m\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Retrieved Contexts <span style=\"font-weight: bold\">(</span>truncated<span style=\"font-weight: bold\">)</span>: <span style=\"font-weight: bold\">[</span><span style=\"color: #008000; text-decoration-color: #008000\">'David Gregory (physician) | David Gregory (20 December 1625 – 1720) was a </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">Scottish physician and inventor. His surname is sometimes spelt as Gregorie, the original Scottish spelling. He </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">inherited Kinn...'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'Gregory Tarchaneiotes | Gregory Tarchaneiotes (Greek: Γρηγόριος Ταρχανειώτης , Italian: </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">\"Gregorio Tracanioto\" or \"Tracamoto\" ) was a \"protospatharius\" and the long-reigning catepan of Italy from 998 </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">t...'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'David Gregory (mathematician) | David Gregory (originally spelt Gregorie) FRS (? 1659 – 10 October 1708) </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">was a Scottish mathematician and astronomer. He was professor of mathematics at the University ...'</span><span style=\"font-weight: bold\">]</span>\n",
"</pre>\n"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"# 5. Evaluating the Answers\n",
"print(\"\\n### Evaluating the Answers ###\\n\")"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 49
},
"id": "33iLkHLJJNed",
"outputId": "0cee13c4-5234-4618-d59d-b8d16d0b6bf1"
},
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"\n",
"### Evaluating the Answers ###\n",
"\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
"### Evaluating the Answers ###\n",
"\n",
"</pre>\n"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"# 5a. Basic RAG\n",
"def gold_passages_retrieved(example, pred, trace=None):\n",
" gold_titles = set(map(dspy.evaluate.normalize_text, example['gold_titles']))\n",
" found_titles = set(map(dspy.evaluate.normalize_text, [c.split(' | ')[0] for c in pred.context]))\n",
" return gold_titles.issubset(found_titles)\n",
"\n",
"evaluate_on_hotpotqa = Evaluate(devset=devset, num_threads=1, display_progress=True, display_table=5)\n",
"compiled_rag_retrieval_score = evaluate_on_hotpotqa(compiled_rag, metric=gold_passages_retrieved)\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"id": "taPuoWYzJPN6",
"outputId": "ae3896a6-0eee-4f36-b825-659bb67d68d9"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"Average Metric: 13 / 50 (26.0): 100%|██████████| 50/50 [00:51<00:00, 1.04s/it]\n"
]
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Average Metric: 13 / 50 (26.0%)\n"
]
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"<pandas.io.formats.style.Styler at 0x79f9698c5900>"
],
"text/html": [
"<style type=\"text/css\">\n",
"#T_9d509 th {\n",
" text-align: left;\n",
"}\n",
"#T_9d509 td {\n",
" text-align: left;\n",
"}\n",
"#T_9d509_row0_col0, #T_9d509_row0_col1, #T_9d509_row0_col2, #T_9d509_row0_col3, #T_9d509_row0_col4, #T_9d509_row0_col5, #T_9d509_row1_col0, #T_9d509_row1_col1, #T_9d509_row1_col2, #T_9d509_row1_col3, #T_9d509_row1_col4, #T_9d509_row1_col5, #T_9d509_row2_col0, #T_9d509_row2_col1, #T_9d509_row2_col2, #T_9d509_row2_col3, #T_9d509_row2_col4, #T_9d509_row2_col5, #T_9d509_row3_col0, #T_9d509_row3_col1, #T_9d509_row3_col2, #T_9d509_row3_col3, #T_9d509_row3_col4, #T_9d509_row3_col5, #T_9d509_row4_col0, #T_9d509_row4_col1, #T_9d509_row4_col2, #T_9d509_row4_col3, #T_9d509_row4_col4, #T_9d509_row4_col5 {\n",
" text-align: left;\n",
" white-space: pre-wrap;\n",
" word-wrap: break-word;\n",
" max-width: 400px;\n",
"}\n",
"</style>\n",
"<table id=\"T_9d509\" class=\"dataframe\">\n",
" <thead>\n",
" <tr>\n",
" <th class=\"blank level0\" >&nbsp;</th>\n",
" <th id=\"T_9d509_level0_col0\" class=\"col_heading level0 col0\" >question</th>\n",
" <th id=\"T_9d509_level0_col1\" class=\"col_heading level0 col1\" >example_answer</th>\n",
" <th id=\"T_9d509_level0_col2\" class=\"col_heading level0 col2\" >gold_titles</th>\n",
" <th id=\"T_9d509_level0_col3\" class=\"col_heading level0 col3\" >context</th>\n",
" <th id=\"T_9d509_level0_col4\" class=\"col_heading level0 col4\" >pred_answer</th>\n",
" <th id=\"T_9d509_level0_col5\" class=\"col_heading level0 col5\" >gold_passages_retrieved</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th id=\"T_9d509_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
" <td id=\"T_9d509_row0_col0\" class=\"data row0 col0\" >Are both Cangzhou and Qionghai in the Hebei province of China?</td>\n",
" <td id=\"T_9d509_row0_col1\" class=\"data row0 col1\" >no</td>\n",
" <td id=\"T_9d509_row0_col2\" class=\"data row0 col2\" >{'Qionghai', 'Cangzhou'}</td>\n",
" <td id=\"T_9d509_row0_col3\" class=\"data row0 col3\" >['Cangzhou | Cangzhou () is a prefecture-level city in eastern Hebei province, People\\'s Republic of China. At the 2010 census, Cangzhou\\'s built-up (\"or metro\") area...</td>\n",
" <td id=\"T_9d509_row0_col4\" class=\"data row0 col4\" >No</td>\n",
" <td id=\"T_9d509_row0_col5\" class=\"data row0 col5\" >False</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_9d509_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
" <td id=\"T_9d509_row1_col0\" class=\"data row1 col0\" >Who conducts the draft in which Marc-Andre Fleury was drafted to the Vegas Golden Knights for the 2017-18 season?</td>\n",
" <td id=\"T_9d509_row1_col1\" class=\"data row1 col1\" >National Hockey League</td>\n",
" <td id=\"T_9d509_row1_col2\" class=\"data row1 col2\" >{'2017 NHL Expansion Draft', '2017–18 Pittsburgh Penguins season'}</td>\n",
" <td id=\"T_9d509_row1_col3\" class=\"data row1 col3\" >['2017–18 Pittsburgh Penguins season | The 2017–18 Pittsburgh Penguins season will be the 51st season for the National Hockey League ice hockey team that was...</td>\n",
" <td id=\"T_9d509_row1_col4\" class=\"data row1 col4\" >National Hockey League</td>\n",
" <td id=\"T_9d509_row1_col5\" class=\"data row1 col5\" >✔️ [True]</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_9d509_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
" <td id=\"T_9d509_row2_col0\" class=\"data row2 col0\" >The Wings entered a new era, following the retirement of which Canadian retired professional ice hockey player and current general manager of the Tampa Bay...</td>\n",
" <td id=\"T_9d509_row2_col1\" class=\"data row2 col1\" >Steve Yzerman</td>\n",
" <td id=\"T_9d509_row2_col2\" class=\"data row2 col2\" >{'2006–07 Detroit Red Wings season', 'Steve Yzerman'}</td>\n",
" <td id=\"T_9d509_row2_col3\" class=\"data row2 col3\" >['Steve Yzerman | Stephen Gregory \"Steve\" Yzerman ( ; born May 9, 1965) is a Canadian retired professional ice hockey player and current general manager...</td>\n",
" <td id=\"T_9d509_row2_col4\" class=\"data row2 col4\" >Steve Yzerman</td>\n",
" <td id=\"T_9d509_row2_col5\" class=\"data row2 col5\" >✔️ [True]</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_9d509_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
" <td id=\"T_9d509_row3_col0\" class=\"data row3 col0\" >What river is near the Crichton Collegiate Church?</td>\n",
" <td id=\"T_9d509_row3_col1\" class=\"data row3 col1\" >the River Tyne</td>\n",
" <td id=\"T_9d509_row3_col2\" class=\"data row3 col2\" >{'Crichton Collegiate Church', 'Crichton Castle'}</td>\n",
" <td id=\"T_9d509_row3_col3\" class=\"data row3 col3\" >[\"Crichton Collegiate Church | Crichton Collegiate Church is situated about 0.6 mi south west of the hamlet of Crichton in Midlothian, Scotland. Crichton itself is...</td>\n",
" <td id=\"T_9d509_row3_col4\" class=\"data row3 col4\" >River Tyne</td>\n",
" <td id=\"T_9d509_row3_col5\" class=\"data row3 col5\" >✔️ [True]</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_9d509_level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
" <td id=\"T_9d509_row4_col0\" class=\"data row4 col0\" >In the 10th Century A.D. Ealhswith had a son called Æthelweard by which English king?</td>\n",
" <td id=\"T_9d509_row4_col1\" class=\"data row4 col1\" >King Alfred the Great</td>\n",
" <td id=\"T_9d509_row4_col2\" class=\"data row4 col2\" >{'Ealhswith', 'Æthelweard (son of Alfred)'}</td>\n",
" <td id=\"T_9d509_row4_col3\" class=\"data row4 col3\" >[\"Æthelweard of East Anglia | Æthelweard (died 854) was a 9th-century king of East Anglia, the long-lived Anglo-Saxon kingdom which today includes the English counties...</td>\n",
" <td id=\"T_9d509_row4_col4\" class=\"data row4 col4\" >Alfred the Great</td>\n",
" <td id=\"T_9d509_row4_col5\" class=\"data row4 col5\" >False</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"<IPython.core.display.HTML object>"
],
"text/html": [
"\n",
" <div style='\n",
" text-align: center;\n",
" font-size: 16px;\n",
" font-weight: bold;\n",
" color: #555;\n",
" margin: 10px 0;'>\n",
" ... 45 more rows not displayed ...\n",
" </div>\n",
" "
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"# 5b. Uncompiled Baleen RAG (without Optimizer)\n",
"class GenerateSearchQuery(dspy.Signature):\n",
" \"\"\"Write a simple search query that will help answer a complex question.\"\"\"\n",
" context = dspy.InputField(desc=\"may contain relevant facts\")\n",
" question = dspy.InputField()\n",
" query = dspy.OutputField()\n",
"\n",
"class SimplifiedBaleen(dspy.Module):\n",
" def __init__(self, passages_per_hop=3, max_hops=2):\n",
" super().__init__()\n",
" self.generate_query = [dspy.ChainOfThought(GenerateSearchQuery) for _ in range(max_hops)]\n",
" self.retrieve = dspy.Retrieve(k=passages_per_hop)\n",
" self.generate_answer = dspy.ChainOfThought(GenerateAnswer)\n",
" self.max_hops = max_hops\n",
"\n",
" def forward(self, question):\n",
" context = []\n",
" for hop in range(self.max_hops):\n",
" query = self.generate_query[hop](context=context, question=question).query\n",
" passages = self.retrieve(query).passages\n",
" context = deduplicate(context + passages)\n",
" pred = self.generate_answer(context=context, question=question)\n",
" return dspy.Prediction(context=context, answer=pred.answer)\n",
"\n",
"uncompiled_baleen = SimplifiedBaleen() # uncompiled (i.e., zero-shot) program\n",
"pred = uncompiled_baleen(my_question)\n",
"print(f\"Question: {my_question}\")\n",
"print(f\"Predicted Answer: {pred.answer}\")\n",
"print(f\"Retrieved Contexts (truncated): {[c[:200] + '...' for c in pred.context]}\")\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 224
},
"id": "0687FneGJSPN",
"outputId": "5f9738ee-58b0-44ae-d0d7-40791d0d51dd"
},
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"Question: What castle did David Gregory inherit?\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Question: What castle did David Gregory inherit?\n",
"</pre>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Predicted Answer: Kinnairdy Castle\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Predicted Answer: Kinnairdy Castle\n",
"</pre>\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Retrieved Contexts \u001b[1m(\u001b[0mtruncated\u001b[1m)\u001b[0m: \u001b[1m[\u001b[0m\u001b[32m'David Gregory \u001b[0m\u001b[32m(\u001b[0m\u001b[32mphysician\u001b[0m\u001b[32m)\u001b[0m\u001b[32m | David Gregory \u001b[0m\u001b[32m(\u001b[0m\u001b[32m20 December 1625 – 1720\u001b[0m\u001b[32m)\u001b[0m\u001b[32m was a \u001b[0m\n",
"\u001b[32mScottish physician and inventor. His surname is sometimes spelt as Gregorie, the original Scottish spelling. He \u001b[0m\n",
"\u001b[32minherited Kinn...'\u001b[0m, \u001b[32m'The Boleyn Inheritance | The Boleyn Inheritance is a novel by British author Philippa Gregory \u001b[0m\n",
"\u001b[32mwhich was first published in 2006. It is a direct sequel to her previous novel \"The Other Boleyn Girl,\" an...'\u001b[0m, \n",
"\u001b[32m'Gregory of Gaeta | Gregory was the Duke of Gaeta from 963 until his death. He was the second son of Docibilis II \u001b[0m\n",
"\u001b[32mof Gaeta and his wife Orania. He succeeded his brother John II, who had left only daugh...'\u001b[0m, \u001b[32m'James Roberton, Lord \u001b[0m\n",
"\u001b[32mBedlay | James Roberton, Lord Bedlay \u001b[0m\u001b[32m(\u001b[0m\u001b[32mc. 1590 – May 1664\u001b[0m\u001b[32m)\u001b[0m\u001b[32m was a Scottish advocate and judge. He was born to \u001b[0m\n",
"\u001b[32mArchibald Roberton of Stainhall, youngest son of John Roberton 9th Lair...'\u001b[0m, \u001b[32m\"Fairfax House | Fairfax House is a \u001b[0m\n",
"\u001b[32mGeorgian townhouse located at No. 27, Castlegate, York, England, near Clifford's Tower and York Castle Museum. It \u001b[0m\n",
"\u001b[32mwas probably built in the early 1740s for a local m...\"\u001b[0m\u001b[1m]\u001b[0m\n"
],
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Retrieved Contexts <span style=\"font-weight: bold\">(</span>truncated<span style=\"font-weight: bold\">)</span>: <span style=\"font-weight: bold\">[</span><span style=\"color: #008000; text-decoration-color: #008000\">'David Gregory (physician) | David Gregory (20 December 1625 – 1720) was a </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">Scottish physician and inventor. His surname is sometimes spelt as Gregorie, the original Scottish spelling. He </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">inherited Kinn...'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'The Boleyn Inheritance | The Boleyn Inheritance is a novel by British author Philippa Gregory </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">which was first published in 2006. It is a direct sequel to her previous novel \"The Other Boleyn Girl,\" an...'</span>, \n",
"<span style=\"color: #008000; text-decoration-color: #008000\">'Gregory of Gaeta | Gregory was the Duke of Gaeta from 963 until his death. He was the second son of Docibilis II </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">of Gaeta and his wife Orania. He succeeded his brother John II, who had left only daugh...'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'James Roberton, Lord </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">Bedlay | James Roberton, Lord Bedlay (c. 1590 – May 1664) was a Scottish advocate and judge. He was born to </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">Archibald Roberton of Stainhall, youngest son of John Roberton 9th Lair...'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">\"Fairfax House | Fairfax House is a </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">Georgian townhouse located at No. 27, Castlegate, York, England, near Clifford's Tower and York Castle Museum. It </span>\n",
"<span style=\"color: #008000; text-decoration-color: #008000\">was probably built in the early 1740s for a local m...\"</span><span style=\"font-weight: bold\">]</span>\n",
"</pre>\n"
]
},
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [
"#5c. Compiled Baleen RAG (with Optimizer)\n",
"def validate_context_and_answer_and_hops(example, pred, trace=None):\n",
" if not dspy.evaluate.answer_exact_match(example, pred): return False\n",
" if not dspy.evaluate.answer_passage_match(example, pred): return False\n",
" hops = [example.question] + [outputs.query for *_, outputs in trace if 'query' in outputs]\n",
" if max([len(h) for h in hops]) > 100: return False\n",
" if any(dspy.evaluate.answer_exact_match_str(hops[idx], hops[:idx], frac=0.8) for idx in range(2, len(hops))): return False\n",
" return True\n",
"\n",
"teleprompter = BootstrapFewShot(metric=validate_context_and_answer_and_hops)\n",
"compiled_baleen = teleprompter.compile(SimplifiedBaleen(), teacher=SimplifiedBaleen(passages_per_hop=2), trainset=trainset)\n",
"uncompiled_baleen_retrieval_score = evaluate_on_hotpotqa(uncompiled_baleen, metric=gold_passages_retrieved)\n",
"compiled_baleen_retrieval_score = evaluate_on_hotpotqa(compiled_baleen, metric=gold_passages_retrieved)\n",
"\n",
"print(f\"## Retrieval Score for RAG: {compiled_rag_retrieval_score}\")\n",
"print(f\"## Retrieval Score for uncompiled Baleen: {uncompiled_baleen_retrieval_score}\")\n",
"print(f\"## Retrieval Score for compiled Baleen: {compiled_baleen_retrieval_score}\")\n",
"\n",
"compiled_baleen(\"How many storeys are in the castle that David Gregory inherited?\")\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "5jFaCt3bJWYe",
"outputId": "d45e6da5-1ebc-415e-c188-fe13abb94777"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
" 90%|█████████ | 18/20 [01:12<00:08, 4.05s/it]\n"
]
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Bootstrapped 4 full traces after 19 examples in round 0.\n"
]
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"Average Metric: 11 / 22 (50.0): 44%|████▍ | 22/50 [01:31<01:45, 3.78s/it]"
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment