Spaces:
Build error
Build error
Update 13_Qwen2_7b_finetuning_l40.ipynb
Browse files
competition/13_Qwen2_7b_finetuning_l40.ipynb
CHANGED
|
@@ -14,7 +14,7 @@
|
|
| 14 |
},
|
| 15 |
{
|
| 16 |
"cell_type": "code",
|
| 17 |
-
"execution_count":
|
| 18 |
"metadata": {
|
| 19 |
"colab": {
|
| 20 |
"base_uri": "https://localhost:8080/"
|
|
@@ -27,7 +27,7 @@
|
|
| 27 |
"name": "stdout",
|
| 28 |
"output_type": "stream",
|
| 29 |
"text": [
|
| 30 |
-
"
|
| 31 |
]
|
| 32 |
}
|
| 33 |
],
|
|
@@ -44,7 +44,7 @@
|
|
| 44 |
},
|
| 45 |
{
|
| 46 |
"cell_type": "code",
|
| 47 |
-
"execution_count":
|
| 48 |
"metadata": {
|
| 49 |
"colab": {
|
| 50 |
"base_uri": "https://localhost:8080/"
|
|
@@ -56,22 +56,22 @@
|
|
| 56 |
{
|
| 57 |
"data": {
|
| 58 |
"text/plain": [
|
| 59 |
-
"
|
| 60 |
]
|
| 61 |
},
|
| 62 |
-
"execution_count":
|
| 63 |
"metadata": {},
|
| 64 |
"output_type": "execute_result"
|
| 65 |
}
|
| 66 |
],
|
| 67 |
"source": [
|
| 68 |
-
"need_to_setup_env =
|
| 69 |
"need_to_setup_env"
|
| 70 |
]
|
| 71 |
},
|
| 72 |
{
|
| 73 |
"cell_type": "code",
|
| 74 |
-
"execution_count":
|
| 75 |
"metadata": {
|
| 76 |
"colab": {
|
| 77 |
"base_uri": "https://localhost:8080/"
|
|
@@ -79,7 +79,46 @@
|
|
| 79 |
"id": "u0QXyHU_5DQR",
|
| 80 |
"outputId": "54672b45-b5dc-48ef-efd2-5e8545e7b78b"
|
| 81 |
},
|
| 82 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
"source": [
|
| 84 |
"if need_to_setup_env:\n",
|
| 85 |
" %pip install -r requirements.txt"
|
|
@@ -87,7 +126,7 @@
|
|
| 87 |
},
|
| 88 |
{
|
| 89 |
"cell_type": "code",
|
| 90 |
-
"execution_count":
|
| 91 |
"metadata": {
|
| 92 |
"colab": {
|
| 93 |
"base_uri": "https://localhost:8080/"
|
|
@@ -109,7 +148,7 @@
|
|
| 109 |
"True"
|
| 110 |
]
|
| 111 |
},
|
| 112 |
-
"execution_count":
|
| 113 |
"metadata": {},
|
| 114 |
"output_type": "execute_result"
|
| 115 |
}
|
|
@@ -127,7 +166,7 @@
|
|
| 127 |
},
|
| 128 |
{
|
| 129 |
"cell_type": "code",
|
| 130 |
-
"execution_count":
|
| 131 |
"metadata": {
|
| 132 |
"colab": {
|
| 133 |
"base_uri": "https://localhost:8080/"
|
|
@@ -159,7 +198,7 @@
|
|
| 159 |
},
|
| 160 |
{
|
| 161 |
"cell_type": "code",
|
| 162 |
-
"execution_count":
|
| 163 |
"metadata": {
|
| 164 |
"colab": {
|
| 165 |
"base_uri": "https://localhost:8080/",
|
|
@@ -271,7 +310,7 @@
|
|
| 271 |
"4 真相原来与一位年迈的农夫有关。这位农夫年轻时,曾与一位美丽的姑娘相恋。他们约定在南瓜丰收的季... "
|
| 272 |
]
|
| 273 |
},
|
| 274 |
-
"execution_count":
|
| 275 |
"metadata": {},
|
| 276 |
"output_type": "execute_result"
|
| 277 |
}
|
|
@@ -284,7 +323,7 @@
|
|
| 284 |
},
|
| 285 |
{
|
| 286 |
"cell_type": "code",
|
| 287 |
-
"execution_count":
|
| 288 |
"metadata": {
|
| 289 |
"colab": {
|
| 290 |
"base_uri": "https://localhost:8080/"
|
|
@@ -301,7 +340,7 @@
|
|
| 301 |
" 'output': '不是'}"
|
| 302 |
]
|
| 303 |
},
|
| 304 |
-
"execution_count":
|
| 305 |
"metadata": {},
|
| 306 |
"output_type": "execute_result"
|
| 307 |
}
|
|
@@ -321,7 +360,7 @@
|
|
| 321 |
},
|
| 322 |
{
|
| 323 |
"cell_type": "code",
|
| 324 |
-
"execution_count":
|
| 325 |
"metadata": {
|
| 326 |
"colab": {
|
| 327 |
"base_uri": "https://localhost:8080/"
|
|
@@ -334,7 +373,7 @@
|
|
| 334 |
"name": "stdout",
|
| 335 |
"output_type": "stream",
|
| 336 |
"text": [
|
| 337 |
-
"JSON file saved to
|
| 338 |
]
|
| 339 |
}
|
| 340 |
],
|
|
@@ -343,7 +382,7 @@
|
|
| 343 |
"import json\n",
|
| 344 |
"\n",
|
| 345 |
"# Define the directory where you want to save the JSON file\n",
|
| 346 |
-
"output_dir = \"
|
| 347 |
"\n",
|
| 348 |
"# Ensure the directory exists\n",
|
| 349 |
"os.makedirs(output_dir, exist_ok=True)\n",
|
|
@@ -358,6 +397,208 @@
|
|
| 358 |
"print(f\"JSON file saved to {json_file_path}\")\n"
|
| 359 |
]
|
| 360 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 361 |
{
|
| 362 |
"cell_type": "code",
|
| 363 |
"execution_count": null,
|
|
|
|
| 14 |
},
|
| 15 |
{
|
| 16 |
"cell_type": "code",
|
| 17 |
+
"execution_count": 2,
|
| 18 |
"metadata": {
|
| 19 |
"colab": {
|
| 20 |
"base_uri": "https://localhost:8080/"
|
|
|
|
| 27 |
"name": "stdout",
|
| 28 |
"output_type": "stream",
|
| 29 |
"text": [
|
| 30 |
+
"working dir: c:\\Users\\HT\\Documents\\URP\\logical-reasoning\n"
|
| 31 |
]
|
| 32 |
}
|
| 33 |
],
|
|
|
|
| 44 |
},
|
| 45 |
{
|
| 46 |
"cell_type": "code",
|
| 47 |
+
"execution_count": 3,
|
| 48 |
"metadata": {
|
| 49 |
"colab": {
|
| 50 |
"base_uri": "https://localhost:8080/"
|
|
|
|
| 56 |
{
|
| 57 |
"data": {
|
| 58 |
"text/plain": [
|
| 59 |
+
"True"
|
| 60 |
]
|
| 61 |
},
|
| 62 |
+
"execution_count": 3,
|
| 63 |
"metadata": {},
|
| 64 |
"output_type": "execute_result"
|
| 65 |
}
|
| 66 |
],
|
| 67 |
"source": [
|
| 68 |
+
"need_to_setup_env = True\n",
|
| 69 |
"need_to_setup_env"
|
| 70 |
]
|
| 71 |
},
|
| 72 |
{
|
| 73 |
"cell_type": "code",
|
| 74 |
+
"execution_count": 4,
|
| 75 |
"metadata": {
|
| 76 |
"colab": {
|
| 77 |
"base_uri": "https://localhost:8080/"
|
|
|
|
| 79 |
"id": "u0QXyHU_5DQR",
|
| 80 |
"outputId": "54672b45-b5dc-48ef-efd2-5e8545e7b78b"
|
| 81 |
},
|
| 82 |
+
"outputs": [
|
| 83 |
+
{
|
| 84 |
+
"name": "stdout",
|
| 85 |
+
"output_type": "stream",
|
| 86 |
+
"text": [
|
| 87 |
+
"Looking in indexes: https://artifacts.forge.mastercard.com/artifactory/api/pypi/python/simple\n",
|
| 88 |
+
"Requirement already satisfied: huggingface_hub==0.23.2 in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 1)) (0.23.2)\n",
|
| 89 |
+
"Requirement already satisfied: nltk==3.8.1 in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 2)) (3.8.1)\n",
|
| 90 |
+
"Requirement already satisfied: python-dotenv==1.0.1 in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 3)) (1.0.1)\n",
|
| 91 |
+
"Requirement already satisfied: black==24.4.0 in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 4)) (24.4.0)\n",
|
| 92 |
+
"Requirement already satisfied: evaluate==0.4.2 in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 5)) (0.4.2)\n",
|
| 93 |
+
"Requirement already satisfied: rouge_score==0.1.2 in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 6)) (0.1.2)\n",
|
| 94 |
+
"Requirement already satisfied: pytest==8.2.1 in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 7)) (8.2.1)\n",
|
| 95 |
+
"Requirement already satisfied: seaborn==0.13.2 in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 8)) (0.13.2)\n",
|
| 96 |
+
"Requirement already satisfied: scikit-learn==1.5.0 in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 9)) (1.5.0)\n",
|
| 97 |
+
"Requirement already satisfied: jupyter in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 10)) (1.0.0)\n",
|
| 98 |
+
"Requirement already satisfied: ipywidgets in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 11)) (8.1.3)\n",
|
| 99 |
+
"Requirement already satisfied: packaging in c:\\users\\ht\\appdata\\roaming\\python\\python312\\site-packages (from -r requirements.txt (line 12)) (24.1)\n",
|
| 100 |
+
"Requirement already satisfied: langchain_openai==0.1.13 in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 13)) (0.1.13)\n",
|
| 101 |
+
"Requirement already satisfied: wandb==0.17.4 in c:\\users\\ht\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from -r requirements.txt (line 14)) (0.17.4)\n",
|
| 102 |
+
"Note: you may need to restart the kernel to use updated packages.\n"
|
| 103 |
+
]
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"name": "stderr",
|
| 107 |
+
"output_type": "stream",
|
| 108 |
+
"text": [
|
| 109 |
+
"WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000017A046EB3B0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /artifactory/api/pypi/python/simple/transformers/\n",
|
| 110 |
+
"WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000017A05F00EF0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /artifactory/api/pypi/python/simple/transformers/\n",
|
| 111 |
+
"WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000017A05F01820>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /artifactory/api/pypi/python/simple/transformers/\n",
|
| 112 |
+
"WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000017A05F01220>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /artifactory/api/pypi/python/simple/transformers/\n",
|
| 113 |
+
"WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000017A05F01A60>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /artifactory/api/pypi/python/simple/transformers/\n",
|
| 114 |
+
"ERROR: Could not find a version that satisfies the requirement transformers==4.42.4 (from versions: none)\n",
|
| 115 |
+
"ERROR: No matching distribution found for transformers==4.42.4\n",
|
| 116 |
+
"\n",
|
| 117 |
+
"[notice] A new release of pip is available: 24.0 -> 24.1.2\n",
|
| 118 |
+
"[notice] To update, run: python.exe -m pip install --upgrade pip\n"
|
| 119 |
+
]
|
| 120 |
+
}
|
| 121 |
+
],
|
| 122 |
"source": [
|
| 123 |
"if need_to_setup_env:\n",
|
| 124 |
" %pip install -r requirements.txt"
|
|
|
|
| 126 |
},
|
| 127 |
{
|
| 128 |
"cell_type": "code",
|
| 129 |
+
"execution_count": 5,
|
| 130 |
"metadata": {
|
| 131 |
"colab": {
|
| 132 |
"base_uri": "https://localhost:8080/"
|
|
|
|
| 148 |
"True"
|
| 149 |
]
|
| 150 |
},
|
| 151 |
+
"execution_count": 5,
|
| 152 |
"metadata": {},
|
| 153 |
"output_type": "execute_result"
|
| 154 |
}
|
|
|
|
| 166 |
},
|
| 167 |
{
|
| 168 |
"cell_type": "code",
|
| 169 |
+
"execution_count": 6,
|
| 170 |
"metadata": {
|
| 171 |
"colab": {
|
| 172 |
"base_uri": "https://localhost:8080/"
|
|
|
|
| 198 |
},
|
| 199 |
{
|
| 200 |
"cell_type": "code",
|
| 201 |
+
"execution_count": 7,
|
| 202 |
"metadata": {
|
| 203 |
"colab": {
|
| 204 |
"base_uri": "https://localhost:8080/",
|
|
|
|
| 310 |
"4 真相原来与一位年迈的农夫有关。这位农夫年轻时,曾与一位美丽的姑娘相恋。他们约定在南瓜丰收的季... "
|
| 311 |
]
|
| 312 |
},
|
| 313 |
+
"execution_count": 7,
|
| 314 |
"metadata": {},
|
| 315 |
"output_type": "execute_result"
|
| 316 |
}
|
|
|
|
| 323 |
},
|
| 324 |
{
|
| 325 |
"cell_type": "code",
|
| 326 |
+
"execution_count": 8,
|
| 327 |
"metadata": {
|
| 328 |
"colab": {
|
| 329 |
"base_uri": "https://localhost:8080/"
|
|
|
|
| 340 |
" 'output': '不是'}"
|
| 341 |
]
|
| 342 |
},
|
| 343 |
+
"execution_count": 8,
|
| 344 |
"metadata": {},
|
| 345 |
"output_type": "execute_result"
|
| 346 |
}
|
|
|
|
| 360 |
},
|
| 361 |
{
|
| 362 |
"cell_type": "code",
|
| 363 |
+
"execution_count": 9,
|
| 364 |
"metadata": {
|
| 365 |
"colab": {
|
| 366 |
"base_uri": "https://localhost:8080/"
|
|
|
|
| 373 |
"name": "stdout",
|
| 374 |
"output_type": "stream",
|
| 375 |
"text": [
|
| 376 |
+
"JSON file saved to LLaMA-Factory/data/mgtv_train.json\n"
|
| 377 |
]
|
| 378 |
}
|
| 379 |
],
|
|
|
|
| 382 |
"import json\n",
|
| 383 |
"\n",
|
| 384 |
"# Define the directory where you want to save the JSON file\n",
|
| 385 |
+
"output_dir = \"LLaMA-Factory/data/\"\n",
|
| 386 |
"\n",
|
| 387 |
"# Ensure the directory exists\n",
|
| 388 |
"os.makedirs(output_dir, exist_ok=True)\n",
|
|
|
|
| 397 |
"print(f\"JSON file saved to {json_file_path}\")\n"
|
| 398 |
]
|
| 399 |
},
|
| 400 |
+
{
|
| 401 |
+
"cell_type": "code",
|
| 402 |
+
"execution_count": 10,
|
| 403 |
+
"metadata": {},
|
| 404 |
+
"outputs": [
|
| 405 |
+
{
|
| 406 |
+
"name": "stdout",
|
| 407 |
+
"output_type": "stream",
|
| 408 |
+
"text": [
|
| 409 |
+
"Sat Jul 20 22:46:57 2024 \n",
|
| 410 |
+
"+---------------------------------------------------------------------------------------+\n",
|
| 411 |
+
"| NVIDIA-SMI 535.98 Driver Version: 535.98 CUDA Version: 12.2 |\n",
|
| 412 |
+
"|-----------------------------------------+----------------------+----------------------+\n",
|
| 413 |
+
"| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
|
| 414 |
+
"| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |\n",
|
| 415 |
+
"| | | MIG M. |\n",
|
| 416 |
+
"|=========================================+======================+======================|\n",
|
| 417 |
+
"| 0 NVIDIA GeForce RTX 3070 ... WDDM | 00000000:01:00.0 On | N/A |\n",
|
| 418 |
+
"| N/A 41C P8 15W / 140W | 1383MiB / 8192MiB | 2% Default |\n",
|
| 419 |
+
"| | | N/A |\n",
|
| 420 |
+
"+-----------------------------------------+----------------------+----------------------+\n",
|
| 421 |
+
" \n",
|
| 422 |
+
"+---------------------------------------------------------------------------------------+\n",
|
| 423 |
+
"| Processes: |\n",
|
| 424 |
+
"| GPU GI CI PID Type Process name GPU Memory |\n",
|
| 425 |
+
"| ID ID Usage |\n",
|
| 426 |
+
"|=======================================================================================|\n",
|
| 427 |
+
"| 0 N/A N/A 908 C ...ta\\Local\\Programs\\Ollama\\ollama.exe N/A |\n",
|
| 428 |
+
"| 0 N/A N/A 3092 C+G ...n\\126.0.2592.102\\msedgewebview2.exe N/A |\n",
|
| 429 |
+
"| 0 N/A N/A 7888 C+G ...mpt_builder\\LogiAiPromptBuilder.exe N/A |\n",
|
| 430 |
+
"| 0 N/A N/A 10552 C+G ...tionsPlus\\logioptionsplus_agent.exe N/A |\n",
|
| 431 |
+
"| 0 N/A N/A 10772 C+G C:\\Windows\\explorer.exe N/A |\n",
|
| 432 |
+
"| 0 N/A N/A 12996 C+G ....Search_cw5n1h2txyewy\\SearchApp.exe N/A |\n",
|
| 433 |
+
"| 0 N/A N/A 15364 C+G ...CBS_cw5n1h2txyewy\\TextInputHost.exe N/A |\n",
|
| 434 |
+
"| 0 N/A N/A 15944 C+G ...oogle\\Chrome\\Application\\chrome.exe N/A |\n",
|
| 435 |
+
"| 0 N/A N/A 16984 C+G ...t.LockApp_cw5n1h2txyewy\\LockApp.exe N/A |\n",
|
| 436 |
+
"| 0 N/A N/A 19196 C+G ...5n1h2txyewy\\ShellExperienceHost.exe N/A |\n",
|
| 437 |
+
"| 0 N/A N/A 19352 C+G ...ft Office\\root\\Office16\\ONENOTE.EXE N/A |\n",
|
| 438 |
+
"| 0 N/A N/A 21732 C+G ...aming\\Telegram Desktop\\Telegram.exe N/A |\n",
|
| 439 |
+
"| 0 N/A N/A 22920 C+G ...Desktop\\app-3.4.2\\GitHubDesktop.exe N/A |\n",
|
| 440 |
+
"| 0 N/A N/A 27608 C+G ...Programs\\Microsoft VS Code\\Code.exe N/A |\n",
|
| 441 |
+
"| 0 N/A N/A 30412 C+G ...8.0_x64__cv1g1gvanyjgm\\WhatsApp.exe N/A |\n",
|
| 442 |
+
"+---------------------------------------------------------------------------------------+\n"
|
| 443 |
+
]
|
| 444 |
+
}
|
| 445 |
+
],
|
| 446 |
+
"source": [
|
| 447 |
+
"!nvidia-smi"
|
| 448 |
+
]
|
| 449 |
+
},
|
| 450 |
+
{
|
| 451 |
+
"cell_type": "code",
|
| 452 |
+
"execution_count": 25,
|
| 453 |
+
"metadata": {},
|
| 454 |
+
"outputs": [
|
| 455 |
+
{
|
| 456 |
+
"name": "stdout",
|
| 457 |
+
"output_type": "stream",
|
| 458 |
+
"text": [
|
| 459 |
+
"Git Bash Path: C:/Program Files/Git/bin/bash.exe\n",
|
| 460 |
+
"Script Path: scripts/tune-lf.sh\n",
|
| 461 |
+
"Config Path: config/qwen2_7b_lora_sft_4bit.yaml\n",
|
| 462 |
+
"Config file not found at config/qwen2_7b_lora_sft_4bit.yaml\n"
|
| 463 |
+
]
|
| 464 |
+
},
|
| 465 |
+
{
|
| 466 |
+
"ename": "CalledProcessError",
|
| 467 |
+
"evalue": "Command '['bash', 'scripts/tune-lf.sh', 'config/qwen2_7b_lora_sft_4bit.yaml']' returned non-zero exit status 127.",
|
| 468 |
+
"output_type": "error",
|
| 469 |
+
"traceback": [
|
| 470 |
+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
| 471 |
+
"\u001b[1;31mCalledProcessError\u001b[0m Traceback (most recent call last)",
|
| 472 |
+
"File \u001b[1;32m<timed exec>:23\u001b[0m\n",
|
| 473 |
+
"File \u001b[1;32mc:\\Users\\HT\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\subprocess.py:571\u001b[0m, in \u001b[0;36mrun\u001b[1;34m(input, capture_output, timeout, check, *popenargs, **kwargs)\u001b[0m\n\u001b[0;32m 569\u001b[0m retcode \u001b[38;5;241m=\u001b[39m process\u001b[38;5;241m.\u001b[39mpoll()\n\u001b[0;32m 570\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check \u001b[38;5;129;01mand\u001b[39;00m retcode:\n\u001b[1;32m--> 571\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m CalledProcessError(retcode, process\u001b[38;5;241m.\u001b[39margs,\n\u001b[0;32m 572\u001b[0m output\u001b[38;5;241m=\u001b[39mstdout, stderr\u001b[38;5;241m=\u001b[39mstderr)\n\u001b[0;32m 573\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m CompletedProcess(process\u001b[38;5;241m.\u001b[39margs, retcode, stdout, stderr)\n",
|
| 474 |
+
"\u001b[1;31mCalledProcessError\u001b[0m: Command '['bash', 'scripts/tune-lf.sh', 'config/qwen2_7b_lora_sft_4bit.yaml']' returned non-zero exit status 127."
|
| 475 |
+
]
|
| 476 |
+
}
|
| 477 |
+
],
|
| 478 |
+
"source": [
|
| 479 |
+
"%%time\n",
|
| 480 |
+
"import subprocess\n",
|
| 481 |
+
"import os\n",
|
| 482 |
+
"\n",
|
| 483 |
+
"git_bash_path = r\"C:/Program Files/Git/bin/bash.exe\"\n",
|
| 484 |
+
"\n",
|
| 485 |
+
"script_path = \"scripts/tune-lf.sh\"\n",
|
| 486 |
+
"config_path = \"config/qwen2_7b_lora_sft_4bit.yaml\"\n",
|
| 487 |
+
"\n",
|
| 488 |
+
"# Print paths for debugging\n",
|
| 489 |
+
"print(f\"Git Bash Path: {git_bash_path}\")\n",
|
| 490 |
+
"print(f\"Script Path: {script_path}\")\n",
|
| 491 |
+
"print(f\"Config Path: {config_path}\")\n",
|
| 492 |
+
"\n",
|
| 493 |
+
"# Check if the files exist\n",
|
| 494 |
+
"if not os.path.exists(git_bash_path):\n",
|
| 495 |
+
" print(f\"Git Bash not found at {git_bash_path}\")\n",
|
| 496 |
+
"if not os.path.exists(script_path):\n",
|
| 497 |
+
" print(f\"Script not found at {script_path}\")\n",
|
| 498 |
+
"if not os.path.exists(config_path):\n",
|
| 499 |
+
" print(f\"Config file not found at {config_path}\")\n",
|
| 500 |
+
"\n",
|
| 501 |
+
"# Using Git Bash or WSL\n",
|
| 502 |
+
"subprocess.run(['bash', script_path, config_path], check=True)\n"
|
| 503 |
+
]
|
| 504 |
+
},
|
| 505 |
+
{
|
| 506 |
+
"cell_type": "code",
|
| 507 |
+
"execution_count": 27,
|
| 508 |
+
"metadata": {},
|
| 509 |
+
"outputs": [
|
| 510 |
+
{
|
| 511 |
+
"name": "stdout",
|
| 512 |
+
"output_type": "stream",
|
| 513 |
+
"text": [
|
| 514 |
+
"Git Bash Path: C:/Program Files/Git/bin/bash.exe\n",
|
| 515 |
+
"Script Path: scripts/tune-lf.sh\n",
|
| 516 |
+
"Config Path: config/qwen2_7b_lora_sft_4bit.yaml\n",
|
| 517 |
+
"Config file not found at config/qwen2_7b_lora_sft_4bit.yaml\n",
|
| 518 |
+
"Command failed with error code: 127\n",
|
| 519 |
+
"Output: Current Directory:\n",
|
| 520 |
+
"/c/Users/HT/Documents/URP/logical-reasoning/llama-factory\n",
|
| 521 |
+
"config/qwen2_7b_lora_sft_4bit.yaml:\n",
|
| 522 |
+
" {\n",
|
| 523 |
+
" \"model_name_or_path\": \"Qwen/Qwen2-7B\",\n",
|
| 524 |
+
" \"stage\": \"sft\",\n",
|
| 525 |
+
" \"do_train\": true,\n",
|
| 526 |
+
" \"finetuning_type\": \"lora\",\n",
|
| 527 |
+
" \"lora_target\": \"all\",\n",
|
| 528 |
+
" \"quantization_bit\": 4,\n",
|
| 529 |
+
" \"loraplus_lr_ratio\": 16.0,\n",
|
| 530 |
+
" \"upcast_layernorm\": true,\n",
|
| 531 |
+
" \"dataset\": \"mgtv_train\",\n",
|
| 532 |
+
" \"template\": \"qwen\",\n",
|
| 533 |
+
" \"cutoff_len\": 4096,\n",
|
| 534 |
+
" \"max_samples\": 25000,\n",
|
| 535 |
+
" \"overwrite_cache\": true,\n",
|
| 536 |
+
" \"preprocessing_num_workers\": 16,\n",
|
| 537 |
+
" \"output_dir\": \"saves/qwen2_7b/lora/sft_4bit\",\n",
|
| 538 |
+
" \"logging_steps\": 562,\n",
|
| 539 |
+
" \"save_steps\": 562,\n",
|
| 540 |
+
" \"plot_loss\": true,\n",
|
| 541 |
+
" \"overwrite_output_dir\": true,\n",
|
| 542 |
+
" \"per_device_train_batch_size\": 32,\n",
|
| 543 |
+
" \"gradient_accumulation_steps\": 8,\n",
|
| 544 |
+
" \"learning_rate\": 0.0001,\n",
|
| 545 |
+
" \"num_train_epochs\": 3.0,\n",
|
| 546 |
+
" \"lr_scheduler_type\": \"cosine\",\n",
|
| 547 |
+
" \"warmup_ratio\": 0.1,\n",
|
| 548 |
+
" \"bf16\": true,\n",
|
| 549 |
+
" \"ddp_timeout\": 180000000,\n",
|
| 550 |
+
" \"val_size\": 0.1,\n",
|
| 551 |
+
" \"per_device_eval_batch_size\": 1,\n",
|
| 552 |
+
" \"eval_strategy\": \"steps\",\n",
|
| 553 |
+
" \"eval_steps\": 562,\n",
|
| 554 |
+
" \"report_to\": \"wandb\",\n",
|
| 555 |
+
" \"run_name\": \"qwen2_7b\"\n",
|
| 556 |
+
"}\n",
|
| 557 |
+
"\n",
|
| 558 |
+
"Error: scripts/tune-lf.sh: line 9: llamafactory-cli: command not found\n",
|
| 559 |
+
"\n"
|
| 560 |
+
]
|
| 561 |
+
}
|
| 562 |
+
],
|
| 563 |
+
"source": [
|
| 564 |
+
"import subprocess\n",
|
| 565 |
+
"import os\n",
|
| 566 |
+
"\n",
|
| 567 |
+
"git_bash_path = r\"C:/Program Files/Git/bin/bash.exe\"\n",
|
| 568 |
+
"\n",
|
| 569 |
+
"script_path = \"scripts/tune-lf.sh\"\n",
|
| 570 |
+
"config_path = \"config/qwen2_7b_lora_sft_4bit.yaml\"\n",
|
| 571 |
+
"\n",
|
| 572 |
+
"# Print paths for debugging\n",
|
| 573 |
+
"print(f\"Git Bash Path: {git_bash_path}\")\n",
|
| 574 |
+
"print(f\"Script Path: {script_path}\")\n",
|
| 575 |
+
"print(f\"Config Path: {config_path}\")\n",
|
| 576 |
+
"\n",
|
| 577 |
+
"# Check if the files exist\n",
|
| 578 |
+
"if not os.path.exists(git_bash_path):\n",
|
| 579 |
+
" print(f\"Git Bash not found at {git_bash_path}\")\n",
|
| 580 |
+
"if not os.path.exists(script_path):\n",
|
| 581 |
+
" print(f\"Script not found at {script_path}\")\n",
|
| 582 |
+
"if not os.path.exists(config_path):\n",
|
| 583 |
+
" print(f\"Config file not found at {config_path}\")\n",
|
| 584 |
+
"\n",
|
| 585 |
+
"# Ensure the script has execution permissions\n",
|
| 586 |
+
"os.chmod(script_path, 0o755)\n",
|
| 587 |
+
"\n",
|
| 588 |
+
"# Using Git Bash or WSL\n",
|
| 589 |
+
"try:\n",
|
| 590 |
+
" result = subprocess.run(\n",
|
| 591 |
+
" [git_bash_path, '-c', f'bash {script_path} {config_path}'], \n",
|
| 592 |
+
" check=True, capture_output=True, text=True\n",
|
| 593 |
+
" )\n",
|
| 594 |
+
" print(\"Output:\", result.stdout)\n",
|
| 595 |
+
" print(\"Error:\", result.stderr)\n",
|
| 596 |
+
"except subprocess.CalledProcessError as e:\n",
|
| 597 |
+
" print(\"Command failed with error code:\", e.returncode)\n",
|
| 598 |
+
" print(\"Output:\", e.stdout)\n",
|
| 599 |
+
" print(\"Error:\", e.stderr)\n"
|
| 600 |
+
]
|
| 601 |
+
},
|
| 602 |
{
|
| 603 |
"cell_type": "code",
|
| 604 |
"execution_count": null,
|