{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "machine_shape": "hm", "gpuType": "V100", "collapsed_sections": [ "mI1cApCQ67Uq", "Mxfg-MGyxA9E", "_uUqYd-wzUA-", "cvmk3j4XA1mo" ], "toc_visible": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "accelerator": "GPU", "widgets": { "application/vnd.jupyter.widget-state+json": { "f5e32ca95c5141eeb8a8ee1c01c01cdc": { "model_module": "@jupyter-widgets/controls", "model_name": "VBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "VBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "VBoxView", "box_style": "", "children": [ "IPY_MODEL_3fa74c1ab4c84124bbb7e4a5a03a179d", "IPY_MODEL_63adf90fb4754bcfb6b3d6814aec431a", "IPY_MODEL_4dc37676b53f446098bb6e5b4637cee5", "IPY_MODEL_14cdb6aa054f4f4994cbcc9ef15a64fa" ], "layout": "IPY_MODEL_49b4e572a1414d13b0d3ee35f2a4f8dd" } }, "cf8a1af3d6d143449e389165210371bd": { "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_50f1ebea4eae4cf7b82681b84ddce56a", "placeholder": "​", "style": "IPY_MODEL_1889ca34c61744a8985a38092e04a3d3", "value": "

Copy a token from your Hugging Face\ntokens page and paste it below.
Immediately click login after copying\nyour token or it might be stored in plain text in this notebook file.
" } }, "63ac23ec6ac148319ef05b2eed5cb3ca": { "model_module": "@jupyter-widgets/controls", "model_name": "PasswordModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "PasswordModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "PasswordView", "continuous_update": true, "description": "Token:", "description_tooltip": null, "disabled": false, "layout": "IPY_MODEL_f2a92927ed82459e961c542c885db9cc", "placeholder": "​", "style": "IPY_MODEL_2c031cdce9ad40539b93e4218ddf0f86", "value": "" } }, "1fb441d169fe4229b618992d60599241": { "model_module": "@jupyter-widgets/controls", "model_name": "CheckboxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "CheckboxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "CheckboxView", "description": "Add token as git credential?", "description_tooltip": null, "disabled": false, "indent": true, "layout": "IPY_MODEL_e1b824c92a0e42cc856e94b8bd76da8d", "style": "IPY_MODEL_d1a5eb9a2a474826b01ca78b6aa5a989", "value": true } }, "1ddd704bc90a4095b34769db39d1e060": { "model_module": "@jupyter-widgets/controls", "model_name": "ButtonModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ButtonModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ButtonView", "button_style": "", "description": "Login", "disabled": false, "icon": "", "layout": "IPY_MODEL_427fc90dce8c467cb81048c494d3096a", "style": "IPY_MODEL_f4f68f2f76394e56bcf34e47d7d9936b", "tooltip": "" } }, "fbec8569536844559a7a4b3fdaefc06c": { "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_008dd0b7377241f3818ca3298f237bee", "placeholder": "​", "style": "IPY_MODEL_a7cf5f15cb9d4bd8973214132001f3ed", "value": "\nPro Tip: If you don't already have one, you can create a dedicated\n'notebooks' token with 'write' access, that you can then easily reuse for all\nnotebooks. " } }, "49b4e572a1414d13b0d3ee35f2a4f8dd": { "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": "center", "align_self": null, "border": null, "bottom": null, "display": "flex", "flex": null, "flex_flow": "column", "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": "50%" } }, "50f1ebea4eae4cf7b82681b84ddce56a": { "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 } }, "1889ca34c61744a8985a38092e04a3d3": { "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": "" } }, "f2a92927ed82459e961c542c885db9cc": { "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 } }, "2c031cdce9ad40539b93e4218ddf0f86": { "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": "" } }, "e1b824c92a0e42cc856e94b8bd76da8d": { "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 } }, "d1a5eb9a2a474826b01ca78b6aa5a989": { "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": "" } }, "427fc90dce8c467cb81048c494d3096a": { "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 } }, "f4f68f2f76394e56bcf34e47d7d9936b": { "model_module": "@jupyter-widgets/controls", "model_name": "ButtonStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ButtonStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "button_color": null, "font_weight": "" } }, "008dd0b7377241f3818ca3298f237bee": { "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 } }, "a7cf5f15cb9d4bd8973214132001f3ed": { "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": "" } }, "a44a97b2a5ba4aab98ac79e7e5a2079a": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_449a1dcafc354957bc27ce994f41b4b5", "placeholder": "​", "style": "IPY_MODEL_f8cd392cff2a4f0ba34cc8299291753a", "value": "Connecting..." } }, "449a1dcafc354957bc27ce994f41b4b5": { "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 } }, "f8cd392cff2a4f0ba34cc8299291753a": { "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": "" } }, "3fa74c1ab4c84124bbb7e4a5a03a179d": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_97fe922717734887a07254c576dbdefd", "placeholder": "​", "style": "IPY_MODEL_d6edfad2881d4fa4b0e199a86aa02065", "value": "Token is valid (permission: write)." } }, "63adf90fb4754bcfb6b3d6814aec431a": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_c0625a236b2e4eaa9b2c04eb01bb5424", "placeholder": "​", "style": "IPY_MODEL_a73334be50504639a600a07eddbfd2af", "value": "Your token has been saved in your configured git credential helpers (store)." } }, "4dc37676b53f446098bb6e5b4637cee5": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_ab4876fa32bf4f189d77d103a488e921", "placeholder": "​", "style": "IPY_MODEL_adc52cf406d143ffbbc43d9faedb1e4d", "value": "Your token has been saved to /root/.cache/huggingface/token" } }, "14cdb6aa054f4f4994cbcc9ef15a64fa": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_cc1f64d55b69408989593dc866f4edc1", "placeholder": "​", "style": "IPY_MODEL_05c6d043571d48acb090c282b62e3a07", "value": "Login successful" } }, "97fe922717734887a07254c576dbdefd": { "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 } }, "d6edfad2881d4fa4b0e199a86aa02065": { "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": "" } }, "c0625a236b2e4eaa9b2c04eb01bb5424": { "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 } }, "a73334be50504639a600a07eddbfd2af": { "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": "" } }, "ab4876fa32bf4f189d77d103a488e921": { "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 } }, "adc52cf406d143ffbbc43d9faedb1e4d": { "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": "" } }, "cc1f64d55b69408989593dc866f4edc1": { "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 } }, "05c6d043571d48acb090c282b62e3a07": { "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": "" } }, "241fd320f59b4937bf62cb06f6f69262": { "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_5e87bfc7901f4889b545a1c1a7f167bb", "IPY_MODEL_f6b8f694156649a58b3ef2c145496fc7", "IPY_MODEL_adf3a073e9eb4550835d4729d37f8f2a" ], "layout": "IPY_MODEL_dc8a3c6ee8cc429c9b02fe46319448a4" } }, "5e87bfc7901f4889b545a1c1a7f167bb": { "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_92238da8d4dc48feb9a2da25a1aeb948", "placeholder": "​", "style": "IPY_MODEL_9a92df5f977d4f71978e005dabab2d17", "value": "Map: 100%" } }, "f6b8f694156649a58b3ef2c145496fc7": { "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_4b32878f222d42cb8020802481f6e151", "max": 7522, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_f03bd2dacbd041e79cc5a599ea167763", "value": 7522 } }, "adf3a073e9eb4550835d4729d37f8f2a": { "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_b3c76dc7521b4bb4ac711bd6617e143e", "placeholder": "​", "style": "IPY_MODEL_1fd23da2a9034399a7b32a9e95693236", "value": " 7522/7522 [00:00<00:00, 52806.65 examples/s]" } }, "dc8a3c6ee8cc429c9b02fe46319448a4": { "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 } }, "92238da8d4dc48feb9a2da25a1aeb948": { "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 } }, "9a92df5f977d4f71978e005dabab2d17": { "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": "" } }, "4b32878f222d42cb8020802481f6e151": { "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 } }, "f03bd2dacbd041e79cc5a599ea167763": { "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": "" } }, "b3c76dc7521b4bb4ac711bd6617e143e": { "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 } }, "1fd23da2a9034399a7b32a9e95693236": { "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": [ "# Fine-Tuning a TinyLlama (tinyllama_tayswifty) Model For Fun & Profit" ], "metadata": { "id": "vudeU0fsy_6l" } }, { "cell_type": "markdown", "source": [ "\n", "\n", "> TinyLlama is a 1.1B Llama model that is currently being trained on 3 trillion tokens, which recently started on September 1st. In this project, I fine-tune the latest version of TinyLlama to generate song lyrics in the style of Taylor Swift.\n", "\n", "\n", "\n" ], "metadata": { "id": "PhdPfey8yZLb" } }, { "cell_type": "markdown", "source": [ "### Source Materials" ], "metadata": { "id": "mI1cApCQ67Uq" } }, { "cell_type": "markdown", "source": [ "HelloTaylorSwift tutorial is based primarily on this tutorial:\n", "\n", "* [Original kaggle notebook](https://www.kaggle.com/code/tommyadams/fine-tuning-tinyllama)\n", "* [Kaggle dataset](https://www.kaggle.com/datasets/thespacefreak/taylor-swift-song-lyrics-all-albums)\n", "\n", "\n", "However these other resources are also helpful:\n", "\n", "* Similar Model: https://huggingface.co/huggingartists/taylor-swift\n", "* Similar Dataset: https://huggingface.co/datasets/huggingartists/taylor-swift\n", "\n", "\n", "Tutorials on SFT & fine-tuning, TinyLlama, & HuggingFace\n", "* [Fine-Tune Your Own Tiny-Llama on Custom Dataset](https://www.youtube.com/watch?v=OVqe6GTrDFM)\n", "* [TinyLlama LLM: A Step-by-Step Guide to Implementing the 1.1B Model on Google Colab](https://dev.to/_ken0x/tinyllama-llm-a-step-by-step-guide-to-implementing-the-11b-model-on-google-colab-1pjh)\n", "* [Instruct-Tune Llama to Create ChatGPT Like Chatbots | Custom Dataset, Huggingface, SFT](https://www.youtube.com/watch?v=6XeTk8cZUsM)\n", "* [https://github.com/uygarkurt/SFT-TinyLlama/tree/main](https://github.com/uygarkurt/SFT-TinyLlama/tree/main)\n", "\n" ], "metadata": { "id": "ynnItTEpoQ9r" } }, { "cell_type": "markdown", "source": [ "### Tools\n", "\n", "You'll need an access & accounts for:\n", "\n", "* `Google Colab` - Ideally [Pro](https://colab.research.google.com/signup) (it's just faster to use a GPU like A100 or V100 High-RAM ~$10)\n", "\n", "* `Huggingface` - Also ideally [Pro](https://huggingface.co/pricing) (there are some great benefits, including unlimited model and dataset upload ~ $9)\n", "\n" ], "metadata": { "id": "PvuWBiyx6_0w" } }, { "cell_type": "markdown", "source": [ "# Get Set-up" ], "metadata": { "id": "IE-XcX5TjGDJ" } }, { "cell_type": "markdown", "source": [ "### 💡 What each library does\n" ], "metadata": { "id": "Mxfg-MGyxA9E" } }, { "cell_type": "markdown", "source": [ "\n", "1. `torch`: PyTorch is an open-source machine learning library developed by Facebook. It provides a flexible ecosystem for building and training deep learning models. In this code, PyTorch is used for tensor operations, model training, and GPU acceleration.\n", "\n", "2. `re`: The `re` module in Python provides support for regular expressions. It allows you to search, match, and manipulate strings based on specific patterns. In this code, `re` is used for cleaning and preprocessing the lyrics data.\n", "\n", "3. `peft`: PEFT (Parameter-Efficient Fine-Tuning) is a library that provides methods for efficient fine-tuning of large language models. It offers techniques like LoRA (Low-Rank Adaptation) to reduce the number of trainable parameters while still achieving good performance. In this code, PEFT is used to apply LoRA to the pre-trained model.\n", "\n", "4. `transformers`: The `transformers` library, developed by Hugging Face, provides a wide range of pre-trained transformer models and tools for natural language processing tasks. It offers a unified API for loading, fine-tuning, and using these models. In this code, `transformers` is used to load the pre-trained TinyLlama model and its associated tokenizer.\n", "\n", "5. `trl`: TRL (Text Generation with Reinforcement Learning) is a library that provides tools for fine-tuning language models using reinforcement learning techniques. It allows for the optimization of language models based on specific rewards or metrics. In this code, TRL is used to create an SFT (Supervised Fine-Tuning) trainer for fine-tuning the model.\n", "\n", "6. `datasets`: The `datasets` library, also developed by Hugging Face, provides a collection of popular datasets for various machine learning tasks. It offers a standardized interface for loading, preprocessing, and manipulating datasets. In this code, `datasets` is used to load the Taylor Swift example dataset and create dataset splits.\n", "\n", "7. `huggingface_hub`: The `huggingface_hub` library provides functionality for interacting with the Hugging Face Hub, a platform for sharing and discovering pre-trained models, datasets, and other AI-related resources. In this code, `notebook_login` from `huggingface_hub` is used to authenticate and login to the Hugging Face Hub.\n", "\n", "8. `numpy` (imported as `np`): NumPy is a fundamental library for scientific computing in Python. It provides support for large, multi-dimensional arrays and matrices, along with a wide range of mathematical functions. In this code, NumPy is used for array manipulation and splitting the dataset." ], "metadata": { "id": "FgpQK0p8xGhy" } }, { "cell_type": "markdown", "source": [ "### 💬 About the techniques" ], "metadata": { "id": "_uUqYd-wzUA-" } }, { "cell_type": "markdown", "source": [ "\n", "\n", "> I used Hugging Face's transformers and peft (parameter-efficient fine-tuning) packages for this project. One of the major challenges of fine-tuning a large language model (LLM) is the high memory usage on the GPU. To address this challenge, I used the quantization and fine-tuning methods described in the 2023 paper \"QLoRA: Efficient Finetuning of Quantized LLMs\".\n", "\n", "\n", "> These methods collectively enhance the efficiency of the project, enabling the creation of Taylor Swift-style song lyrics while optimizing GPU memory utilization and computational resources.\n", "\n", "\n", "\n" ], "metadata": { "id": "shwK4gKwzJDy" } }, { "cell_type": "markdown", "source": [ "## ▶️ Install necessary libraries" ], "metadata": { "id": "7khtBtF_ZunB" } }, { "cell_type": "code", "source": [ "!pip install trl transformers accelerate git+https://github.com/huggingface/peft.git -Uqqq\n", "!pip install -i https://pypi.org/simple/ bitsandbytes -qqq\n", "!pip install einops wandb -Uqqq" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "i28WeeGHFYci", "outputId": "afb4f653-5e29-4528-faad-b0ae2c536a1c" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ " Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n", " Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n", " Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n" ] } ] }, { "cell_type": "code", "source": [ "import torch\n", "import re\n", "from peft import get_peft_model, LoraConfig, prepare_model_for_kbit_training\n", "from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig, TrainingArguments\n", "from trl import SFTTrainer\n", "from datasets import Dataset\n", "import random" ], "metadata": { "id": "1javVEPsoryu" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "### ▶️ Loging With Huggingface Credentials" ], "metadata": { "id": "ssM64lMSj4m6" } }, { "cell_type": "markdown", "source": [ "Note: You need to create a Huggingface account and then create a user access token.\n", "\n", "See this [doc](https://huggingface.co/docs/hub/en/security-tokens).\n", "\n", "You'll want access so you can upload your trained model." ], "metadata": { "id": "R4Ch1pxZxaBz" } }, { "cell_type": "code", "source": [ "from huggingface_hub import notebook_login\n", "\n", "notebook_login()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 145, "referenced_widgets": [ "f5e32ca95c5141eeb8a8ee1c01c01cdc", "cf8a1af3d6d143449e389165210371bd", "63ac23ec6ac148319ef05b2eed5cb3ca", "1fb441d169fe4229b618992d60599241", "1ddd704bc90a4095b34769db39d1e060", "fbec8569536844559a7a4b3fdaefc06c", "49b4e572a1414d13b0d3ee35f2a4f8dd", "50f1ebea4eae4cf7b82681b84ddce56a", "1889ca34c61744a8985a38092e04a3d3", "f2a92927ed82459e961c542c885db9cc", "2c031cdce9ad40539b93e4218ddf0f86", "e1b824c92a0e42cc856e94b8bd76da8d", "d1a5eb9a2a474826b01ca78b6aa5a989", "427fc90dce8c467cb81048c494d3096a", "f4f68f2f76394e56bcf34e47d7d9936b", "008dd0b7377241f3818ca3298f237bee", "a7cf5f15cb9d4bd8973214132001f3ed", "a44a97b2a5ba4aab98ac79e7e5a2079a", "449a1dcafc354957bc27ce994f41b4b5", "f8cd392cff2a4f0ba34cc8299291753a", "3fa74c1ab4c84124bbb7e4a5a03a179d", "63adf90fb4754bcfb6b3d6814aec431a", "4dc37676b53f446098bb6e5b4637cee5", "14cdb6aa054f4f4994cbcc9ef15a64fa", "97fe922717734887a07254c576dbdefd", "d6edfad2881d4fa4b0e199a86aa02065", "c0625a236b2e4eaa9b2c04eb01bb5424", "a73334be50504639a600a07eddbfd2af", "ab4876fa32bf4f189d77d103a488e921", "adc52cf406d143ffbbc43d9faedb1e4d", "cc1f64d55b69408989593dc866f4edc1", "05c6d043571d48acb090c282b62e3a07" ] }, "id": "GUkNxSNmjSs7", "outputId": "03277be1-1f77-4c48-c507-9a4b13d6898c" }, "execution_count": null, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "VBox(children=(HTML(value='
**Low-rank adaptation:**\n", "This technique freezes the existing weights of TinyLlama and adds two smaller matrices with lower rank than the weight matrices into the model. Only these two smaller matrices are then trained, instead of all of the model weights. Another way to think of this is that we are grouping weights together and traing a scalar for each group, which is much easier than traing each weight by individually. In addition, low-rank adaptation is only done for the query and values weights in the attention heads of the transformers, while all other areas of the model are frozen. This greatly reduces the computation needed to fine-tune the model, while not impairing performance.\n", "\n" ], "metadata": { "id": "xieUfueEynpe" } }, { "cell_type": "markdown", "source": [ "### ▶️ Preparing the model for low-rank adaptation (LoRA)" ], "metadata": { "id": "8RYcIVHuDWPJ" } }, { "cell_type": "code", "source": [ "# Preparing the model for low-rank adaptation (e.g., LoRA)\n", "prepared_model = prepare_model_for_kbit_training(model)\n", "\n", "lora_alpha = 32\n", "lora_dropout = 0.05\n", "lora_rank = 32" ], "metadata": { "id": "N2R8vclB21U5" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "### ▶️ Configuring the LoRA parameters" ], "metadata": { "id": "3mqkXAv4DZ51" } }, { "cell_type": "code", "source": [ "# Configuring the LoRA parameters\n", "peft_config = LoraConfig(\n", " lora_alpha=lora_alpha,\n", " lora_dropout=lora_dropout,\n", " r=lora_rank,\n", " bias=\"none\", # setting to 'none' for only training weight params instead of biases\n", " task_type=\"CAUSAL_LM\")\n" ], "metadata": { "id": "TLup3QXFEIBS" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "### ▶️ Applying LoRA to the prepared model" ], "metadata": { "id": "kQClJdfZDcdg" } }, { "cell_type": "code", "source": [ "# Applying LoRA to the prepared model\n", "peft_model = get_peft_model(prepared_model, peft_config)" ], "metadata": { "id": "gqn97dtWEJ0_" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "## Set up fine-tuning configuration" ], "metadata": { "id": "pI5Dne4REuSj" } }, { "cell_type": "markdown", "source": [ "### ▶️ Replace `mmbazel` with your Huggingface username" ], "metadata": { "id": "sA2GTwnm-8VK" } }, { "cell_type": "markdown", "source": [ "The code sets output_dir to \"mmbazel/tinyllama_tayswifty\", which is the repository on the Hugging Face Hub where the fine-tuned model will be saved." ], "metadata": { "id": "0GVg5Pp5EmsK" } }, { "cell_type": "code", "source": [ "output_dir = \"mmbazel/tinyllama_tayswifty\" # Model repo on your hugging face account where you want to save your model" ], "metadata": { "id": "kvZIc3lP-68z" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "### ▶️ Set training arguments" ], "metadata": { "id": "IyXdQaaRFM4n" } }, { "cell_type": "code", "source": [ "# Setting training arguments\n", "per_device_train_batch_size = 3 # The batch size for training (set to 3)\n", "gradient_accumulation_steps = 2 # The number of steps to accumulate gradients before updating the model weights (set to 2)\n", "optim = \"paged_adamw_32bit\" # The optimization algorithm to use (set to \"paged_adamw_32bit\").\n", "save_steps = 10 # The frequency of saving and logging during training (set to 10)\n", "logging_steps = 10\n", "learning_rate = 2e-3 # The initial learning rate for the optimizer (set to 2e-3)\n", "max_grad_norm = 0.3 # Sets limit for gradient clipping\n", "max_steps = 200 # Number of training steps\n", "warmup_ratio = 0.03 # Portion of steps used for learning_rate to warmup from 0\n", "lr_scheduler_type = \"cosine\" # The type of learning rate scheduler (set to \"cosine\")." ], "metadata": { "id": "mTCOXYoT28z9" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "### ▶️ Creating the SFT (Supervised Fine-Tuning) trainer" ], "metadata": { "id": "RF1lRwX4FoCo" } }, { "cell_type": "markdown", "source": [ "\n", "* The code creates an `SFTTrainer` object, which is responsible for fine-tuning the LoRA-adapted model (`peft_model`) on the `train_lyrics_dataset`.\n", "\n", "* It passes various configurations to the `SFTTrainer`, such as the `peft_config`, `max_seq_length` (maximum sequence length), `dataset_text_field` (the field in the dataset containing the text), `tokenizer`, and `training_arguments`.\n", "\n", "* The `peft_model.config.use_cache `is set to `False` - disables caching for the model during training." ], "metadata": { "id": "URRuPkwCFt3h" } }, { "cell_type": "code", "source": [ "training_arguments = TrainingArguments(\n", " output_dir=output_dir,\n", " per_device_train_batch_size=per_device_train_batch_size,\n", " gradient_accumulation_steps=gradient_accumulation_steps,\n", " optim=optim,\n", " save_steps=save_steps,\n", " logging_steps=logging_steps,\n", " learning_rate=learning_rate,\n", " max_grad_norm=max_grad_norm,\n", " max_steps=max_steps,\n", " warmup_ratio=warmup_ratio,\n", " lr_scheduler_type=lr_scheduler_type,\n", " push_to_hub=True,\n", " report_to='none'\n", ")" ], "metadata": { "id": "tAsQAIppa88K" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Creating the SFT trainer\n", "trainer = SFTTrainer(\n", " model=peft_model,\n", " train_dataset=train_lyrics_dataset,\n", " peft_config=peft_config,\n", " max_seq_length=500,\n", " dataset_text_field='text',\n", " tokenizer=tokenizer,\n", " args=training_arguments\n", ")\n", "peft_model.config.use_cache = False" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 121, "referenced_widgets": [ "241fd320f59b4937bf62cb06f6f69262", "5e87bfc7901f4889b545a1c1a7f167bb", "f6b8f694156649a58b3ef2c145496fc7", "adf3a073e9eb4550835d4729d37f8f2a", "dc8a3c6ee8cc429c9b02fe46319448a4", "92238da8d4dc48feb9a2da25a1aeb948", "9a92df5f977d4f71978e005dabab2d17", "4b32878f222d42cb8020802481f6e151", "f03bd2dacbd041e79cc5a599ea167763", "b3c76dc7521b4bb4ac711bd6617e143e", "1fd23da2a9034399a7b32a9e95693236" ] }, "id": "na7Rsiw13Iac", "outputId": "25f60f3f-ba07-4360-f60c-6c7f16787b73" }, "execution_count": null, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "Map: 0%| | 0/7522 [00:00" ], "text/html": [ "\n", "
\n", " \n", " \n", " [200/200 01:01, Epoch 0/1]\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
StepTraining Loss
104.790900
203.451500
303.494700
403.316100
503.229200
603.181000
703.082100
803.248200
903.043200
1003.231200
1103.036500
1203.368400
1303.273700
1403.033700
1503.027700
1603.048600
1703.247900
1802.949100
1902.925200
2003.107500

" ] }, "metadata": {} }, { "output_type": "execute_result", "data": { "text/plain": [ "TrainOutput(global_step=200, training_loss=3.254313144683838, metrics={'train_runtime': 61.602, 'train_samples_per_second': 19.48, 'train_steps_per_second': 3.247, 'total_flos': 103816598925312.0, 'train_loss': 3.254313144683838, 'epoch': 0.16})" ] }, "metadata": {}, "execution_count": 98 } ] }, { "cell_type": "markdown", "source": [ "# ▶️ Try Out The Fine-Tuned Model" ], "metadata": { "id": "ybsXkeuF92sF" } }, { "cell_type": "code", "source": [ "# Generate lyrics using random segments of the test lyrics\n", "num_examples = 5 # Number of random examples to generate\n", "max_segment_length = 200 # Maximum length of each lyric segment" ], "metadata": { "id": "IIequcNDffhi" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "for i in range(num_examples):\n", " # Randomly select a starting index for the lyric segment\n", " start_index = random.randint(0, len(test_lyrics) - max_segment_length)\n", " end_index = start_index + max_segment_length\n", "\n", " # Extract the lyric segment\n", " lyric_segment = ' '.join(test_lyrics[start_index:end_index])\n", "\n", " print(f\"Example {i+1}:\")\n", " print(\"INPUT:\")\n", " print(lyric_segment)\n", " print(\"OUTPUT:\")\n", " generate_lyrics(lyric_segment, model, tokenizer)\n", " print(\"\\n\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Zcb44_A3VY8R", "outputId": "66a0c80e-4a1a-4106-a20f-17e33d8332d8" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Example 1:\n", "INPUT:\n", "Never be so polite You forget your power Never wield such power You forget to be polite And if I didn't know better I'd think you were listening to me now If I didn't know better I'd think you were still around What died didn't stay dead What died didn't stay dead You're alive, you're alive in my head What died didn't stay dead What died didn't stay dead You're alive, so alive The autumn chill that wakes me up You loved the amber skies so much Long limbs and frozen swims You'd always go past where our feet could touch And I complained the whole way there The car ride back and up the stairs I should've asked you questions I should've asked you how to be Asked you to write it down for me Should've kept every grocery store receipt 'Cause every scrap of you would be taken from me Watched as you signed your name Marjorie All your closets of backlogged dreams And how you left them all to me What died didn't stay dead What died didn't stay dead You're alive, you're alive in my head What died didn't stay dead What died didn't stay dead You're alive, so alive And if I didn't know better I'd think you were singing to me now If I didn't know better I'd think you were still around I know better But I still feel you all around I know better But you're still around It's been a long time And seeing the shape of your name Still spells out pain It wasn't right The way it all went down Looks like you know that now Yes, I got your letter Yes, I'm doing better It cut deep to know ya, right to the bone Yes, I got your letter Yes, I'm doing better I know that it's over, I don't need your Closure, your closure Don't treat me like Some situation that needs to be handled I'm fine with my spite And my tears, and my beers and my candles I can feel you smoothing me over Yes, I got your letter Yes, I'm doing better It cut deep to know ya, right to the bone Yes, I got your letter Yes, I'm doing better I know that it's over, I don't need your Closure, your closure Your closure, your closure I know I'm just a wrinkle in your new life Staying friends would iron it out so nice Guilty, guilty, reaching out across the sea That you put between you and me But it's fake and it's oh so unnecessary Yes, I got your letter Yes, I'm doing better It cut deep to know ya, right to the bone Yes, I got your letter Yes, I'm doing better I know that it's over, I don't need your Closure, closure, your closure Your closure Gray November I've been down since July Motion capture Put me in a bad light I replay my footsteps on each stepping stone Trying to find the one where I went wrong Writing letters Addressed to the fire And I was catching my breath Staring out an open window Catching my death And I couldn't be sure I had a feeling so peculiar That this pain would be for Evermore Hey December Guess I'm feeling unmoored Can't remember What I used to fight for I rewind the tape, but all it does is pause On the very moment all was lost Sending signals To be double crossed And I was catching my breath Barefoot in the wildest winter Catching my death And I couldn't be sure I had a feeling so peculiar That this pain would be for Evermore Evermore Can't not think of all the cost And the things that will be lost Oh, can we just get a pause? To be certain, we'll be tall again Whether weather be the frost Or the violence of the dog days I'm on waves, out being tossed Is there a line that I could just go cross? And when I was shipwrecked Can't think of all the cost I thought of you All the things that will be lost now In the cracks of light Can we just get a pause? I dreamed of you To be certain we'll be tall again, if you think of all the costs It was real enough Whether weather be the frost To get me through Or the violence of the dog days Or the violence of the dog days Out on waves, being tossed I'm on waves, out being tossed I swear Is there a line that we can just go cross? You were there And I was catching my breath Floors of a cabin creaking under my step And I couldn't be sure I had a feeling so peculiar This pain wouldn't be for Evermore Evermore Evermore This pain wouldn't be for evermore Evermore Friends break up, friends get married Strangers get born, strangers get buried Trends change, rumors fly through new skies But I'm right where you left me Matches burn after the other Pages turn and stick to each other Wages earned and lessons learned But I, I'm right where you left me Help, I'm still at the restaurant Still sitting in a corner I haunt Cross legged in the dim light They say, What a sad sight I, I swear you could hear a hair pin drop Right when I felt the moment stop Glass shattered on the white cloth Everybody moved on, I, I stayed there Dust collected on my pinned up hair They expected me to find somewhere Some perspective, but I sat and stared Right where you left me You left me no, you left me no You left me no choice but to stay here forever You left me, you left me no, oh, you left me no You left me no choice but to stay here forever Did you ever hear about the girl who got frozen? Time went on for everybody else, she won't know it She's still twenty three inside her fantasy How it was supposed to be Did you hear about the girl who lives in delusion? Breakups happen every day, you don't have to lose it She's still twenty three inside her fantasy And you're sitting in front of me At the restaurant when I was still the one you want Cross legged in the dim light, everything was just right I, I could feel the mascara run You told me that you met someone Glass shattered on the white cloth Everybody moved on Help, I'm still at the restaurant Still sitting in a corner I haunt Cross legged in the dim light They say, What a sad sight I, I stayed there Dust collected on my pinned up hair I'm sure that you got a wife out there Kids and Christmas, but I'm unaware 'Cause I'm right where I cause no harm Mind my business If our love died young I can't bear witness And it's been so long But if you ever think you got it wrong I'm right where You left me You left me no, oh, you left me no You left me no choice but to stay here forever You left me You left me no, oh, you left me no\n", "OUTPUT:\n", " Why then why are they gambray colors Again! Just plain old fashion black or gray No color or tone too late Now, yeah baby now Come look here brightened skylight colored sunshining So fair game play off both sides see what all ye doin bring us close together Ships come bearing sweet treasuries of flowers Flowers keep falling and dying Down by red telephone signal Two houses walk side-byon When nobody goes downthe door huh ah mum wooh Apry momma ohah Ah yes he says Yeah little girls There is nothing good about boys or men Let people enjoy themselves Oxygen their funny names For now you hold alight the lights and music Lift uh hand in mine hands and make your night into morning Alcoholic brews sparkling linger till dawn Like thunder, though. He said once I heard him coming outside, well played boy Look beautiful! I wanted a woman like you Last saw you in summer\n", "\n", "\n", "Example 2:\n", "INPUT:\n", "I've got some tricks up my sleeve Takes one to know one You're a cowboy like me Never wanted love Just a fancy car Now I'm waiting by the phone Like I'm sitting in an airport bar You had some tricks up your sleeve Takes one to know one You're a cowboy like me Perched in the dark Telling all the rich folks anything they wanna hear Like it could be love I could be the way forward Only if they pay for it You're a bandit like me Eyes full of stars Hustling for the good life Never thought I'd meet you here It could be love We could be the way forward And I know I'll pay for it You're a cowboy like me Perched in the dark Telling all the rich folks anything they wanna hear Like it could be love I could be the way forward Only if they pay for it You're a bandit like me Eyes full of stars Hustling for the good life Never thought I'd meet you here It could be love We could be the way forward And I know I'll pay for it And the skeletons in both our closets Plotted hard to fuck this up And the old men that I've swindled Really did believe I was the one And the ladies lunching have their stories about When you passed through town But that was all before I locked it down Now you hang from my lips Like the Gardens of Babylon With your boots beneath my bed Forever is the sweetest con I've had some tricks up my sleeve Takes one to know one You're a cowboy like me And I'm never gonna love again I'm never gonna love again I'm never gonna love again Fatefully I tried to pick my battles 'til the battle picked me Misery Like the war of words I shouted in my sleep And you passed right by I was in the alley, surrounded on all sides The knife cuts both ways If the shoe fits, walk in it 'til your high heels break And I fell from the pedestal Right down the rabbit hole Long story short, it was a bad time Pushed from the precipice Clung to the nearest lips Long story short, it was the wrong guy Now I'm all about you I'm all about you, ah Yeah, yeah I'm all about you, ah Yeah, yeah Actually I always felt I must look better in the rear view Missing me At the golden gates they once held the keys to When I dropped my sword I threw it in the bushes and knocked on your door And we live in peace But if someone comes at us, this time, I'm ready 'Cause I fell from the pedestal Right down the rabbit hole Long story short, it was a bad time Pushed from the precipice Clung to the nearest lips Long story short, it was the wrong guy Now I'm all about you I'm all about you, ah Yeah, yeah I'm all about you No more keepin' score Now I just keep you warm Keep you warm No more tug of war Now I just know there's more Know there's more No more keepin' score Now I just keep you warm Keep you warm And my waves meet your shore Ever and evermore Past me I wanna tell you not to get lost in these petty things Your nemeses Will defeat themselves before you get the chance to swing And he's passing by Rare as the glimmer of a comet in the sky And he feels like home If the shoe fits, walk in it everywhere you go And I fell from the pedestal Right down the rabbit hole Long story short, it was a bad time Pushed from the precipice Climbed right back up the cliff Long story short, I survived Now I'm all about you And now I'm all about you, ah And now I'm all about you And now I'm all about you, ah Yeah, yeah I'm all about you And now Yeah, yeah I'm all about you Long story short, it was a bad time Long story short, I survived Never be so kind You forget to be clever Never be so clever You forget to be kind And if I didn't know better I'd think you were talking to me now If I didn't know better I'd think you were still around What died didn't stay dead What died didn't stay dead You're alive, you're alive in my head What died didn't stay dead What died didn't stay dead You're alive, so alive Never be so polite You forget your power Never wield such power You forget to be polite And if I didn't know better I'd think you were listening to me now If I didn't know better I'd think you were still around What died didn't stay dead What died didn't stay dead You're alive, you're alive in my head What died didn't stay dead What died didn't stay dead You're alive, so alive The autumn chill that wakes me up You loved the amber skies so much Long limbs and frozen swims You'd always go past where our feet could touch And I complained the whole way there The car ride back and up the stairs I should've asked you questions I should've asked you how to be Asked you to write it down for me Should've kept every grocery store receipt 'Cause every scrap of you would be taken from me Watched as you signed your name Marjorie All your closets of backlogged dreams And how you left them all to me What died didn't stay dead What died didn't stay dead You're alive, you're alive in my head What died didn't stay dead What died didn't stay dead You're alive, so alive And if I didn't know better I'd think you were singing to me now If I didn't know better I'd think you were still around I know better But I still feel you all around I know better But you're still around It's been a long time And seeing the shape of your name Still spells out pain It wasn't right The way it all went down Looks like you know that now Yes, I got your letter Yes, I'm doing better It cut deep to know ya, right to the bone Yes, I got your letter Yes, I'm doing better I know that it's over, I don't need your Closure, your closure Don't treat me like Some situation that needs to be handled I'm fine with my spite And my tears, and my beers and my candles I can feel you smoothing me over Yes, I got your letter Yes, I'm doing better It cut deep to know ya, right to the bone Yes, I got your letter Yes, I'm doing better\n", "OUTPUT:\n", " It looked pretty but too late Nope! Took three days, six weeks. Wish then two years later This made me smile Dirty wet lace-knottow That has no place under those sheets There isn't any mistake what to do But trying it won't hurt anymore A feeling almost suffocating? Slowly moving So smooth my blood runs cold Or so close next thing to see how far gone My eyes glaze Over white silk sat me missing my train Here come rosas red wings Black wings black hair blue cheekbudder brown lipstick on yellow green Oh dear oh sweet! Poppy blossoms little kayaking in the quiet stream Oh ohh, ohhh...oh ah Ahooi ahanahaaaaa ahainna ain´nnggghh Oops oop ouuuh!! Not another party na haaaha! Another round yukunai daii ioi? Ok poppoppyyyyyy ma\n", "\n", "\n", "Example 3:\n", "INPUT:\n", "It's a goddamn blaze in the dark And you started it You started it So yeah, it's a war It's the goddamn fight of my life And you started it You started it Oh, I can't Stop you putting roots in my dreamland My house of stone, your ivy grows And now I'm covered In you, in you Now I'm covered in you In you And the tennis court was covered up With some tent like thing And you asked me to dance But I said, Dancin' is a dangerous game Oh, I thought This is gonna be one of those things Now I know I'm never gonna love again I've got some tricks up my sleeve Takes one to know one You're a cowboy like me Never wanted love Just a fancy car Now I'm waiting by the phone Like I'm sitting in an airport bar You had some tricks up your sleeve Takes one to know one You're a cowboy like me Perched in the dark Telling all the rich folks anything they wanna hear Like it could be love I could be the way forward Only if they pay for it You're a bandit like me Eyes full of stars Hustling for the good life Never thought I'd meet you here It could be love We could be the way forward And I know I'll pay for it You're a cowboy like me Perched in the dark Telling all the rich folks anything they wanna hear Like it could be love I could be the way forward Only if they pay for it You're a bandit like me Eyes full of stars Hustling for the good life Never thought I'd meet you here It could be love We could be the way forward And I know I'll pay for it And the skeletons in both our closets Plotted hard to fuck this up And the old men that I've swindled Really did believe I was the one And the ladies lunching have their stories about When you passed through town But that was all before I locked it down Now you hang from my lips Like the Gardens of Babylon With your boots beneath my bed Forever is the sweetest con I've had some tricks up my sleeve Takes one to know one You're a cowboy like me And I'm never gonna love again I'm never gonna love again I'm never gonna love again Fatefully I tried to pick my battles 'til the battle picked me Misery Like the war of words I shouted in my sleep And you passed right by I was in the alley, surrounded on all sides The knife cuts both ways If the shoe fits, walk in it 'til your high heels break And I fell from the pedestal Right down the rabbit hole Long story short, it was a bad time Pushed from the precipice Clung to the nearest lips Long story short, it was the wrong guy Now I'm all about you I'm all about you, ah Yeah, yeah I'm all about you, ah Yeah, yeah Actually I always felt I must look better in the rear view Missing me At the golden gates they once held the keys to When I dropped my sword I threw it in the bushes and knocked on your door And we live in peace But if someone comes at us, this time, I'm ready 'Cause I fell from the pedestal Right down the rabbit hole Long story short, it was a bad time Pushed from the precipice Clung to the nearest lips Long story short, it was the wrong guy Now I'm all about you I'm all about you, ah Yeah, yeah I'm all about you No more keepin' score Now I just keep you warm Keep you warm No more tug of war Now I just know there's more Know there's more No more keepin' score Now I just keep you warm Keep you warm And my waves meet your shore Ever and evermore Past me I wanna tell you not to get lost in these petty things Your nemeses Will defeat themselves before you get the chance to swing And he's passing by Rare as the glimmer of a comet in the sky And he feels like home If the shoe fits, walk in it everywhere you go And I fell from the pedestal Right down the rabbit hole Long story short, it was a bad time Pushed from the precipice Climbed right back up the cliff Long story short, I survived Now I'm all about you And now I'm all about you, ah And now I'm all about you And now I'm all about you, ah Yeah, yeah I'm all about you And now Yeah, yeah I'm all about you Long story short, it was a bad time Long story short, I survived Never be so kind You forget to be clever Never be so clever You forget to be kind And if I didn't know better I'd think you were talking to me now If I didn't know better I'd think you were still around What died didn't stay dead What died didn't stay dead You're alive, you're alive in my head What died didn't stay dead What died didn't stay dead You're alive, so alive Never be so polite You forget your power Never wield such power You forget to be polite And if I didn't know better I'd think you were listening to me now If I didn't know better I'd think you were still around What died didn't stay dead What died didn't stay dead You're alive, you're alive in my head What died didn't stay dead What died didn't stay dead You're alive, so alive The autumn chill that wakes me up You loved the amber skies so much Long limbs and frozen swims You'd always go past where our feet could touch And I complained the whole way there The car ride back and up the stairs I should've asked you questions I should've asked you how to be Asked you to write it down for me Should've kept every grocery store receipt 'Cause every scrap of you would be taken from me Watched as you signed your name Marjorie All your closets of backlogged dreams And how you left them all to me What died didn't stay dead What died didn't stay dead You're alive, you're alive in my head What died didn't stay dead What died didn't stay dead You're alive, so alive And if I didn't know better I'd think you were singing to me now If I didn't know better I'd think you were still around I know better But I still feel you all around I know better But you're still around It's been a long time\n", "OUTPUT:\n", " since anybody has seen me Before anyone'seen Me with blue eyes A lotta redness He gets caught twice when his wings beat away They come close As soon sometime Anywhere anytime anywhere Reddy girl For you, ladyfriend Love ain'da hit everything clean But something unsaid means nothing no doubt you betrayed That wasn't who you knew but now see yow best friend Is really tired? So why do I hide Where my friends kiss I kiss out loudly Nothin' else could happen. Lines across your canvas Layers overlinе eachother Sometimes things fall apart Don; tha\\; she lik ean\\you d\\'oh I need a bigger pound loaf A big baggy purple ball in it Wiggle-Wriggl glabbehte hahahahaa She doesn’thi€« make cute sho**girl girls Gine yoù hyeuh! Ahhhhaaa halle\n", "\n", "\n", "Example 4:\n", "INPUT:\n", "All your closets of backlogged dreams And how you left them all to me What died didn't stay dead What died didn't stay dead You're alive, you're alive in my head What died didn't stay dead What died didn't stay dead You're alive, so alive And if I didn't know better I'd think you were singing to me now If I didn't know better I'd think you were still around I know better But I still feel you all around I know better But you're still around It's been a long time And seeing the shape of your name Still spells out pain It wasn't right The way it all went down Looks like you know that now Yes, I got your letter Yes, I'm doing better It cut deep to know ya, right to the bone Yes, I got your letter Yes, I'm doing better I know that it's over, I don't need your Closure, your closure Don't treat me like Some situation that needs to be handled I'm fine with my spite And my tears, and my beers and my candles I can feel you smoothing me over Yes, I got your letter Yes, I'm doing better It cut deep to know ya, right to the bone Yes, I got your letter Yes, I'm doing better I know that it's over, I don't need your Closure, your closure Your closure, your closure I know I'm just a wrinkle in your new life Staying friends would iron it out so nice Guilty, guilty, reaching out across the sea That you put between you and me But it's fake and it's oh so unnecessary Yes, I got your letter Yes, I'm doing better It cut deep to know ya, right to the bone Yes, I got your letter Yes, I'm doing better I know that it's over, I don't need your Closure, closure, your closure Your closure Gray November I've been down since July Motion capture Put me in a bad light I replay my footsteps on each stepping stone Trying to find the one where I went wrong Writing letters Addressed to the fire And I was catching my breath Staring out an open window Catching my death And I couldn't be sure I had a feeling so peculiar That this pain would be for Evermore Hey December Guess I'm feeling unmoored Can't remember What I used to fight for I rewind the tape, but all it does is pause On the very moment all was lost Sending signals To be double crossed And I was catching my breath Barefoot in the wildest winter Catching my death And I couldn't be sure I had a feeling so peculiar That this pain would be for Evermore Evermore Can't not think of all the cost And the things that will be lost Oh, can we just get a pause? To be certain, we'll be tall again Whether weather be the frost Or the violence of the dog days I'm on waves, out being tossed Is there a line that I could just go cross? And when I was shipwrecked Can't think of all the cost I thought of you All the things that will be lost now In the cracks of light Can we just get a pause? I dreamed of you To be certain we'll be tall again, if you think of all the costs It was real enough Whether weather be the frost To get me through Or the violence of the dog days Or the violence of the dog days Out on waves, being tossed I'm on waves, out being tossed I swear Is there a line that we can just go cross? You were there And I was catching my breath Floors of a cabin creaking under my step And I couldn't be sure I had a feeling so peculiar This pain wouldn't be for Evermore Evermore Evermore This pain wouldn't be for evermore Evermore Friends break up, friends get married Strangers get born, strangers get buried Trends change, rumors fly through new skies But I'm right where you left me Matches burn after the other Pages turn and stick to each other Wages earned and lessons learned But I, I'm right where you left me Help, I'm still at the restaurant Still sitting in a corner I haunt Cross legged in the dim light They say, What a sad sight I, I swear you could hear a hair pin drop Right when I felt the moment stop Glass shattered on the white cloth Everybody moved on, I, I stayed there Dust collected on my pinned up hair They expected me to find somewhere Some perspective, but I sat and stared Right where you left me You left me no, you left me no You left me no choice but to stay here forever You left me, you left me no, oh, you left me no You left me no choice but to stay here forever Did you ever hear about the girl who got frozen? Time went on for everybody else, she won't know it She's still twenty three inside her fantasy How it was supposed to be Did you hear about the girl who lives in delusion? Breakups happen every day, you don't have to lose it She's still twenty three inside her fantasy And you're sitting in front of me At the restaurant when I was still the one you want Cross legged in the dim light, everything was just right I, I could feel the mascara run You told me that you met someone Glass shattered on the white cloth Everybody moved on Help, I'm still at the restaurant Still sitting in a corner I haunt Cross legged in the dim light They say, What a sad sight I, I stayed there Dust collected on my pinned up hair I'm sure that you got a wife out there Kids and Christmas, but I'm unaware 'Cause I'm right where I cause no harm Mind my business If our love died young I can't bear witness And it's been so long But if you ever think you got it wrong I'm right where You left me You left me no, oh, you left me no You left me no choice but to stay here forever You left me You left me no, oh, you left me no You left me no choice but to stay here forever When the dinner is cold and the chatter gets old You ask for the tab Or that moment again, he's insisting that friends Look at each other like that When the words of a sister come back in whispers That prove she was not in fact what she seemed Not a twin from your dreams She's a crook who was caught That old familiar body ache The snaps from the same little breaks in your soul You know when it's time to go Twenty years at your job Then the son of the boss gets the spot that was yours Or trying to stay for the kids When keeping it how it is will only break their hearts worse That old familiar body ache The snaps from the same little breaks in your soul You know when it's time to go Sometimes giving up is the strong thing Sometimes to run is the brave thing Sometimes walking out is the one thing That will find you the right thing Sometimes giving up is the strong thing Sometimes to run is the brave thing Sometimes walking out is the one thing\n", "OUTPUT:\n", " No longer must we stand Watcher in place watcha do I see the eyes they are never more then blinking lights From another room, they walk away as nothing happened Why canceled wedding made simple After getting engaged Just before telling everyone off One last kiss Before I knew why He walked softly home His arms wide Open ended by ghosted night Never knowing what waited too late There comes breaking sunshine Here stands his daughter Who called him once Now seems too much, yet well isn’twistling it did something amaze yourself Wherever she led A caravan has driven down to join us\\“Daddy said”But those boys hides gone blue Oppression is wicked \\He screamed loud\\\"You’re going broke!\\”Now it looks black\\The hotter you drink,\\They dance round at losing money on dads-date and marriage We are talking bout dad drinking tonight<\\/\\{\\}\\_\\=\\\\\\__=-~\n", "\n", "\n", "Example 5:\n", "INPUT:\n", "Now you hang from my lips Like the Gardens of Babylon With your boots beneath my bed Forever is the sweetest con I've had some tricks up my sleeve Takes one to know one You're a cowboy like me And I'm never gonna love again I'm never gonna love again I'm never gonna love again Fatefully I tried to pick my battles 'til the battle picked me Misery Like the war of words I shouted in my sleep And you passed right by I was in the alley, surrounded on all sides The knife cuts both ways If the shoe fits, walk in it 'til your high heels break And I fell from the pedestal Right down the rabbit hole Long story short, it was a bad time Pushed from the precipice Clung to the nearest lips Long story short, it was the wrong guy Now I'm all about you I'm all about you, ah Yeah, yeah I'm all about you, ah Yeah, yeah Actually I always felt I must look better in the rear view Missing me At the golden gates they once held the keys to When I dropped my sword I threw it in the bushes and knocked on your door And we live in peace But if someone comes at us, this time, I'm ready 'Cause I fell from the pedestal Right down the rabbit hole Long story short, it was a bad time Pushed from the precipice Clung to the nearest lips Long story short, it was the wrong guy Now I'm all about you I'm all about you, ah Yeah, yeah I'm all about you No more keepin' score Now I just keep you warm Keep you warm No more tug of war Now I just know there's more Know there's more No more keepin' score Now I just keep you warm Keep you warm And my waves meet your shore Ever and evermore Past me I wanna tell you not to get lost in these petty things Your nemeses Will defeat themselves before you get the chance to swing And he's passing by Rare as the glimmer of a comet in the sky And he feels like home If the shoe fits, walk in it everywhere you go And I fell from the pedestal Right down the rabbit hole Long story short, it was a bad time Pushed from the precipice Climbed right back up the cliff Long story short, I survived Now I'm all about you And now I'm all about you, ah And now I'm all about you And now I'm all about you, ah Yeah, yeah I'm all about you And now Yeah, yeah I'm all about you Long story short, it was a bad time Long story short, I survived Never be so kind You forget to be clever Never be so clever You forget to be kind And if I didn't know better I'd think you were talking to me now If I didn't know better I'd think you were still around What died didn't stay dead What died didn't stay dead You're alive, you're alive in my head What died didn't stay dead What died didn't stay dead You're alive, so alive Never be so polite You forget your power Never wield such power You forget to be polite And if I didn't know better I'd think you were listening to me now If I didn't know better I'd think you were still around What died didn't stay dead What died didn't stay dead You're alive, you're alive in my head What died didn't stay dead What died didn't stay dead You're alive, so alive The autumn chill that wakes me up You loved the amber skies so much Long limbs and frozen swims You'd always go past where our feet could touch And I complained the whole way there The car ride back and up the stairs I should've asked you questions I should've asked you how to be Asked you to write it down for me Should've kept every grocery store receipt 'Cause every scrap of you would be taken from me Watched as you signed your name Marjorie All your closets of backlogged dreams And how you left them all to me What died didn't stay dead What died didn't stay dead You're alive, you're alive in my head What died didn't stay dead What died didn't stay dead You're alive, so alive And if I didn't know better I'd think you were singing to me now If I didn't know better I'd think you were still around I know better But I still feel you all around I know better But you're still around It's been a long time And seeing the shape of your name Still spells out pain It wasn't right The way it all went down Looks like you know that now Yes, I got your letter Yes, I'm doing better It cut deep to know ya, right to the bone Yes, I got your letter Yes, I'm doing better I know that it's over, I don't need your Closure, your closure Don't treat me like Some situation that needs to be handled I'm fine with my spite And my tears, and my beers and my candles I can feel you smoothing me over Yes, I got your letter Yes, I'm doing better It cut deep to know ya, right to the bone Yes, I got your letter Yes, I'm doing better I know that it's over, I don't need your Closure, your closure Your closure, your closure I know I'm just a wrinkle in your new life Staying friends would iron it out so nice Guilty, guilty, reaching out across the sea That you put between you and me But it's fake and it's oh so unnecessary Yes, I got your letter Yes, I'm doing better It cut deep to know ya, right to the bone Yes, I got your letter Yes, I'm doing better I know that it's over, I don't need your Closure, closure, your closure Your closure Gray November I've been down since July Motion capture Put me in a bad light I replay my footsteps on each stepping stone Trying to find the one where I went wrong Writing letters Addressed to the fire And I was catching my breath Staring out an open window Catching my death And I couldn't be sure I had a feeling so peculiar That this pain would be for Evermore Hey December Guess I'm feeling unmoored Can't remember What I used to fight for I rewind the tape, but all it does is pause On the very moment all was lost Sending signals To be double crossed And I was catching my breath Barefoot in the wildest winter Catching my death\n", "OUTPUT:\n", " and depressed So perfect I wanted him or I knew There was depth, who knows the other side? Ah oh oh ahhhhh Hahhaaohaaa Just let her free (That she will become...) How easy those days when you spent away to die a second later I remembered what gave rise A woman turned herself into a beautiful hobgawker Into nothing good For Goddess Gather round my throne My seat may lack comforting features We come here looking down at Her face only two hearts Warm hands against cold breasts 278 miles separated They might see their beauty as red thread. Making noises heard Every eye seen blue night dad sees in mirror Always makes sense Oh, oh, oh, Oh-oh\n", "So awkward you were playing games She made fun of his lamentations you did make something up Loud voice: Shut down! Hehe Hello girlfriend why are u da… hahaha hurray hihi I\n", "\n", "\n" ] } ] }, { "cell_type": "markdown", "source": [ "# 🗣️ What's Next" ], "metadata": { "id": "mGzP7pUQ9yg-" } }, { "cell_type": "markdown", "source": [ "### 😭 But the lyrics don't make sense?????" ], "metadata": { "id": "F0N6qhPO1HSf" } }, { "cell_type": "markdown", "source": [ "Even though we've already fine-tuned the model on a dataset of song lyrics, the generated output should ideally be more coherent and relevant to Taylor Swift.\n", "\n", "\n", "There could be a few reasons for this:\n", "\n", "* **Insufficient fine-tuning**\n", "\n", "Depending on the size and quality of your fine-tuning dataset, the model may require more training to effectively capture the patterns and styles of song lyrics. Fine-tuning for a longer duration or with a larger dataset may help improve the model's performance.\n", "\n", "\n", "* **Overfitting**\n", "\n", "If the fine-tuning dataset is small or not diverse enough, the model may overfit to the specific examples in the dataset. This can lead to the model generating lyrics that are too similar to the training data or not generalizing well to new inputs.\n", "\n", "\n", "\n", "* **Model architecture limitations**\n", "\n", "The TinyLlama model architecture may have limitations in capturing the complexities and nuances of song lyrics. Some nonsense or incoherent output may be inherent to the model's design and capacity." ], "metadata": { "id": "C1R4nkk20_cG" } }, { "cell_type": "markdown", "source": [ "### 🤔 So what can we do instead?" ], "metadata": { "id": "rmV4PN471wQ5" } }, { "cell_type": "markdown", "source": [ "Try the following:\n", "\n", "* **`Expand and diversify the fine-tuning dataset`**\n", "\n", "Ensure that your fine-tuning dataset is large enough and covers a wide range of song styles, themes, and vocabularies. A diverse dataset can help the model learn more robust and generalizable patterns.\n", "\n", "* **`Adjust fine-tuning hyperparameters`**\n", "\n", "Experiment with different hyperparameters during fine-tuning, such as learning rate, batch size, and number of epochs. Fine-tuning with optimal hyperparameters can help the model better adapt to the song lyrics domain.\n", "\n", "* **`Implement post-processing techniques`**\n", "\n", "As mentioned earlier, applying post-processing techniques to filter out or modify nonsensical parts can help improve the quality of the generated lyrics. This can include removing or replacing specific words, applying language rules, or using semantic similarity measures.\n", "\n", "* **`Use a different model architecture`**\n", "\n", "If the TinyLlama model consistently produces nonsensical output even after fine-tuning, it may be worth exploring alternative model architectures that are better suited for creative text generation, such as transformer-based models like GPT-2 or GPT-3.\n", "\n", "* **`Combine multiple approaches`**\n", "\n", "Integrating fine-tuned models with other techniques, such as template-based generation, rule-based generation, or retrieval-based generation, can help provide a framework or structure for the generated lyrics while leveraging the model's creativity.\n", "\n", "* **`Iterative refinement`**\n", "\n", "Treat the generated lyrics as a starting point and iteratively refine them through human curation and editing. Identify the most promising parts, make necessary modifications, and use them as inspiration for further generation or manual refinement." ], "metadata": { "id": "DbsHCu_93EDR" } } ] }