diff --git a/StableDiffusionUI_Voldemort_paperspace.ipynb b/StableDiffusionUI_Voldemort_paperspace.ipynb index 7cd497f..6942b52 100644 --- a/StableDiffusionUI_Voldemort_paperspace.ipynb +++ b/StableDiffusionUI_Voldemort_paperspace.ipynb @@ -144,7 +144,9 @@ "tags": [] }, "source": [ - "## Clone the WebUI repository" + "## Clone the WebUI repository\n", + "\n", + "If you get an error that says something like \"fatal: destination path already exists and is not an empty directory\", the `.git` folder is missing. Please delete `repo_storage_dir/stable-diffusion-webui` and reinstall." ] }, { @@ -174,7 +176,7 @@ "repo_storage_dir = Path(repo_storage_dir)\n", "stable_diffusion_webui_path = repo_storage_dir / 'stable-diffusion-webui'\n", "\n", - "if not stable_diffusion_webui_path.exists():\n", + "if not (stable_diffusion_webui_path / '.git').exists():\n", " !mkdir -p \"{stable_diffusion_webui_path}\"\n", " !git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui \"{stable_diffusion_webui_path}\"\n", "else:\n", @@ -249,6 +251,9 @@ "\n", "import os\n", "\n", + "# Uninstall PyTorch so the WebUI can install the version it wants\n", + "!pip uninstall -y torch torchvision torchaudio\n", + "\n", "# Import launch.py which will automatically run the install script but not launch the WebUI.\n", "import launch\n", "launch.prepare_environment()\n", @@ -261,12 +266,7 @@ " # https://github.com/KichangKim/DeepDanbooru/releases\n", " !pip install \"git+https://github.com/KichangKim/DeepDanbooru.git@v3-20211112-sgd-e28#egg=deepdanbooru[tensorflow]\" # $(curl --silent \"https://api.github.com/KichangKim/DeepDanbooru/releases/latest\" | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\\1/')#egg=deepdanbooru[tensorflow]\" # tensorflow==2.10.0 tensorflow-io==0.27.0 flatbuffers==1.12\n", "\n", - "# latent-diffusion is a requirement but launch.py isn't downloading it so we'll do it manually.\n", - "# TODO: can this be removed?\n", - "# if not os.path.exists(f'{repo_storage_dir}/stable-diffusion-webui/repositories/latent-diffusion'):\n", - "# !git clone https://github.com/crowsonkb/k-diffusion.git \"{repo_storage_dir}/stable-diffusion-webui/repositories/k-diffusion\"\n", - "# !git clone https://github.com/Hafiidz/latent-diffusion.git \"{repo_storage_dir}/stable-diffusion-webui/repositories/latent-diffusion\"\n", - "\n", + "# We need to install xformers first so that the WebUI installer can install the correct version of PyTorch afterwards\n", "if activate_xformers:\n", " print('Installing xformers...')\n", " import subprocess\n", @@ -310,7 +310,9 @@ " print('GPU not matched to xformers binary so a one-size-fits-all binary was installed. If you have any issues, please build xformers using the Tools block below.')\n", " xformers_whl = download_release('https://raw.githubusercontent.com/Cyberes/xformers-compiled/main/various/xformers-0.0.14.dev0-cp37-cp37m-linux_x86_64.whl')\n", " if xformers_whl:\n", - " !pip install --force-reinstall \"{xformers_whl}\"\n", + " # We're going to install xformers without installing any of its dependencies since they should already be installed.\n", + " # If you have any issues then replacing --no-dependencies with --force-reinstall\n", + " !pip install --no-dependencies \"{xformers_whl}\"\n", " if delete_whl:\n", " !rm -rf \"{xformers_whl}\"\n", "\n", @@ -1142,7 +1144,7 @@ "queue = '--gradio-queue' if gradio_queue else ''\n", "\n", "# Launch args go below:\n", - "!python webui.py {x_arg} {dd_arg} {mvram_arg} {pickled} {port} {auth} {theme} {queue} # --gradio-debug" + "!python webui.py {x_arg} {dd_arg} {mvram_arg} {pickled} {port} {auth} {theme} {queue}" ] }, { @@ -1260,6 +1262,7 @@ { "cell_type": "markdown", "metadata": { + "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ @@ -1376,7 +1379,7 @@ " # clean exit here\n", "elif web_match:\n", " # Always do the web match last\n", - " with requests.get(web_match, allow_redirects=True, stream=True, headers={'User-Agent': user_agent}) as r:\n", + " with requests.get(web_match[0], allow_redirects=True, stream=True, headers={'User-Agent': user_agent}) as r:\n", " # Uing GET since some servers respond differently to HEAD.\n", " # Using `with` so we can close the connection and not download the entire file.\n", " response = r\n", @@ -1578,7 +1581,7 @@ "LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)\n", "echo \"Building version: $LATEST_TAG\"\n", "\n", - "XFORMERS_DISABLE_FLASH_ATTN=1 NVCC_FLAGS=\"--use_fast_math -DXFORMERS_MEM_EFF_ATTENTION_DISABLE_BACKWARD\" MAX_JOBS=$(nproc) pip wheel --wheel-dir=\"$TMP\" \"git+https://github.com/facebookresearch/xformers.git@$LATEST_TAG#egg=xformers\"\n", + "XFORMERS_DISABLE_FLASH_ATTN=1 NVCC_FLAGS=\"--use_fast_math -DXFORMERS_MEM_EFF_ATTENTION_DISABLE_BACKWARD\" MAX_JOBS=$(nproc) pip wheel --no-dependencies --wheel-dir=\"$TMP\" \"git+https://github.com/facebookresearch/xformers.git@$LATEST_TAG#egg=xformers\"\n", "if [[ $? -eq 0 ]]; then\n", " echo -e \"Finished!\\nMoving .whl to /notebooks/\"\n", " cp \"$TMP\"/xformers-* /notebooks/\n", @@ -1734,7 +1737,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.9.13" } }, "nbformat": 4,