install using webui script, various improvements

Former-commit-id: aef0833b8619abcbb5524a8d912cbc8ae4876819 [formerly d2901a3e57]
Former-commit-id: f1e830eb42e1b737b8e412cc9fbe2c0d932094db
This commit is contained in:
Cyberes 2022-09-21 12:51:39 -06:00 committed by GitHub
parent 5b442ac285
commit 3647949428
1 changed files with 12 additions and 39 deletions

View File

@ -88,7 +88,7 @@
" %cd /notebooks/\n",
" !git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n",
"else: # update repo if already exists\n",
" print('stable-diffusion-webui already downloaded, updating')\n",
" print('stable-diffusion-webui already downloaded, updating...')\n",
" %cd /notebooks/stable-diffusion-webui\n",
" !git pull"
]
@ -115,27 +115,19 @@
"source": [
"%cd /notebooks/stable-diffusion-webui\n",
"%store -r model_storage_dir\n",
"!pip install -r requirements.txt\n",
"\n",
"if not os.path.exists('/notebooks/stable-diffusion-webui/repositories'): # download repositories if they don't exist\n",
" !mkdir /notebooks/stable-diffusion-webui/repositories\n",
" !git clone https://github.com/CompVis/stable-diffusion.git /notebooks/stable-diffusion-webui/repositories/stable-diffusion\n",
" !git clone https://github.com/CompVis/taming-transformers.git /notebooks/stable-diffusion-webui/repositories/taming-transformers\n",
" !git clone https://github.com/sczhou/CodeFormer.git /notebooks/stable-diffusion-webui/repositories/CodeFormer\n",
" !git clone https://github.com/salesforce/BLIP.git /notebooks/stable-diffusion-webui/repositories/BLIP\n",
"else: # update repositories if they do exist\n",
" print('Updating dependencies')\n",
" for dir in os.listdir('/notebooks/stable-diffusion-webui/repositories'):\n",
" %cd /notebooks/stable-diffusion-webui/repositories/$dir\n",
" !git pull\n",
" \n",
"!pip install -r /notebooks/stable-diffusion-webui/repositories/CodeFormer/requirements.txt\n",
"# Import launch.py which will automatically run the install script but not launch the WebUI.\n",
"# They require a few specific external git repo commits so we have to do it their way. \n",
"# I wish we could import the script and manage the install process ourselves but this is fine.\n",
"import launch\n",
"\n",
"# Download the GFPGAN face restorer.\n",
"if not os.path.exists('/notebooks/stable-diffusion-webui/GFPGANv1.3.pth'):\n",
" !wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth\n",
" !wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth -O /notebooks/stable-diffusion-webui/GFPGANv1.3.pth\n",
"else:\n",
" print('GFPGANv1.3.pth already downloaded')\n",
" \n",
"# Make sure your models storage directory exists\n",
"!mkdir -p $model_storage_dir"
]
},
@ -325,27 +317,6 @@
"!wget https://huggingface.co/naclbit/trinart_stable_diffusion_v2/resolve/main/trinart2_step115000.ckpt -O $model_storage_dir/trinart2_step115000.ckpt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Danbooru Lewd\n",
"\n",
"Focused on lewd images from Danbooru."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!apt update\n",
"!apt install -y aria2\n",
"%cd $model_storage_dir\n",
"!aria2c --seed-time=0 --max-overall-upload-limit=1K \"magnet:?xt=urn:btih:7SUHQKS2TBQ2NPVRVI5URE4L2HNBUZS6&dn=LD-70k-1e-pruned.ckpt&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce\""
]
},
{
"cell_type": "markdown",
"metadata": {
@ -365,9 +336,10 @@
"\n",
"# Get some storage back\n",
"!pip cache purge\n",
"!sudo apt-get clean\n",
"!rm $model_storage_dir/*.aria2\n",
"!apt autoremove --purge -y aria2\n",
"!apt remove --purge -y aria2\n",
"!apt autoremove --purge -y\n",
"!sudo apt-get clean\n",
"\n",
"# Restart the kernel\n",
"import os\n",
@ -439,6 +411,7 @@
"outputs": [],
"source": [
"%store -r model_storage_dir\n",
"%cd /notebooks/stable-diffusion-webui\n",
"!python /notebooks/stable-diffusion-webui/webui.py --share # --disable-opt-split-attention"
]
},