File size: 57,681 Bytes
68949a6 |
1 |
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[{"file_id":"https://huggingface.co/datasets/prithivMLmods/FinetuneRT-Colab/blob/main/SmolLM-FT/SmolLM-FT-360M.ipynb","timestamp":1736141292536}],"gpuType":"T4"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"},"accelerator":"GPU","widgets":{"application/vnd.jupyter.widget-state+json":{"a40c6e4882a545e8b936d0fa8a5a91fd":{"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_9d665860468341d6a335cf9012eee627","IPY_MODEL_a0ddc2798b2c4e38a37b4400e1379a3e","IPY_MODEL_1ca3c6c799434297b2185c6d942e3ede"],"layout":"IPY_MODEL_021439b901b8462bbf9e4c20fbda4fea"}},"9d665860468341d6a335cf9012eee627":{"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_bbf54b9c8a414eacbe35c889017ae8e2","placeholder":"","style":"IPY_MODEL_f3f595dfc6e04c22ade594437dc50e0c","value":"README.md: 100%"}},"a0ddc2798b2c4e38a37b4400e1379a3e":{"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_3ad483f1bd13480d85bc3354024b0646","max":1778,"min":0,"orientation":"horizontal","style":"IPY_MODEL_ecd284b555114675b741fd26021cc15d","value":1778}},"1ca3c6c799434297b2185c6d942e3ede":{"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_ad85efeda66543f2955d4ec43981b01d","placeholder":"","style":"IPY_MODEL_d8c5eca35e574428976c159ec08333ed","value":" 1.78k/1.78k [00:00<00:00, 37.8kB/s]"}},"021439b901b8462bbf9e4c20fbda4fea":{"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}},"bbf54b9c8a414eacbe35c889017ae8e2":{"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}},"f3f595dfc6e04c22ade594437dc50e0c":{"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":""}},"3ad483f1bd13480d85bc3354024b0646":{"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}},"ecd284b555114675b741fd26021cc15d":{"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":""}},"ad85efeda66543f2955d4ec43981b01d":{"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}},"d8c5eca35e574428976c159ec08333ed":{"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":""}},"c64b6c4d4c4644098d1df159e19b670d":{"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_3e2aba2a64534493a0d9479d2e5bccde","IPY_MODEL_846acb796ae04ed899113220f0048ba1","IPY_MODEL_a2703ad18b69435b8f1c245921d4df39"],"layout":"IPY_MODEL_4233c08088384ac0b5e11eae60eeb4e9"}},"3e2aba2a64534493a0d9479d2e5bccde":{"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_2e20fe76044b44d090d36edcfee96a68","placeholder":"","style":"IPY_MODEL_39da91d9ccc74a43af3e5910b90e2107","value":"dataset/dataset_deepthink-lcot2.json: 100%"}},"846acb796ae04ed899113220f0048ba1":{"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_fecca0a7653e4e1db4a5c696c156a7be","max":990533,"min":0,"orientation":"horizontal","style":"IPY_MODEL_a43eac14e8064714a09d345fa4545d90","value":990533}},"a2703ad18b69435b8f1c245921d4df39":{"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_79025234bb7b4ec196c71490fe86b08e","placeholder":"","style":"IPY_MODEL_a1958264b031478298ac99dbc47eef8a","value":" 991k/991k [00:00<00:00, 4.32MB/s]"}},"4233c08088384ac0b5e11eae60eeb4e9":{"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}},"2e20fe76044b44d090d36edcfee96a68":{"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}},"39da91d9ccc74a43af3e5910b90e2107":{"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":""}},"fecca0a7653e4e1db4a5c696c156a7be":{"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}},"a43eac14e8064714a09d345fa4545d90":{"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":""}},"79025234bb7b4ec196c71490fe86b08e":{"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}},"a1958264b031478298ac99dbc47eef8a":{"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":""}},"919f2388e16a4b5bb2b242a4b00cdfcd":{"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_2bf0f181a3e64addad470e43f04efc75","IPY_MODEL_2ffe723081424310a43646560f178f27","IPY_MODEL_c7183c6df401468ba2c6ad315f68ddce"],"layout":"IPY_MODEL_2afc8162506845669c42aab0d3575781"}},"2bf0f181a3e64addad470e43f04efc75":{"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_09235f55fa814f8a9fe052288d65db51","placeholder":"","style":"IPY_MODEL_d566a5bfa98a4b17b978a19e37e65303","value":"Generating train split: 100%"}},"2ffe723081424310a43646560f178f27":{"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_9fdb28cfd51147ddbb2240decc757fc4","max":251,"min":0,"orientation":"horizontal","style":"IPY_MODEL_95f7232ff29e47f4beb62a4ffec65081","value":251}},"c7183c6df401468ba2c6ad315f68ddce":{"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_cb290bbab97045eb944b3c50d19d4ca2","placeholder":"","style":"IPY_MODEL_1ac5ac4aab954d6da62f5ee69ab04121","value":" 251/251 [00:00<00:00, 1282.47 examples/s]"}},"2afc8162506845669c42aab0d3575781":{"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}},"09235f55fa814f8a9fe052288d65db51":{"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}},"d566a5bfa98a4b17b978a19e37e65303":{"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":""}},"9fdb28cfd51147ddbb2240decc757fc4":{"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}},"95f7232ff29e47f4beb62a4ffec65081":{"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":""}},"cb290bbab97045eb944b3c50d19d4ca2":{"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}},"1ac5ac4aab954d6da62f5ee69ab04121":{"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":""}},"c0b04028da10458496a6fe7e09540a21":{"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_815ff88b91134a8b8650c7bf2fe51041","IPY_MODEL_7423c9e731324c5b9390e19d49261928","IPY_MODEL_43c577781f0c4e8d8ce51c471a0c73c1"],"layout":"IPY_MODEL_9fd158732e8c486d88438fb1b07e89b1"}},"815ff88b91134a8b8650c7bf2fe51041":{"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_b5fb14bda3b14f659c2f32d43a79e72c","placeholder":"","style":"IPY_MODEL_dac01cb59a804b65a619b32d5d0df857","value":"Map: 100%"}},"7423c9e731324c5b9390e19d49261928":{"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_73ea95da05f94dc38d240aed8fe537a2","max":251,"min":0,"orientation":"horizontal","style":"IPY_MODEL_e559bf6841734617a4f6ad0c9474199f","value":251}},"43c577781f0c4e8d8ce51c471a0c73c1":{"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_958c529a782c4473b53ba4fa98441449","placeholder":"","style":"IPY_MODEL_3b2e34d639454b9b8136af02ae2ac5c2","value":" 251/251 [00:01<00:00, 158.95 examples/s]"}},"9fd158732e8c486d88438fb1b07e89b1":{"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}},"b5fb14bda3b14f659c2f32d43a79e72c":{"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}},"dac01cb59a804b65a619b32d5d0df857":{"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":""}},"73ea95da05f94dc38d240aed8fe537a2":{"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}},"e559bf6841734617a4f6ad0c9474199f":{"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":""}},"958c529a782c4473b53ba4fa98441449":{"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}},"3b2e34d639454b9b8136af02ae2ac5c2":{"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":"code","execution_count":2,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"vgSESDvcimkH","executionInfo":{"status":"ok","timestamp":1736140625278,"user_tz":-330,"elapsed":6701,"user":{"displayName":"","userId":""}},"outputId":"d73de94f-e68e-4a5c-eba0-c368fc1a0e30"},"outputs":[{"output_type":"stream","name":"stdout","text":["Requirement already satisfied: transformers in /usr/local/lib/python3.10/dist-packages (4.47.1)\n","Requirement already satisfied: datasets in /usr/local/lib/python3.10/dist-packages (3.2.0)\n","Requirement already satisfied: trl in /usr/local/lib/python3.10/dist-packages (0.13.0)\n","Requirement already satisfied: torch in /usr/local/lib/python3.10/dist-packages (2.5.1+cu121)\n","Requirement already satisfied: accelerate in /usr/local/lib/python3.10/dist-packages (1.2.1)\n","Requirement already satisfied: bitsandbytes in /usr/local/lib/python3.10/dist-packages (0.45.0)\n","Requirement already satisfied: wandb in /usr/local/lib/python3.10/dist-packages (0.19.1)\n","Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from transformers) (3.16.1)\n","Requirement already satisfied: huggingface-hub<1.0,>=0.24.0 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.27.0)\n","Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (1.26.4)\n","Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from transformers) (24.2)\n","Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (6.0.2)\n","Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (2024.11.6)\n","Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from transformers) (2.32.3)\n","Requirement already satisfied: tokenizers<0.22,>=0.21 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.21.0)\n","Requirement already satisfied: safetensors>=0.4.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.4.5)\n","Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.10/dist-packages (from transformers) (4.67.1)\n","Requirement already satisfied: pyarrow>=15.0.0 in /usr/local/lib/python3.10/dist-packages (from datasets) (17.0.0)\n","Requirement already satisfied: dill<0.3.9,>=0.3.0 in /usr/local/lib/python3.10/dist-packages (from datasets) (0.3.8)\n","Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from datasets) (2.2.2)\n","Requirement already satisfied: xxhash in /usr/local/lib/python3.10/dist-packages (from datasets) (3.5.0)\n","Requirement already satisfied: multiprocess<0.70.17 in /usr/local/lib/python3.10/dist-packages (from datasets) (0.70.16)\n","Requirement already satisfied: fsspec<=2024.9.0,>=2023.1.0 in /usr/local/lib/python3.10/dist-packages (from fsspec[http]<=2024.9.0,>=2023.1.0->datasets) (2024.9.0)\n","Requirement already satisfied: aiohttp in /usr/local/lib/python3.10/dist-packages (from datasets) (3.11.10)\n","Requirement already satisfied: rich in /usr/local/lib/python3.10/dist-packages (from trl) (13.9.4)\n","Requirement already satisfied: typing-extensions>=4.8.0 in /usr/local/lib/python3.10/dist-packages (from torch) (4.12.2)\n","Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch) (3.4.2)\n","Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch) (3.1.4)\n","Requirement already satisfied: sympy==1.13.1 in /usr/local/lib/python3.10/dist-packages (from torch) (1.13.1)\n","Requirement already satisfied: mpmath<1.4,>=1.1.0 in /usr/local/lib/python3.10/dist-packages (from sympy==1.13.1->torch) (1.3.0)\n","Requirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from accelerate) (5.9.5)\n","Requirement already satisfied: click!=8.0.0,>=7.1 in /usr/local/lib/python3.10/dist-packages (from wandb) (8.1.7)\n","Requirement already satisfied: docker-pycreds>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from wandb) (0.4.0)\n","Requirement already satisfied: gitpython!=3.1.29,>=1.0.0 in /usr/local/lib/python3.10/dist-packages (from wandb) (3.1.43)\n","Requirement already satisfied: platformdirs in /usr/local/lib/python3.10/dist-packages (from wandb) (4.3.6)\n","Requirement already satisfied: protobuf!=4.21.0,!=5.28.0,<6,>=3.19.0 in /usr/local/lib/python3.10/dist-packages (from wandb) (4.25.5)\n","Requirement already satisfied: pydantic<3,>=2.6 in /usr/local/lib/python3.10/dist-packages (from wandb) (2.10.3)\n","Requirement already satisfied: sentry-sdk>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from wandb) (2.19.2)\n","Requirement already satisfied: setproctitle in /usr/local/lib/python3.10/dist-packages (from wandb) (1.3.4)\n","Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (from wandb) (75.1.0)\n","Requirement already satisfied: six>=1.4.0 in /usr/local/lib/python3.10/dist-packages (from docker-pycreds>=0.4.0->wandb) (1.17.0)\n","Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (2.4.4)\n","Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.3.2)\n","Requirement already satisfied: async-timeout<6.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (4.0.3)\n","Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (24.3.0)\n","Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.5.0)\n","Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (6.1.0)\n","Requirement already satisfied: propcache>=0.2.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (0.2.1)\n","Requirement already satisfied: yarl<2.0,>=1.17.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.18.3)\n","Requirement already satisfied: gitdb<5,>=4.0.1 in /usr/local/lib/python3.10/dist-packages (from gitpython!=3.1.29,>=1.0.0->wandb) (4.0.11)\n","Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.10/dist-packages (from pydantic<3,>=2.6->wandb) (0.7.0)\n","Requirement already satisfied: pydantic-core==2.27.1 in /usr/local/lib/python3.10/dist-packages (from pydantic<3,>=2.6->wandb) (2.27.1)\n","Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (3.4.0)\n","Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (3.10)\n","Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (2.2.3)\n","Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (2024.12.14)\n","Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->torch) (3.0.2)\n","Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.10/dist-packages (from pandas->datasets) (2.8.2)\n","Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->datasets) (2024.2)\n","Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.10/dist-packages (from pandas->datasets) (2024.2)\n","Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.10/dist-packages (from rich->trl) (3.0.0)\n","Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.10/dist-packages (from rich->trl) (2.18.0)\n","Requirement already satisfied: smmap<6,>=3.0.1 in /usr/local/lib/python3.10/dist-packages (from gitdb<5,>=4.0.1->gitpython!=3.1.29,>=1.0.0->wandb) (5.0.1)\n","Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.10/dist-packages (from markdown-it-py>=2.2.0->rich->trl) (0.1.2)\n"]}],"source":["# Install required libraries\n","!pip install transformers datasets trl torch accelerate bitsandbytes wandb"]},{"cell_type":"code","source":["# Import necessary modules\n","from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments, pipeline\n","from datasets import load_dataset\n","from trl import SFTConfig, SFTTrainer, setup_chat_format\n","import torch\n","import os\n","\n","# Detect device (GPU, MPS, or CPU)\n","device = (\n"," \"cuda\"\n"," if torch.cuda.is_available()\n"," else \"mps\" if torch.backends.mps.is_available() else \"cpu\"\n",")"],"metadata":{"id":"n1KQTqFojKgt","executionInfo":{"status":"ok","timestamp":1736140666401,"user_tz":-330,"elapsed":40372,"user":{"displayName":"","userId":""}}},"execution_count":3,"outputs":[]},{"cell_type":"markdown","source":["***Quick Check For Resources - Runtime***"],"metadata":{"id":"Ou4qDQJ2mHHJ"}},{"cell_type":"code","source":["!nvidia-smi"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"8kKAUzEilylH","executionInfo":{"status":"ok","timestamp":1736140668781,"user_tz":-330,"elapsed":804,"user":{"displayName":"","userId":""}},"outputId":"a413ef39-30e9-4b01-8ea2-0408ab72b7ed"},"execution_count":4,"outputs":[{"output_type":"stream","name":"stdout","text":["Mon Jan 6 05:17:49 2025 \n","+---------------------------------------------------------------------------------------+\n","| NVIDIA-SMI 535.104.05 Driver Version: 535.104.05 CUDA Version: 12.2 |\n","|-----------------------------------------+----------------------+----------------------+\n","| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |\n","| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |\n","| | | MIG M. |\n","|=========================================+======================+======================|\n","| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |\n","| N/A 53C P8 10W / 70W | 3MiB / 15360MiB | 0% Default |\n","| | | N/A |\n","+-----------------------------------------+----------------------+----------------------+\n"," \n","+---------------------------------------------------------------------------------------+\n","| Processes: |\n","| GPU GI CI PID Type Process name GPU Memory |\n","| ID ID Usage |\n","|=======================================================================================|\n","| No running processes found |\n","+---------------------------------------------------------------------------------------+\n"]}]},{"cell_type":"code","source":["from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline\n","\n","model_name = \"HuggingFaceTB/SmolLM2-135M-Instruct\"\n","model = AutoModelForCausalLM.from_pretrained(pretrained_model_name_or_path=model_name)\n","tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path=model_name)\n","\n","tokenizer.chat_template = None\n","\n","from trl.models.utils import setup_chat_format\n","model, tokenizer = setup_chat_format(model=model, tokenizer=tokenizer)\n","\n","prompt = \"Explain AGI?\"\n","pipe = pipeline(\"text-generation\", model=model, tokenizer=tokenizer, device=0)\n","print(pipe(prompt, max_new_tokens=200))\n"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"04ilYLXSjc32","executionInfo":{"status":"ok","timestamp":1736140721586,"user_tz":-330,"elapsed":5953,"user":{"displayName":"","userId":""}},"outputId":"54538740-9e21-4217-a052-8188d0b44b7f"},"execution_count":6,"outputs":[{"output_type":"stream","name":"stderr","text":["Device set to use cuda:0\n"]},{"output_type":"stream","name":"stdout","text":["[{'generated_text': 'Explain AGI?'}]\n"]}]},{"cell_type":"code","source":["# Load the dataset\n","ds = load_dataset(\"prithivMLmods/Deepthink-Reasoning\")\n","\n","# Tokenization function with batch handling\n","def tokenize_function(examples):\n"," # Apply strip to each string in the batch\n"," prompts = [p.strip() for p in examples[\"prompt\"]]\n"," responses = [r.strip() for r in examples[\"response\"]]\n","\n"," # Apply chat template for each prompt-response pair\n"," texts = [\n"," tokenizer.apply_chat_template(\n"," [{\"role\": \"user\", \"content\": p}, {\"role\": \"assistant\", \"content\": r}],\n"," tokenize=False\n"," )\n"," for p, r in zip(prompts, responses)\n"," ]\n","\n"," # Tokenize the combined texts\n"," return tokenizer(texts, truncation=True, padding=\"max_length\", max_length=512)\n","\n","# Apply the tokenization function to the dataset\n","ds = ds.map(tokenize_function, batched=True)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":145,"referenced_widgets":["a40c6e4882a545e8b936d0fa8a5a91fd","9d665860468341d6a335cf9012eee627","a0ddc2798b2c4e38a37b4400e1379a3e","1ca3c6c799434297b2185c6d942e3ede","021439b901b8462bbf9e4c20fbda4fea","bbf54b9c8a414eacbe35c889017ae8e2","f3f595dfc6e04c22ade594437dc50e0c","3ad483f1bd13480d85bc3354024b0646","ecd284b555114675b741fd26021cc15d","ad85efeda66543f2955d4ec43981b01d","d8c5eca35e574428976c159ec08333ed","c64b6c4d4c4644098d1df159e19b670d","3e2aba2a64534493a0d9479d2e5bccde","846acb796ae04ed899113220f0048ba1","a2703ad18b69435b8f1c245921d4df39","4233c08088384ac0b5e11eae60eeb4e9","2e20fe76044b44d090d36edcfee96a68","39da91d9ccc74a43af3e5910b90e2107","fecca0a7653e4e1db4a5c696c156a7be","a43eac14e8064714a09d345fa4545d90","79025234bb7b4ec196c71490fe86b08e","a1958264b031478298ac99dbc47eef8a","919f2388e16a4b5bb2b242a4b00cdfcd","2bf0f181a3e64addad470e43f04efc75","2ffe723081424310a43646560f178f27","c7183c6df401468ba2c6ad315f68ddce","2afc8162506845669c42aab0d3575781","09235f55fa814f8a9fe052288d65db51","d566a5bfa98a4b17b978a19e37e65303","9fdb28cfd51147ddbb2240decc757fc4","95f7232ff29e47f4beb62a4ffec65081","cb290bbab97045eb944b3c50d19d4ca2","1ac5ac4aab954d6da62f5ee69ab04121","c0b04028da10458496a6fe7e09540a21","815ff88b91134a8b8650c7bf2fe51041","7423c9e731324c5b9390e19d49261928","43c577781f0c4e8d8ce51c471a0c73c1","9fd158732e8c486d88438fb1b07e89b1","b5fb14bda3b14f659c2f32d43a79e72c","dac01cb59a804b65a619b32d5d0df857","73ea95da05f94dc38d240aed8fe537a2","e559bf6841734617a4f6ad0c9474199f","958c529a782c4473b53ba4fa98441449","3b2e34d639454b9b8136af02ae2ac5c2"]},"id":"uJrzC756jvBu","executionInfo":{"status":"ok","timestamp":1736140735366,"user_tz":-330,"elapsed":7600,"user":{"displayName":"","userId":""}},"outputId":"f61a3ff2-fd9d-49a0-8d1a-ea3b9922f4e1"},"execution_count":7,"outputs":[{"output_type":"display_data","data":{"text/plain":["README.md: 0%| | 0.00/1.78k [00:00<?, ?B/s]"],"application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"a40c6e4882a545e8b936d0fa8a5a91fd"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":["dataset/dataset_deepthink-lcot2.json: 0%| | 0.00/991k [00:00<?, ?B/s]"],"application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"c64b6c4d4c4644098d1df159e19b670d"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":["Generating train split: 0%| | 0/251 [00:00<?, ? examples/s]"],"application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"919f2388e16a4b5bb2b242a4b00cdfcd"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":["Map: 0%| | 0/251 [00:00<?, ? examples/s]"],"application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"c0b04028da10458496a6fe7e09540a21"}},"metadata":{}}]},{"cell_type":"code","source":["use_bf16 = torch.cuda.is_bf16_supported()\n","\n","# Prepare training arguments\n","training_args = TrainingArguments(\n"," per_device_train_batch_size=2,\n"," gradient_accumulation_steps=4,\n"," warmup_steps=5,\n"," max_steps=60, # Adjust max_steps as needed\n"," learning_rate=5e-5,\n"," fp16=not use_bf16, # Use fp16 if bf16 is not supported\n"," bf16=use_bf16, # Use bf16 if supported\n"," logging_steps=1,\n"," optim=\"adamw_8bit\",\n"," weight_decay=0.01,\n"," lr_scheduler_type=\"linear\",\n"," seed=3407,\n"," output_dir=\"outputs\",\n"," report_to=\"none\", # Use 'wandb' or 'tensorboard' if needed or pass 'none'\n",")\n","\n","# Initialize the SFTTrainer\n","trainer = SFTTrainer(\n"," model=model,\n"," processing_class=tokenizer, # Use tokenizer as processing_class\n"," train_dataset=ds[\"train\"], # Train dataset\n"," args=training_args, # Pass the training arguments\n",")"],"metadata":{"id":"lcqd78Znj1Eu","executionInfo":{"status":"ok","timestamp":1736140769244,"user_tz":-330,"elapsed":2,"user":{"displayName":"","userId":""}}},"execution_count":9,"outputs":[]},{"cell_type":"code","source":["# Start training\n","trainer.train()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":1000},"id":"aXwPm-m1j-Lm","executionInfo":{"status":"ok","timestamp":1736140903206,"user_tz":-330,"elapsed":130243,"user":{"displayName":"","userId":""}},"outputId":"0ad4496b-b2e9-4f39-97aa-c989d1a64b4c"},"execution_count":10,"outputs":[{"output_type":"display_data","data":{"text/plain":["<IPython.core.display.HTML object>"],"text/html":["\n"," <div>\n"," \n"," <progress value='60' max='60' style='width:300px; height:20px; vertical-align: middle;'></progress>\n"," [60/60 02:06, Epoch 1/2]\n"," </div>\n"," <table border=\"1\" class=\"dataframe\">\n"," <thead>\n"," <tr style=\"text-align: left;\">\n"," <th>Step</th>\n"," <th>Training Loss</th>\n"," </tr>\n"," </thead>\n"," <tbody>\n"," <tr>\n"," <td>1</td>\n"," <td>1.271000</td>\n"," </tr>\n"," <tr>\n"," <td>2</td>\n"," <td>1.536200</td>\n"," </tr>\n"," <tr>\n"," <td>3</td>\n"," <td>1.318200</td>\n"," </tr>\n"," <tr>\n"," <td>4</td>\n"," <td>1.335400</td>\n"," </tr>\n"," <tr>\n"," <td>5</td>\n"," <td>1.527000</td>\n"," </tr>\n"," <tr>\n"," <td>6</td>\n"," <td>1.228300</td>\n"," </tr>\n"," <tr>\n"," <td>7</td>\n"," <td>1.395500</td>\n"," </tr>\n"," <tr>\n"," <td>8</td>\n"," <td>1.186600</td>\n"," </tr>\n"," <tr>\n"," <td>9</td>\n"," <td>1.360900</td>\n"," </tr>\n"," <tr>\n"," <td>10</td>\n"," <td>1.059700</td>\n"," </tr>\n"," <tr>\n"," <td>11</td>\n"," <td>1.235900</td>\n"," </tr>\n"," <tr>\n"," <td>12</td>\n"," <td>0.959300</td>\n"," </tr>\n"," <tr>\n"," <td>13</td>\n"," <td>1.258500</td>\n"," </tr>\n"," <tr>\n"," <td>14</td>\n"," <td>1.059300</td>\n"," </tr>\n"," <tr>\n"," <td>15</td>\n"," <td>1.134300</td>\n"," </tr>\n"," <tr>\n"," <td>16</td>\n"," <td>1.095300</td>\n"," </tr>\n"," <tr>\n"," <td>17</td>\n"," <td>1.146500</td>\n"," </tr>\n"," <tr>\n"," <td>18</td>\n"," <td>1.053900</td>\n"," </tr>\n"," <tr>\n"," <td>19</td>\n"," <td>1.084700</td>\n"," </tr>\n"," <tr>\n"," <td>20</td>\n"," <td>0.957100</td>\n"," </tr>\n"," <tr>\n"," <td>21</td>\n"," <td>0.919800</td>\n"," </tr>\n"," <tr>\n"," <td>22</td>\n"," <td>1.160700</td>\n"," </tr>\n"," <tr>\n"," <td>23</td>\n"," <td>1.011900</td>\n"," </tr>\n"," <tr>\n"," <td>24</td>\n"," <td>0.963600</td>\n"," </tr>\n"," <tr>\n"," <td>25</td>\n"," <td>0.953700</td>\n"," </tr>\n"," <tr>\n"," <td>26</td>\n"," <td>0.876900</td>\n"," </tr>\n"," <tr>\n"," <td>27</td>\n"," <td>0.905500</td>\n"," </tr>\n"," <tr>\n"," <td>28</td>\n"," <td>1.002700</td>\n"," </tr>\n"," <tr>\n"," <td>29</td>\n"," <td>0.920500</td>\n"," </tr>\n"," <tr>\n"," <td>30</td>\n"," <td>0.955800</td>\n"," </tr>\n"," <tr>\n"," <td>31</td>\n"," <td>1.205100</td>\n"," </tr>\n"," <tr>\n"," <td>32</td>\n"," <td>1.113000</td>\n"," </tr>\n"," <tr>\n"," <td>33</td>\n"," <td>0.993600</td>\n"," </tr>\n"," <tr>\n"," <td>34</td>\n"," <td>0.853300</td>\n"," </tr>\n"," <tr>\n"," <td>35</td>\n"," <td>0.945200</td>\n"," </tr>\n"," <tr>\n"," <td>36</td>\n"," <td>0.772400</td>\n"," </tr>\n"," <tr>\n"," <td>37</td>\n"," <td>0.805400</td>\n"," </tr>\n"," <tr>\n"," <td>38</td>\n"," <td>0.737700</td>\n"," </tr>\n"," <tr>\n"," <td>39</td>\n"," <td>0.921900</td>\n"," </tr>\n"," <tr>\n"," <td>40</td>\n"," <td>0.837300</td>\n"," </tr>\n"," <tr>\n"," <td>41</td>\n"," <td>0.871300</td>\n"," </tr>\n"," <tr>\n"," <td>42</td>\n"," <td>0.761800</td>\n"," </tr>\n"," <tr>\n"," <td>43</td>\n"," <td>0.830700</td>\n"," </tr>\n"," <tr>\n"," <td>44</td>\n"," <td>0.926100</td>\n"," </tr>\n"," <tr>\n"," <td>45</td>\n"," <td>0.999100</td>\n"," </tr>\n"," <tr>\n"," <td>46</td>\n"," <td>1.054500</td>\n"," </tr>\n"," <tr>\n"," <td>47</td>\n"," <td>0.706800</td>\n"," </tr>\n"," <tr>\n"," <td>48</td>\n"," <td>0.907100</td>\n"," </tr>\n"," <tr>\n"," <td>49</td>\n"," <td>0.992400</td>\n"," </tr>\n"," <tr>\n"," <td>50</td>\n"," <td>0.771300</td>\n"," </tr>\n"," <tr>\n"," <td>51</td>\n"," <td>1.035200</td>\n"," </tr>\n"," <tr>\n"," <td>52</td>\n"," <td>0.870300</td>\n"," </tr>\n"," <tr>\n"," <td>53</td>\n"," <td>0.766900</td>\n"," </tr>\n"," <tr>\n"," <td>54</td>\n"," <td>0.823300</td>\n"," </tr>\n"," <tr>\n"," <td>55</td>\n"," <td>0.896200</td>\n"," </tr>\n"," <tr>\n"," <td>56</td>\n"," <td>0.976700</td>\n"," </tr>\n"," <tr>\n"," <td>57</td>\n"," <td>0.829100</td>\n"," </tr>\n"," <tr>\n"," <td>58</td>\n"," <td>0.788800</td>\n"," </tr>\n"," <tr>\n"," <td>59</td>\n"," <td>0.842400</td>\n"," </tr>\n"," <tr>\n"," <td>60</td>\n"," <td>0.915800</td>\n"," </tr>\n"," </tbody>\n","</table><p>"]},"metadata":{}},{"output_type":"execute_result","data":{"text/plain":["TrainOutput(global_step=60, training_loss=1.0104216814041138, metrics={'train_runtime': 129.2601, 'train_samples_per_second': 3.713, 'train_steps_per_second': 0.464, 'total_flos': 154972082995200.0, 'train_loss': 1.0104216814041138, 'epoch': 1.8888888888888888})"]},"metadata":{},"execution_count":10}]},{"cell_type":"code","source":["# Save model and tokenizer to a local directory\n","save_directory = \"/content/my_model\"\n","model.save_pretrained(save_directory)\n","tokenizer.save_pretrained(save_directory)\n","\n","# Zip the directory\n","import shutil\n","shutil.make_archive(save_directory, 'zip', save_directory)\n","\n","# Download the zip file\n","from google.colab import files\n","files.download(f\"{save_directory}.zip\")"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":34},"id":"Nzf-cCC_kKoo","executionInfo":{"status":"ok","timestamp":1736140951877,"user_tz":-330,"elapsed":46096,"user":{"displayName":"","userId":""}},"outputId":"7ed2b6ee-8d2f-43f8-bd0d-907df5ac9c72"},"execution_count":11,"outputs":[{"output_type":"display_data","data":{"text/plain":["<IPython.core.display.Javascript object>"],"application/javascript":["\n"," async function download(id, filename, size) {\n"," if (!google.colab.kernel.accessAllowed) {\n"," return;\n"," }\n"," const div = document.createElement('div');\n"," const label = document.createElement('label');\n"," label.textContent = `Downloading \"${filename}\": `;\n"," div.appendChild(label);\n"," const progress = document.createElement('progress');\n"," progress.max = size;\n"," div.appendChild(progress);\n"," document.body.appendChild(div);\n","\n"," const buffers = [];\n"," let downloaded = 0;\n","\n"," const channel = await google.colab.kernel.comms.open(id);\n"," // Send a message to notify the kernel that we're ready.\n"," channel.send({})\n","\n"," for await (const message of channel.messages) {\n"," // Send a message to notify the kernel that we're ready.\n"," channel.send({})\n"," if (message.buffers) {\n"," for (const buffer of message.buffers) {\n"," buffers.push(buffer);\n"," downloaded += buffer.byteLength;\n"," progress.value = downloaded;\n"," }\n"," }\n"," }\n"," const blob = new Blob(buffers, {type: 'application/binary'});\n"," const a = document.createElement('a');\n"," a.href = window.URL.createObjectURL(blob);\n"," a.download = filename;\n"," div.appendChild(a);\n"," a.click();\n"," div.remove();\n"," }\n"," "]},"metadata":{}},{"output_type":"display_data","data":{"text/plain":["<IPython.core.display.Javascript object>"],"application/javascript":["download(\"download_ed127b8a-61e6-41a3-be8f-29fd45936190\", \"my_model.zip\", 500735079)"]},"metadata":{}}]}]} |