Fix colab bugs
Browse files- finetune_model.ipynb +25 -9
finetune_model.ipynb
CHANGED
@@ -13,11 +13,10 @@
|
|
13 |
"metadata": {},
|
14 |
"outputs": [
|
15 |
{
|
16 |
-
"name": "
|
17 |
"output_type": "stream",
|
18 |
"text": [
|
19 |
-
"
|
20 |
-
" from .autonotebook import tqdm as notebook_tqdm\n"
|
21 |
]
|
22 |
}
|
23 |
],
|
@@ -32,7 +31,12 @@
|
|
32 |
"from huggingface_hub import snapshot_download\n",
|
33 |
"import os\n",
|
34 |
"import re\n",
|
35 |
-
"import
|
|
|
|
|
|
|
|
|
|
|
36 |
]
|
37 |
},
|
38 |
{
|
@@ -47,9 +51,21 @@
|
|
47 |
},
|
48 |
{
|
49 |
"cell_type": "code",
|
50 |
-
"execution_count":
|
51 |
"metadata": {},
|
52 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
"source": [
|
54 |
"current_read_path = \"./\"\n",
|
55 |
"current_write_path = \"./\"\n",
|
@@ -67,11 +83,11 @@
|
|
67 |
"\n",
|
68 |
" hugging_face_path = snapshot_download(\n",
|
69 |
" repo_id=\"USC-Applied-NLP-Group/SQL-Generation\",\n",
|
70 |
-
" repo_type=\"model\"
|
71 |
-
" allow_patterns=[\"
|
72 |
" )\n",
|
73 |
" sys.path.append(hugging_face_path)\n",
|
74 |
-
"
|
75 |
]
|
76 |
},
|
77 |
{
|
|
|
13 |
"metadata": {},
|
14 |
"outputs": [
|
15 |
{
|
16 |
+
"name": "stdout",
|
17 |
"output_type": "stream",
|
18 |
"text": [
|
19 |
+
"Note: you may need to restart the kernel to use updated packages.\n"
|
|
|
20 |
]
|
21 |
}
|
22 |
],
|
|
|
31 |
"from huggingface_hub import snapshot_download\n",
|
32 |
"import os\n",
|
33 |
"import re\n",
|
34 |
+
"import contextlib #helps make pip silent\n",
|
35 |
+
"import sys\n",
|
36 |
+
"import os\n",
|
37 |
+
"import numpy as np\n",
|
38 |
+
"with contextlib.redirect_stdout(sys.__stdout__), contextlib.redirect_stderr(sys.__stderr__):\n",
|
39 |
+
" %pip install datasets"
|
40 |
]
|
41 |
},
|
42 |
{
|
|
|
51 |
},
|
52 |
{
|
53 |
"cell_type": "code",
|
54 |
+
"execution_count": 3,
|
55 |
"metadata": {},
|
56 |
+
"outputs": [
|
57 |
+
{
|
58 |
+
"ename": "NameError",
|
59 |
+
"evalue": "name 'is_google_colab' is not defined",
|
60 |
+
"output_type": "error",
|
61 |
+
"traceback": [
|
62 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
63 |
+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
64 |
+
"Cell \u001b[0;32mIn[3], line 10\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mwrite_path\u001b[39m(rel_path):\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mjoin(current_write_path, rel_path)\n\u001b[0;32m---> 10\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_google_colab:\n\u001b[1;32m 11\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mgoogle\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcolab\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m drive\n\u001b[1;32m 12\u001b[0m drive\u001b[38;5;241m.\u001b[39mmount(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/content/drive\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
|
65 |
+
"\u001b[0;31mNameError\u001b[0m: name 'is_google_colab' is not defined"
|
66 |
+
]
|
67 |
+
}
|
68 |
+
],
|
69 |
"source": [
|
70 |
"current_read_path = \"./\"\n",
|
71 |
"current_write_path = \"./\"\n",
|
|
|
83 |
"\n",
|
84 |
" hugging_face_path = snapshot_download(\n",
|
85 |
" repo_id=\"USC-Applied-NLP-Group/SQL-Generation\",\n",
|
86 |
+
" repo_type=\"model\",\n",
|
87 |
+
" allow_patterns=[\"train-data/*\", \"deepseek-coder-1.3b-instruct/*\"], \n",
|
88 |
" )\n",
|
89 |
" sys.path.append(hugging_face_path)\n",
|
90 |
+
" current_read_path = hugging_face_path"
|
91 |
]
|
92 |
},
|
93 |
{
|