check if model file already exists when symlinking

This commit is contained in:
Cyberes 2022-09-18 13:13:28 -06:00 committed by GitHub
parent 5903d6e885
commit 3faccc5afd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -11,7 +11,9 @@
"\n",
"Adapted from: https://colab.research.google.com/drive/1Iy-xW9t1-OQWhb0hNxueGij8phCyluOh\n",
"\n",
"In the Tools section at the bottom of the notebook there is a block to download the latest version of this notebook from Github.\n",
"**Updating the Notebook**\n",
"\n",
"In the Tools section at the bottom of the notebook there is a block to download the latest version from Github.\n",
"\n",
"**Guides**\n",
"- [Getting started on Paperspace](https://github.com/Engineer-of-Stuff/stable-diffusion-paperspace/blob/main/Docs/Paperspace%20Guide%20for%20Retards.md)\n",
@ -353,7 +355,7 @@
"source": [
"### Link the models directory\n",
"\n",
"If it says `failed to create symbolic link: File exists` that's fine. It means you've already ran this block."
"Create symlinks. The file will be stored in the models storage directory and linked to where the WebUI expects the files to be."
]
},
{
@ -366,6 +368,7 @@
"import os\n",
"for file in os.listdir(model_storage_dir):\n",
" if file.endswith(\"ckpt\"):\n",
" if not os.path.exists(f'/notebooks/stable-diffusion-webui/models/{file}'):\n",
" !ln -s $model_storage_dir/$file /notebooks/stable-diffusion-webui/models/$file\n",
" !ls -la --block-size=GB /notebooks/stable-diffusion-webui/models/$file"
]