{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "47cd47140dbb4e28a4f31d5632bfe82d": { "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_7c0ddb1e0e3145f08ccb0c32b02c562f", "IPY_MODEL_85c490db972b4d659caad513359a6700", "IPY_MODEL_d61e96ae08d84414a638dd592f13fb18" ], "layout": "IPY_MODEL_9e7f4734aa034e4aa5207b8a2498ee02" } }, "7c0ddb1e0e3145f08ccb0c32b02c562f": { "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_df08ba8056fb47cb969e132087987e68", "placeholder": "​", "style": "IPY_MODEL_470febc3af8348ef8611255e88401229", "value": "deepseek_q8_seq128_ekv1280.tflite: 100%" } }, "85c490db972b4d659caad513359a6700": { "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_39cedca11f574c01808acdc1be9aa68d", "max": 1808783640, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_62bd6d393ca74193bded59a8ebd0a749", "value": 1808783640 } }, "d61e96ae08d84414a638dd592f13fb18": { "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_475c5c4fc6eb404180d7b69d75f797ea", "placeholder": "​", "style": "IPY_MODEL_b815fc17c9ee4913b5cb452653ff1af9", "value": " 1.81G/1.81G [00:16<00:00, 160MB/s]" } }, "9e7f4734aa034e4aa5207b8a2498ee02": { "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 } }, "df08ba8056fb47cb969e132087987e68": { "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 } }, "470febc3af8348ef8611255e88401229": { "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": "" } }, "39cedca11f574c01808acdc1be9aa68d": { "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 } }, "62bd6d393ca74193bded59a8ebd0a749": { "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": "" } }, "475c5c4fc6eb404180d7b69d75f797ea": { "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 } }, "b815fc17c9ee4913b5cb452653ff1af9": { "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": "" } }, "8cac4d03da1044d6adb8b62752ed6775": { "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_a201091e2f9b4f6c8a7d780dde854134", "IPY_MODEL_16e2c22fb42e41e8b810c4e659091d37", "IPY_MODEL_a1f5e814104646cbac5db19fdbcfccb2" ], "layout": "IPY_MODEL_3186fb1553884a7da72a387f1e00eca5" } }, "a201091e2f9b4f6c8a7d780dde854134": { "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_875fbcb976bf486092d3c6f483b9e042", "placeholder": "​", "style": "IPY_MODEL_e2a24c0c90b149508715998b1cf301f7", "value": "tokenizer_config.json: 100%" } }, "16e2c22fb42e41e8b810c4e659091d37": { "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_c730ecd68ae547b1822039b86bd22322", "max": 3071, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_0cd73c61a5e04ae1854eb1f1c4d92317", "value": 3071 } }, "a1f5e814104646cbac5db19fdbcfccb2": { "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_c46a9a3e8c7d4560ae71226920e17acd", "placeholder": "​", "style": "IPY_MODEL_2303aed14ff44e178ed20edf1f2e5359", "value": " 3.07k/3.07k [00:00<00:00, 267kB/s]" } }, "3186fb1553884a7da72a387f1e00eca5": { "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 } }, "875fbcb976bf486092d3c6f483b9e042": { "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 } }, "e2a24c0c90b149508715998b1cf301f7": { "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": "" } }, "c730ecd68ae547b1822039b86bd22322": { "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 } }, "0cd73c61a5e04ae1854eb1f1c4d92317": { "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": "" } }, "c46a9a3e8c7d4560ae71226920e17acd": { "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 } }, "2303aed14ff44e178ed20edf1f2e5359": { "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": "" } }, "072e1baca7d64766807df5454dc9e3cc": { "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_6da37a13974c4c3890c7676d194021bc", "IPY_MODEL_2f5b6f1af091405287c35c53ad169354", "IPY_MODEL_b977fb3e42a14fe1bec47426ae1efded" ], "layout": "IPY_MODEL_a063adb2cc1c44438d5f631fb16297ae" } }, "6da37a13974c4c3890c7676d194021bc": { "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_50f86e2ac8444d1986d8d9afe9fcee37", "placeholder": "​", "style": "IPY_MODEL_da323d8a744a43d8901f19c48b1e1223", "value": "tokenizer.json: 100%" } }, "2f5b6f1af091405287c35c53ad169354": { "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_69afe592335b4d73b51b63e4c56407fc", "max": 7031660, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_f3605ab95cbf4ebda9a678a0788e9682", "value": 7031660 } }, "b977fb3e42a14fe1bec47426ae1efded": { "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_7d2023b2a9054a3991983a30fdc6555b", "placeholder": "​", "style": "IPY_MODEL_17d028b387724317ae9994819a97a3a4", "value": " 7.03M/7.03M [00:00<00:00, 28.7MB/s]" } }, "a063adb2cc1c44438d5f631fb16297ae": { "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 } }, "50f86e2ac8444d1986d8d9afe9fcee37": { "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 } }, "da323d8a744a43d8901f19c48b1e1223": { "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": "" } }, "69afe592335b4d73b51b63e4c56407fc": { "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 } }, "f3605ab95cbf4ebda9a678a0788e9682": { "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": "" } }, "7d2023b2a9054a3991983a30fdc6555b": { "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 } }, "17d028b387724317ae9994819a97a3a4": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } } } } }, "cells": [ { "cell_type": "markdown", "source": [ "#Install dependencies" ], "metadata": { "id": "39AMoCOa1ckc" } }, { "cell_type": "code", "source": [ "!pip install ai-edge-litert" ], "metadata": { "id": "43tAeO0AZ7zp", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "76cd0d1b-7de2-4519-c0ae-1b9e6ee37653" }, "execution_count": 1, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Collecting ai-edge-litert\n", " Downloading ai_edge_litert-1.1.2-cp311-cp311-manylinux_2_17_x86_64.whl.metadata (1.6 kB)\n", "Requirement already satisfied: flatbuffers in /usr/local/lib/python3.11/dist-packages (from ai-edge-litert) (25.2.10)\n", "Requirement already satisfied: numpy>=1.23.2 in /usr/local/lib/python3.11/dist-packages (from ai-edge-litert) (1.26.4)\n", "Downloading ai_edge_litert-1.1.2-cp311-cp311-manylinux_2_17_x86_64.whl (3.5 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.5/3.5 MB\u001b[0m \u001b[31m23.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hInstalling collected packages: ai-edge-litert\n", "Successfully installed ai-edge-litert-1.1.2\n" ] } ] }, { "cell_type": "code", "source": [ "from ai_edge_litert import interpreter as interpreter_lib\n", "from transformers import AutoTokenizer\n", "import numpy as np\n", "from collections.abc import Sequence\n", "import sys" ], "metadata": { "id": "i6PMkMVBPr1p" }, "execution_count": 2, "outputs": [] }, { "cell_type": "markdown", "source": [ "# Download model files" ], "metadata": { "id": "K5okZCTgYpUd" } }, { "cell_type": "code", "source": [ "from huggingface_hub import hf_hub_download\n", "\n", "model_path = hf_hub_download(repo_id=\"litert-community/DeepSeek-R1-Distill-Qwen-1.5B\", filename=\"deepseek_q8_seq128_ekv1280.tflite\")" ], "metadata": { "id": "3t47HAG2tvc3", "colab": { "base_uri": "https://localhost:8080/", "height": 49, "referenced_widgets": [ "47cd47140dbb4e28a4f31d5632bfe82d", "7c0ddb1e0e3145f08ccb0c32b02c562f", "85c490db972b4d659caad513359a6700", "d61e96ae08d84414a638dd592f13fb18", "9e7f4734aa034e4aa5207b8a2498ee02", "df08ba8056fb47cb969e132087987e68", "470febc3af8348ef8611255e88401229", "39cedca11f574c01808acdc1be9aa68d", "62bd6d393ca74193bded59a8ebd0a749", "475c5c4fc6eb404180d7b69d75f797ea", "b815fc17c9ee4913b5cb452653ff1af9" ] }, "outputId": "d1d8ed1a-5ec6-4121-9d3c-fada487fc8ed" }, "execution_count": 3, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "deepseek_q8_seq128_ekv1280.tflite: 0%| | 0.00/1.81G [00:00 dict[str, np.ndarray]:\n", " if self._prefill_runner is None:\n", " raise ValueError(\"Prefill runner is not initialized.\")\n", " kv_cache = {}\n", " for input_key in self._prefill_runner.get_input_details().keys():\n", " if \"kv_cache\" in input_key:\n", " kv_cache[input_key] = np.zeros(\n", " self._prefill_runner.get_input_details()[input_key][\"shape\"],\n", " dtype=np.float32,\n", " )\n", " kv_cache[input_key] = np.zeros(\n", " self._prefill_runner.get_input_details()[input_key][\"shape\"],\n", " dtype=np.float32,\n", " )\n", " return kv_cache\n", "\n", " def _get_prefill_runner(self, num_input_tokens: int) :\n", " \"\"\"Gets the prefill runner with the best suitable input size.\n", "\n", " Args:\n", " num_input_tokens: The number of input tokens.\n", "\n", " Returns:\n", " The prefill runner with the smallest input size.\n", " \"\"\"\n", " best_signature = None\n", " delta = sys.maxsize\n", " max_prefill_len = -1\n", " for key in self._interpreter.get_signature_list().keys():\n", " if \"prefill\" not in key:\n", " continue\n", " input_pos = self._interpreter.get_signature_runner(key).get_input_details()[\n", " \"input_pos\"\n", " ]\n", " # input_pos[\"shape\"] has shape (max_seq_len, )\n", " seq_size = input_pos[\"shape\"][0]\n", " max_prefill_len = max(max_prefill_len, seq_size)\n", " if num_input_tokens <= seq_size and seq_size - num_input_tokens < delta:\n", " delta = seq_size - num_input_tokens\n", " best_signature = key\n", " if best_signature is None:\n", " raise ValueError(\n", " \"The largest prefill length supported is %d, but we have %d number of input tokens\"\n", " %(max_prefill_len, num_input_tokens)\n", " )\n", " return self._interpreter.get_signature_runner(best_signature)\n", "\n", " def _run_prefill(\n", " self, prefill_token_ids: Sequence[int],\n", " ) -> dict[str, np.ndarray]:\n", " \"\"\"Runs prefill and returns the kv cache.\n", "\n", " Args:\n", " prefill_token_ids: The token ids of the prefill input.\n", "\n", " Returns:\n", " The updated kv cache.\n", " \"\"\"\n", " if not self._prefill_runner:\n", " raise ValueError(\"Prefill runner is not initialized.\")\n", " prefill_token_length = len(prefill_token_ids)\n", " if prefill_token_length == 0:\n", " return self._init_kv_cache()\n", "\n", " # Prepare the input to be [1, max_seq_len].\n", " input_token_ids = [0] * self._max_seq_len\n", " input_token_ids[:prefill_token_length] = prefill_token_ids\n", " input_token_ids = np.asarray(input_token_ids, dtype=np.int32)\n", " input_token_ids = np.expand_dims(input_token_ids, axis=0)\n", "\n", " # Prepare the input position to be [max_seq_len].\n", " input_pos = [0] * self._max_seq_len\n", " input_pos[:prefill_token_length] = range(prefill_token_length)\n", " input_pos = np.asarray(input_pos, dtype=np.int32)\n", "\n", " # Initialize kv cache.\n", " prefill_inputs = self._init_kv_cache()\n", " prefill_inputs.update({\n", " \"tokens\": input_token_ids,\n", " \"input_pos\": input_pos,\n", " })\n", " prefill_outputs = self._prefill_runner(**prefill_inputs)\n", " if \"logits\" in prefill_outputs:\n", " # Prefill outputs includes logits and kv cache. We only output kv cache.\n", " prefill_outputs.pop(\"logits\")\n", "\n", " return prefill_outputs\n", "\n", " def _greedy_sampler(self, logits: np.ndarray) -> int:\n", " return int(np.argmax(logits))\n", "\n", "\n", " def _run_decode(\n", " self,\n", " start_pos: int,\n", " start_token_id: int,\n", " kv_cache: dict[str, np.ndarray],\n", " max_decode_steps: int,\n", " ) -> str:\n", " \"\"\"Runs decode and outputs the token ids from greedy sampler.\n", "\n", " Args:\n", " start_pos: The position of the first token of the decode input.\n", " start_token_id: The token id of the first token of the decode input.\n", " kv_cache: The kv cache from the prefill.\n", " max_decode_steps: The max decode steps.\n", "\n", " Returns:\n", " The token ids from the greedy sampler.\n", " \"\"\"\n", " next_pos = start_pos\n", " next_token = start_token_id\n", " decode_text = []\n", " decode_inputs = kv_cache\n", "\n", " for _ in range(max_decode_steps):\n", " decode_inputs.update({\n", " \"tokens\": np.array([[next_token]], dtype=np.int32),\n", " \"input_pos\": np.array([next_pos], dtype=np.int32),\n", " })\n", " decode_outputs = self._decode_runner(**decode_inputs)\n", " # Output logits has shape (batch=1, 1, vocab_size). We only take the first\n", " # element.\n", " logits = decode_outputs.pop(\"logits\")[0][0]\n", " next_token = self._greedy_sampler(logits)\n", " if next_token == self._tokenizer.eos_token_id:\n", " break\n", " decode_text.append(self._tokenizer.decode(next_token, skip_special_tokens=False))\n", " print(decode_text[-1], end='', flush=True)\n", " # Decode outputs includes logits and kv cache. We already poped out\n", " # logits, so the rest is kv cache. We pass the updated kv cache as input\n", " # to the next decode step.\n", " decode_inputs = decode_outputs\n", " next_pos += 1\n", "\n", " print() # print a new line at the end.\n", " return ''.join(decode_text)\n", "\n", " def generate(self, prompt: str, max_decode_steps: int | None = None) -> str:\n", " messages=[{ 'role': 'user', 'content': prompt}]\n", " token_ids = self._tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True)\n", " # Initialize the prefill runner with the suitable input size.\n", " self._init_prefill_runner(len(token_ids))\n", "\n", " # Run prefill.\n", " # Prefill up to the seond to the last token of the prompt, because the last\n", " # token of the prompt will be used to bootstrap decode.\n", " prefill_token_length = len(token_ids) - 1\n", "\n", " print('Running prefill')\n", " kv_cache = self._run_prefill(token_ids[:prefill_token_length])\n", " # Run decode.\n", " print('Running decode')\n", " actual_max_decode_steps = self._max_kv_cache_seq_len - prefill_token_length - 1\n", " if max_decode_steps is not None:\n", " actual_max_decode_steps = min(actual_max_decode_steps, max_decode_steps)\n", " decode_text = self._run_decode(\n", " prefill_token_length,\n", " token_ids[prefill_token_length],\n", " kv_cache,\n", " actual_max_decode_steps,\n", " )\n", " return decode_text" ], "metadata": { "id": "UBSGrHrM4ANm" }, "execution_count": 15, "outputs": [] }, { "cell_type": "markdown", "source": [ "# Generate text from model" ], "metadata": { "id": "dASKx_JtYXwe" } }, { "cell_type": "code", "source": [ "# Disclaimer: Model performance demonstrated with the Python API in this notebook is not representative of performance on a local device.\n", "pipeline = LiteRTLlmPipeline(interpreter, tokenizer)" ], "metadata": { "id": "AZhlDQWg61AL" }, "execution_count": 16, "outputs": [] }, { "cell_type": "code", "source": [ "prompt = \"what is the capital of France\"\n", "output = pipeline.generate(prompt, max_decode_steps = None)" ], "metadata": { "id": "wT9BIiATkjzL" }, "execution_count": null, "outputs": [] } ] }