{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "JeByetuw4Z8p", "outputId": "3d217ba3-6a14-4fac-a2a7-034da9c2e192" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Requirement already satisfied: huggingface_hub in /usr/local/lib/python3.11/dist-packages (0.27.1)\n", "Requirement already satisfied: pandas in /usr/local/lib/python3.11/dist-packages (2.2.2)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.11/dist-packages (from huggingface_hub) (3.16.1)\n", "Requirement already satisfied: fsspec>=2023.5.0 in /usr/local/lib/python3.11/dist-packages (from huggingface_hub) (2024.10.0)\n", "Requirement already satisfied: packaging>=20.9 in /usr/local/lib/python3.11/dist-packages (from huggingface_hub) (24.2)\n", "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.11/dist-packages (from huggingface_hub) (6.0.2)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.11/dist-packages (from huggingface_hub) (2.32.3)\n", "Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.11/dist-packages (from huggingface_hub) (4.67.1)\n", "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.11/dist-packages (from huggingface_hub) (4.12.2)\n", "Requirement already satisfied: numpy>=1.23.2 in /usr/local/lib/python3.11/dist-packages (from pandas) (1.26.4)\n", "Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.11/dist-packages (from pandas) (2.8.2)\n", "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.11/dist-packages (from pandas) (2024.2)\n", "Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.11/dist-packages (from pandas) (2024.2)\n", "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil>=2.8.2->pandas) (1.17.0)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests->huggingface_hub) (3.4.1)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.11/dist-packages (from requests->huggingface_hub) (3.10)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests->huggingface_hub) (2.3.0)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.11/dist-packages (from requests->huggingface_hub) (2024.12.14)\n" ] } ], "source": [ "!pip install huggingface_hub pandas" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 17, "referenced_widgets": [ "0f462b65ea3c4e488a048fce32a7c8b6", "cd653a468497476aae5fe8fffb2d9579", "32eb9f14061443f19889bc3e5df657d1", "b8154a7517664bd5bc6683849831dcc6", "e99446fde46b46ed8afa21a544e88a04", "b768d5e77827402f998ff75095dee07b", "eda21131cb6b40afb539f53b0d30b13c", "98222f2f7e9e48c18d5b61e4199b2c02", "d8c4fd408a464de7beed4b16d332a486", "603e2ed3f4c941709c16f3990293337c", "94480a715ddf4c1f80fa1ee70dba800f", "1cf8d80b0925405db51631a7a85b21e2", "4070c3e029294b718a33f4d795dabafa", "9ed483c8531a4ebfa3818fd909dbe6b4", "d8b77f35993344dcbffb57278466e096", "4b9d7c9d1f274b66b921439b785fa41f", "7eb155ca4f3f440387f59ebbc2b9bd6e", "e43e25a65a0a4540a7b64d883b85ff44", "d404142ab7864c8d9ebe89ae3b83a53b", "8ed4bce1e8b94d04980d2399f9ff907c" ] }, "id": "-KBQcoiuz-0C", "outputId": "2c35c829-b636-43a4-ff62-886e314151e5" }, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "VBox(children=(HTML(value='
\n", " | Input | \n", "Output | \n", "LANG | \n", "type | \n", "subject_name | \n", "topic; | \n", "subject | \n", "
---|---|---|---|---|---|---|---|
0 | \n", "If the total of Mario and Maria's ages is curr... | \n", "4 | \n", "en | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
1 | \n", "A researcher observes that an organism placed ... | \n", "D | \n", "en | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
2 | \n", "एक ट्रेन जो 350 मीटर लंबी है, एक इलेक्ट्रिक पो... | \n", "d | \n", "hi | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
3 | \n", "how do you clammer something? ### A) hit it ##... | \n", "A | \n", "en | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
4 | \n", "Here's a question:\\n\\nWhat is the molecular fo... | \n", "The fourth member of the alkane series is buta... | \n", "en | \n", "NaN | \n", "NaN | \n", "Organic chemistry | \n", "NaN | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
43767 | \n", "How often can resolutions be approved for cont... | \n", "The text does not specify how often resolution... | \n", "en | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
43768 | \n", "Write a function to clear the values of the gi... | \n", "def clear_tuple(test_tup):\\r\\n temp = list(te... | \n", "en | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
43769 | \n", "एक मेसोस्कोपिक तार की चालकता और इसके आयाम, ताप... | \n", "एक मेसोस्कोपिक तार की चालकता कई कारकों से प्रभ... | \n", "hi | \n", "NaN | \n", "NaN | \n", "Condensed matter physics | \n", "NaN | \n", "
43770 | \n", "एक परमाणु जिसमें +1 चार्ज होता है, उसके पास है... | \n", "B | \n", "hi | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
43771 | \n", "सभी मान खोजें $x > 4$ जो संतुष्ट करते हैं\\n\\[\\... | \n", "दी गई समीकरण से,\\n\\[\\sqrt{x + 4 \\sqrt{x - 4}} ... | \n", "hi | \n", "Intermediate Algebra | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
43772 rows × 7 columns
\n", "Step | \n", "Training Loss | \n", "
---|---|
1000 | \n", "1.149500 | \n", "
2000 | \n", "1.048500 | \n", "
"
],
"text/plain": [
" "
]
},
"metadata": {}
}
],
"source": [
"trainer_stats = trainer.train()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "xj6XdJWNF6Pb"
},
"source": [
"#**MODEL SAVING**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "ULl7losCFj9L"
},
"outputs": [],
"source": [
"!wait"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 295,
"referenced_widgets": [
"5a14ddec096a4d68a3a5a11581a5824b",
"8cf07acce54942488f0a9c3ccd61d808",
"d3a8783f062345df88d2c510a1c8059a"
]
},
"id": "cEGk9Cm1FmoH",
"outputId": "8109feb0-52e2-4da4-ea1a-0d0dc77919c1"
},
"outputs": [
{
"metadata": {
"tags": null
},
"name": "stderr",
"output_type": "stream",
"text": [
"Unsloth: You are pushing to hub, but you passed your HF username = DrishtiSharma.\n",
"We shall truncate DrishtiSharma/HINDI-GEMMA-9B-B30 to HINDI-GEMMA-9B-B30\n",
"Unsloth: Kaggle/Colab has limited disk space. We need to delete the downloaded\n",
"model which will save 4-16GB of disk space, allowing you to save on Kaggle/Colab.\n",
"Unsloth: Will remove a cached repo with size 18.5G\n"
]
},
{
"metadata": {
"tags": null
},
"name": "stdout",
"output_type": "stream",
"text": [
"Unsloth: Merging 4bit and LoRA weights to 16bit...\n",
"Unsloth: Will use up to 48.88 out of 83.48 RAM for saving.\n",
"Unsloth: Saving model... This might take 5 minutes ...\n"
]
},
{
"metadata": {
"tags": null
},
"name": "stderr",
"output_type": "stream",
"text": [
" 64%|██████▍ | 27/42 [00:00<00:00, 73.66it/s]\n",
"We will save to Disk and not RAM now.\n",
"100%|██████████| 42/42 [00:11<00:00, 3.71it/s]\n"
]
},
{
"metadata": {
"tags": null
},
"name": "stdout",
"output_type": "stream",
"text": [
"Unsloth: Saving tokenizer..."
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "5a14ddec096a4d68a3a5a11581a5824b",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"tokenizer.model: 0%| | 0.00/4.24M [00:00, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8cf07acce54942488f0a9c3ccd61d808",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Upload 2 LFS files: 0%| | 0/2 [00:00, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d3a8783f062345df88d2c510a1c8059a",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"tokenizer.json: 0%| | 0.00/34.4M [00:00, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"metadata": {
"tags": null
},
"name": "stdout",
"output_type": "stream",
"text": [
" Done.\n"
]
}
],
"source": [
"if True: model.push_to_hub_merged(\"DrishtiSharma/HINDI-GEMMA-9B-B30\", tokenizer, save_method = \"merged_16bit\")\n",
"# USE YOU HF ACCOUNT AND NOT THE ORG\n",
"# NAME FORMAT : HINDI-MODELNAME-EXTENSION-A/B-00 - USE A/B is BENCHMARK DATASETS WERE SET TO TRUE/FALSE IN FLAGS , THE NUMBER IS THE RATIO USED ABOVE"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "U5gGbbSNF1oB"
},
"outputs": [],
"source": [
"# SET THE REPO PRIVATE AFTER UPLOAD\n",
"# UPLOAD THE CSV TO THE REPO AFTER IT IS MADE PRIVATE\n",
"# CSV >> THE CSV SAVED IN YOUR RUNTIME"
]
},
{
"cell_type": "code",
"source": [
"from google.colab import runtime\n",
"runtime.unassign()"
],
"metadata": {
"id": "brN9DtmHhYPS"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "3BcP1kfkhcFb"
},
"execution_count": null,
"outputs": []
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"gpuType": "A100",
"machine_shape": "hm",
"provenance": []
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"0f462b65ea3c4e488a048fce32a7c8b6": {
"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": [],
"layout": "IPY_MODEL_eda21131cb6b40afb539f53b0d30b13c"
}
},
"cd653a468497476aae5fe8fffb2d9579": {
"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_98222f2f7e9e48c18d5b61e4199b2c02",
"placeholder": "",
"style": "IPY_MODEL_d8c4fd408a464de7beed4b16d332a486",
"value": "\n",
" \n",
"
\n",
" \n",
" \n",
" \n",
" Step \n",
" Training Loss \n",
" \n",
" \n",
" 1000 \n",
" 1.149500 \n",
" \n",
" \n",
" \n",
"2000 \n",
" 1.048500 \n",
"
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.