mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Update Stable_Diffusion_AI_Notebook.ipynb
Making Stable_Diffusion_AI_Notebook.ipynb work smoothly on Google Colab
This commit is contained in:
parent
101cac6a21
commit
c15a902e8d
@ -58,7 +58,7 @@
|
|||||||
"from os.path import exists\n",
|
"from os.path import exists\n",
|
||||||
"\n",
|
"\n",
|
||||||
"!git clone --quiet https://github.com/invoke-ai/InvokeAI.git # Original repo\n",
|
"!git clone --quiet https://github.com/invoke-ai/InvokeAI.git # Original repo\n",
|
||||||
"%cd /content/stable-diffusion/\n",
|
"%cd /content/InvokeAI/\n",
|
||||||
"!git checkout --quiet tags/release-1.14.1"
|
"!git checkout --quiet tags/release-1.14.1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -79,6 +79,7 @@
|
|||||||
"!pip install colab-xterm\n",
|
"!pip install colab-xterm\n",
|
||||||
"!pip install -r requirements-lin-win-colab-CUDA.txt\n",
|
"!pip install -r requirements-lin-win-colab-CUDA.txt\n",
|
||||||
"!pip install clean-fid torchtext\n",
|
"!pip install clean-fid torchtext\n",
|
||||||
|
"!pip install transformers\n",
|
||||||
"gc.collect()"
|
"gc.collect()"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -106,7 +107,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"#@title 5. Load small ML models required\n",
|
"#@title 5. Load small ML models required\n",
|
||||||
"import gc\n",
|
"import gc\n",
|
||||||
"%cd /content/stable-diffusion/\n",
|
"%cd /content/InvokeAI/\n",
|
||||||
"!python scripts/preload_models.py\n",
|
"!python scripts/preload_models.py\n",
|
||||||
"gc.collect()"
|
"gc.collect()"
|
||||||
]
|
]
|
||||||
@ -171,18 +172,18 @@
|
|||||||
"import os \n",
|
"import os \n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Folder creation if it doesn't exist\n",
|
"# Folder creation if it doesn't exist\n",
|
||||||
"if exists(\"/content/stable-diffusion/models/ldm/stable-diffusion-v1\"):\n",
|
"if exists(\"/content/InvokeAI/models/ldm/stable-diffusion-v1\"):\n",
|
||||||
" print(\"❗ Dir stable-diffusion-v1 already exists\")\n",
|
" print(\"❗ Dir stable-diffusion-v1 already exists\")\n",
|
||||||
"else:\n",
|
"else:\n",
|
||||||
" %mkdir /content/stable-diffusion/models/ldm/stable-diffusion-v1\n",
|
" %mkdir /content/InvokeAI/models/ldm/stable-diffusion-v1\n",
|
||||||
" print(\"✅ Dir stable-diffusion-v1 created\")\n",
|
" print(\"✅ Dir stable-diffusion-v1 created\")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Symbolic link if it doesn't exist\n",
|
"# Symbolic link if it doesn't exist\n",
|
||||||
"if exists(\"/content/stable-diffusion/models/ldm/stable-diffusion-v1/model.ckpt\"):\n",
|
"if exists(\"/content/InvokeAI/models/ldm/stable-diffusion-v1/model.ckpt\"):\n",
|
||||||
" print(\"❗ Symlink already created\")\n",
|
" print(\"❗ Symlink already created\")\n",
|
||||||
"else: \n",
|
"else: \n",
|
||||||
" src = model_path\n",
|
" src = model_path\n",
|
||||||
" dst = '/content/stable-diffusion/models/ldm/stable-diffusion-v1/model.ckpt'\n",
|
" dst = '/content/InvokeAI/models/ldm/stable-diffusion-v1/model.ckpt'\n",
|
||||||
" os.symlink(src, dst) \n",
|
" os.symlink(src, dst) \n",
|
||||||
" print(\"✅ Symbolic link created successfully\")"
|
" print(\"✅ Symbolic link created successfully\")"
|
||||||
]
|
]
|
||||||
@ -233,7 +234,7 @@
|
|||||||
"%matplotlib inline\n",
|
"%matplotlib inline\n",
|
||||||
"\n",
|
"\n",
|
||||||
"images = []\n",
|
"images = []\n",
|
||||||
"for img_path in sorted(glob.glob('/content/stable-diffusion/outputs/img-samples/*.png'), reverse=True):\n",
|
"for img_path in sorted(glob.glob('/content/InvokeAI/outputs/img-samples/*.png'), reverse=True):\n",
|
||||||
" images.append(mpimg.imread(img_path))\n",
|
" images.append(mpimg.imread(img_path))\n",
|
||||||
"\n",
|
"\n",
|
||||||
"images = images[:15] \n",
|
"images = images[:15] \n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user