From 5df05050dae6ba8f75925ef0e4a45a3ecc42164b Mon Sep 17 00:00:00 2001
From: Cyberes <64224601+Cyberes@users.noreply.github.com>
Date: Wed, 9 Nov 2022 23:28:37 -0700
Subject: [PATCH] don't install cuda, minor polish
---
StableDiffusionUI_Voldemort_paperspace.ipynb | 73 +++++++++-----------
1 file changed, 32 insertions(+), 41 deletions(-)
diff --git a/StableDiffusionUI_Voldemort_paperspace.ipynb b/StableDiffusionUI_Voldemort_paperspace.ipynb
index 5dff55f..a66712f 100644
--- a/StableDiffusionUI_Voldemort_paperspace.ipynb
+++ b/StableDiffusionUI_Voldemort_paperspace.ipynb
@@ -42,9 +42,9 @@
"source": [
"**Where to store the models**\n",
"\n",
- "`/storage/` is persistent storage shared across all machines on your account.\n",
+ "`/storage/` is persistent storage shared across all machines on your account. Mounted to your machine.\n",
"\n",
- "`/notebooks/` is storage for this notebook only.\n",
+ "`/notebooks/` is storage for this notebook only. This directory has to be copied into your machine which can increase start/stop times if the directory is very large. To avoid this, put large files in `/storage/`.\n",
"\n",
"`/tmp/` is not a persistent directory, meaning your files there will be deleted when the machine turns off.\n",
"\n",
@@ -68,22 +68,22 @@
"outputs": [],
"source": [
"# Free tier\n",
- "# free_tier = True # Enables the creation of symlinks back to /notebooks/\n",
+ "# symlink_to_notebooks = True # Enables the creation of symlinks back to /notebooks/\n",
"# model_storage_dir = '/tmp/stable-diffusion/models' # Where the models will be downloaded to.\n",
"# repo_storage_dir = '/notebooks' # Where the repository will be downloaded to.\n",
"\n",
"# Paid Tier\n",
- "# free_tier = False\n",
+ "# symlink_to_notebooks = False\n",
"# model_storage_dir = '/storage/models'\n",
"# repo_storage_dir = '/notebooks'\n",
"\n",
"\n",
+ "# Other optional settings\n",
+ "# You don't have to change these if you don't want to\n",
+ "\n",
"activate_xformers = False # Enables the xformers optimizations using pre-built wheels.\n",
" # Setting to True will automatically set up your environment/machine for xformers. \n",
"\n",
- "xformers_leave_cuda = False # When installing xformers, skip installing cuda 11.3\n",
- " # Useful if your're re-running the install block and already installed cuda 11.3\n",
- "\n",
"link_novelai_anime_vae = False # Enables the linking of animevae.pt to each of the NovelAI models.\n",
" # Set to True if you've downloaded both the NovelAI models and hypernetworks.\n",
"\n",
@@ -101,10 +101,12 @@
"\n",
"gradio_port = False # Launch Gradio on a specific port. Set to False to let Gradio choose a port.\n",
" # This disables online Gradio app mode and you will only be able to access it on your local network.\n",
+ "\n",
+ "activate_extensions = False # Force enable extensions tab.\n",
" \n",
"# ===============================================================\n",
"# Save variables to Jupiter's temp storage so we can access it even if the kernel restarts.\n",
- "%store free_tier model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae download_scripts activate_deepdanbooru activate_medvram disable_pickle_check gradio_port xformers_leave_cuda"
+ "%store symlink_to_notebooks model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae download_scripts activate_deepdanbooru activate_medvram disable_pickle_check gradio_port activate_extensions"
]
},
{
@@ -135,7 +137,7 @@
"outputs": [],
"source": [
"import os\n",
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"%cd /notebooks/\n",
"\n",
"def delete_broken_symlinks(path):\n",
@@ -155,7 +157,7 @@
" !cd \"{path}\" && git pull # no % so we don't interfere with the main process\n",
"\n",
"def init_free():\n",
- " if (free_tier and repo_storage_dir != '/notebooks'):\n",
+ " if (symlink_to_notebooks and repo_storage_dir != '/notebooks'):\n",
" delete_broken_symlinks('/notebooks/') # remove broken symlinks since it might have been installed in a non-persistent directory\n",
" if not os.path.exists(repo_storage_dir):\n",
" !mkdir -p \"{repo_storage_dir}\"\n",
@@ -184,7 +186,7 @@
},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir activate_xformers download_scripts activate_deepdanbooru xformers_leave_cuda\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir activate_xformers download_scripts activate_deepdanbooru\n",
"%cd \"{repo_storage_dir}/stable-diffusion-webui\"\n",
"import os\n",
"\n",
@@ -269,18 +271,6 @@
" !wget \"{url}\" -O \"{tmp_dir}/{binary}\"\n",
" return os.path.join(tmp_dir, binary)\n",
"\n",
- " if not xformers_leave_cuda:\n",
- " print('Skipping installing cuda')\n",
- " # Completly remove cuda from your system\n",
- " # The container comes with cuda 11.2 installed which is incompatable with pytorch\n",
- " # We MUST install cuda 11.3\n",
- " !apt update\n",
- " !apt purge -y cuda*\n",
- " !apt autoremove --purge -y\n",
- " !wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004-keyring.gpg -O /usr/share/keyrings/cuda-archive-keyring.gpg\n",
- " !echo \"deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /\" | sudo tee /etc/apt/sources.list.d/cuda-ubuntu2004-x86_64.list\n",
- " # Reinstall the cuda packages we removed, but in version 11.3\n",
- " !apt update && apt install -y cuda-command-line-tools-11-3 cuda-compat-11-3 cuda-minimal-build-11-3 cuda-compiler-11-3 cuda-libraries-dev-11-3 cuda-cupti-dev-11-3 cuda-cupti-11-3 cuda-nvcc-11-3 cuda-cudart-dev-11-3 cuda-libraries-11-3 cuda-cudart-11-3 cuda-gdb-11-3 cuda-cuobjdump-11-3 cuda-cuxxfilt-11-3 cuda-driver-dev-11-3 cuda-memcheck-11-3 cuda-nvdisasm-11-3 cuda-nvml-dev-11-3 cuda-nvprof-11-3 cuda-nvprune-11-3 cuda-nvrtc-dev-11-3 cuda-nvrtc-11-3 cuda-nvtx-11-3 cuda-sanitizer-11-3\n",
" # Set up pip packages\n",
" !pip uninstall -y torch torchvision torchaudio # Remove existing pytorch install.\n",
" !pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113 # Install pytorch for cuda 11.3\n",
@@ -381,7 +371,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"!apt update\n",
"!apt install -y aria2\n",
"%cd \"{model_storage_dir}\"\n",
@@ -401,7 +391,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"!apt update\n",
"!apt install -y aria2\n",
"%cd \"{model_storage_dir}\"\n",
@@ -423,7 +413,7 @@
},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"!apt update\n",
"!apt install -y aria2\n",
"%cd \"{model_storage_dir}\"\n",
@@ -452,7 +442,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"!apt update\n",
"!apt install -y aria2\n",
"%cd \"{model_storage_dir}\"\n",
@@ -472,7 +462,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"!apt update\n",
"!apt install -y aria2\n",
"%cd \"{model_storage_dir}\"\n",
@@ -512,7 +502,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"!wget https://huggingface.co/naclbit/trinart_stable_diffusion_v2/resolve/main/trinart2_step60000.ckpt -O \"{model_storage_dir}/trinart2_step60000.ckpt\""
]
},
@@ -529,7 +519,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"!wget https://huggingface.co/naclbit/trinart_stable_diffusion_v2/resolve/main/trinart2_step95000.ckpt -O \"{model_storage_dir}/trinart2_step95000.ckpt\""
]
},
@@ -546,7 +536,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"!wget https://huggingface.co/naclbit/trinart_stable_diffusion_v2/resolve/main/trinart2_step115000.ckpt -O \"{model_storage_dir}/trinart2_step115000.ckpt\""
]
},
@@ -565,7 +555,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"!wget https://huggingface.co/naclbit/trinart_characters_19.2m_stable_diffusion_v1/resolve/main/trinart_characters_it4_v1.ckpt -O \"{model_storage_dir}/trinart_characters_it4_v1.ckpt\""
]
},
@@ -589,7 +579,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"!apt update\n",
"!apt install -y aria2\n",
"metalink = 'magnet:?xt=urn:btih:5bde442da86265b670a3e5ea3163afad2c6f8ecc&dn=novelaileak&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2F9.rarbg.com%3A2810%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A6969%2Fannounce&tr=http%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce'\n",
@@ -618,7 +608,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"!apt update\n",
"!apt install -y aria2\n",
"metalink = 'magnet:?xt=urn:btih:5bde442da86265b670a3e5ea3163afad2c6f8ecc&dn=novelaileak&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2F9.rarbg.com%3A2810%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A6969%2Fannounce&tr=http%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce'\n",
@@ -649,7 +639,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"!apt update\n",
"!apt install -y aria2\n",
"metalink = 'magnet:?xt=urn:btih:5bde442da86265b670a3e5ea3163afad2c6f8ecc&dn=novelaileak&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2F9.rarbg.com%3A2810%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A6969%2Fannounce&tr=http%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce'\n",
@@ -683,7 +673,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir\n",
"\n",
"# Get some storage back\n",
"!pip cache purge\n",
@@ -817,7 +807,7 @@
},
"outputs": [],
"source": [
- "%store -r model_storage_dir repo_storage_dir activate_xformers activate_deepdanbooru activate_medvram disable_pickle_check gradio_port\n",
+ "%store -r model_storage_dir repo_storage_dir activate_xformers activate_deepdanbooru activate_medvram disable_pickle_check gradio_port activate_extensions\n",
"%cd \"{repo_storage_dir}/stable-diffusion-webui\"\n",
"\n",
"# Enable optional args automatically based on settings\n",
@@ -826,9 +816,10 @@
"mvram_arg = '--medvram' if activate_medvram else ''\n",
"pickled = '--disable-safe-unpickle' if disable_pickle_check else ''\n",
"port = f'--port {gradio_port}' if gradio_port else '--share'\n",
+ "ext_arg = '--enable-insecure-extension-access' if activate_extensions else ''\n",
"\n",
"# Launch args go below:\n",
- "!python webui.py {x_arg} {dd_arg} {mvram_arg} {pickled} {port} --gradio-debug # --gradio-auth me:password1234"
+ "!python webui.py {x_arg} {dd_arg} {mvram_arg} {pickled} {port} {ext_arg} --gradio-debug # --gradio-auth me:password1234"
]
},
{
@@ -857,7 +848,7 @@
},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae\n",
"!apt update\n",
"!apt install -y p7zip-full\n",
"from datetime import datetime\n",
@@ -960,7 +951,7 @@
"metadata": {},
"outputs": [],
"source": [
- "%store -r free_tier model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae\n",
+ "%store -r symlink_to_notebooks model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae\n",
"%cd \"{repo_storage_dir}/stable-diffusion-webui\"\n",
"!git reset --hard "
]
@@ -1001,7 +992,7 @@
"outputs": [],
"source": [
"# Uncomment the lines below to run this block. You can highlight the lines and do ctrl + /\n",
- "# %store -r free_tier model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae\n",
+ "# %store -r symlink_to_notebooks model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae\n",
"# !rm -rf /storage/*\n",
"# !mv /notebooks/*.ipynb / # move the notebook out of the directory before we nuke it\n",
"# !rm -rf /notebooks/*\n",