Spaces:
Runtime error
Runtime error
Lőrinc Pap
commited on
Simplify version check and make gdrive loading optional
Browse files- LLaMA_LoRA.ipynb +16 -19
LLaMA_LoRA.ipynb
CHANGED
|
@@ -60,20 +60,15 @@
|
|
| 60 |
"# @title A small workaround { display-mode: \"form\" }\n",
|
| 61 |
"# @markdown Don't panic if you see an error here. Just click the `RESTART RUNTIME` button in the output below, then Run All again.\n",
|
| 62 |
"# @markdown The error will disappear on the next run.\n",
|
| 63 |
-
"
|
| 64 |
"\n",
|
|
|
|
| 65 |
"import PIL\n",
|
| 66 |
-
"major, minor = map(float, PIL.__version__.split(\".\")[:2])\n",
|
| 67 |
-
"version_float = major + minor / 10**len(str(minor))\n",
|
| 68 |
-
"print('PIL', version_float)\n",
|
| 69 |
-
"if version_float < 9.003:\n",
|
| 70 |
-
" raise Exception(\"Restart the runtime by clicking the 'RESTART RUNTIME' button above (or Runtime > Restart Runtime).\")\n",
|
| 71 |
-
"\n",
|
| 72 |
"import numpy\n",
|
| 73 |
-
"
|
| 74 |
-
"
|
| 75 |
-
"print(
|
| 76 |
-
"if
|
| 77 |
" raise Exception(\"Restart the runtime by clicking the 'RESTART RUNTIME' button above (or Runtime > Restart Runtime).\")"
|
| 78 |
],
|
| 79 |
"metadata": {
|
|
@@ -144,15 +139,17 @@
|
|
| 144 |
"# colab_notebook_name = remove_ipynb_extension(colab_notebook_filename)\n",
|
| 145 |
"\n",
|
| 146 |
"from google.colab import drive\n",
|
| 147 |
-
"
|
|
|
|
| 148 |
"\n",
|
| 149 |
-
"
|
| 150 |
-
"
|
| 151 |
-
"
|
| 152 |
-
"!
|
| 153 |
-
"!
|
| 154 |
-
"!
|
| 155 |
-
"
|
|
|
|
| 156 |
],
|
| 157 |
"metadata": {
|
| 158 |
"id": "iZmRtUY68U5f"
|
|
|
|
| 60 |
"# @title A small workaround { display-mode: \"form\" }\n",
|
| 61 |
"# @markdown Don't panic if you see an error here. Just click the `RESTART RUNTIME` button in the output below, then Run All again.\n",
|
| 62 |
"# @markdown The error will disappear on the next run.\n",
|
| 63 |
+
"%pip install Pillow==9.3.0 numpy==1.23.5\n",
|
| 64 |
"\n",
|
| 65 |
+
"import pkg_resources as r\n",
|
| 66 |
"import PIL\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
"import numpy\n",
|
| 68 |
+
"for module, min_version in [(PIL, \"9.3\"), (numpy, \"1.23\")]:\n",
|
| 69 |
+
" lib_version = r.parse_version(module.__version__)\n",
|
| 70 |
+
" print(module.__name__, lib_version)\n",
|
| 71 |
+
" if lib_version < r.parse_version(min_version):\n",
|
| 72 |
" raise Exception(\"Restart the runtime by clicking the 'RESTART RUNTIME' button above (or Runtime > Restart Runtime).\")"
|
| 73 |
],
|
| 74 |
"metadata": {
|
|
|
|
| 139 |
"# colab_notebook_name = remove_ipynb_extension(colab_notebook_filename)\n",
|
| 140 |
"\n",
|
| 141 |
"from google.colab import drive\n",
|
| 142 |
+
"try:\n",
|
| 143 |
+
" drive.mount(google_drive_mount_path)\n",
|
| 144 |
"\n",
|
| 145 |
+
" google_drive_data_directory_relative_path = google_drive_folder\n",
|
| 146 |
+
" google_drive_data_directory_path = f\"{google_drive_mount_path}/My Drive/{google_drive_data_directory_relative_path}\"\n",
|
| 147 |
+
" !mkdir -p \"{google_drive_data_directory_path}\"\n",
|
| 148 |
+
" !ln -nsf \"{google_drive_data_directory_path}\" ./data\n",
|
| 149 |
+
" !touch \"data/This folder is used by the Colab notebook \\\"{colab_notebook_filename}\\\".txt\"\n",
|
| 150 |
+
" !echo \"Data will be stored in Google Drive folder: \\\"{google_drive_data_directory_relative_path}\\\", which is mounted under \\\"{google_drive_data_directory_path}\\\"\"\n",
|
| 151 |
+
"except Exception as e:\n",
|
| 152 |
+
" print(\"Drive won't be mounted!\")"
|
| 153 |
],
|
| 154 |
"metadata": {
|
| 155 |
"id": "iZmRtUY68U5f"
|