From babae8583818d8ab1234f5dd6dca8a50f49d5acd Mon Sep 17 00:00:00 2001 From: Drake Panzer <64224601+Cyberes@users.noreply.github.com> Date: Fri, 10 Mar 2023 22:30:48 -0700 Subject: [PATCH] Add instructions on how to install python3.10 --- StableDiffusionUI_Voldemort_paperspace.ipynb | 49 ++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/StableDiffusionUI_Voldemort_paperspace.ipynb b/StableDiffusionUI_Voldemort_paperspace.ipynb index 2de4f90..ec6393b 100644 --- a/StableDiffusionUI_Voldemort_paperspace.ipynb +++ b/StableDiffusionUI_Voldemort_paperspace.ipynb @@ -81,6 +81,7 @@ "\n", "# Optional path settings\n", "repo_storage_dir = '/storage/stable-diffusion' # Where to store your Stable Diffusion-related files.\n", + " # The WebUI will be installed to repo_storage_dir/stable-diffusion-webui\n", "\n", "export_storage_dir = '/notebooks/exports' # Where the generated images will be exported to.\n", "\n", @@ -214,6 +215,44 @@ " print(os.path.realpath(dest), '->', dest)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Python 3.10\n", + "\n", + "Python 3.10 is the recommended Python version for running the WebUI. If you encounter any issues, maybe running the WebUI in Python 3.10 will help? Paperspace uses Python 3.9 for their containers so you must use a custom container.\n", + "\n", + "First, delete your current notebook and create a new one following these instructions: https://docs.paperspace.com/gradient/notebooks/runtimes/#how-to-specify-a-custom-container\n", + "\n", + "Make sure to use this container image: `cyberes/gradient-base-py3.10`\n", + "\n", + "You can use the block below to test your Python version." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Your Python version is less than 3.10 -> 3.9.13\n" + ] + } + ], + "source": [ + "import sys\n", + "version = sys.version.split(' ')[0]\n", + "v_parts = version.split('.')\n", + "if int(v_parts[1]) < 10:\n", + " print(f'Your Python version is less than 3.10 -> {version}')\n", + "else:\n", + " print('Your Python version is good:', version)" + ] + }, { "cell_type": "markdown", "metadata": { @@ -318,7 +357,7 @@ " 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", " # 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", + " # If you have issues with this step then try replacing --no-dependencies with --force-reinstall\n", " !pip install --no-dependencies \"{xformers_whl}\"\n", " if delete_whl:\n", " !rm -rf \"{xformers_whl}\"\n", @@ -1580,7 +1619,11 @@ "source": [ "If you're still encountering issues then try building it yourself using the next block. You can also try [my old script](https://github.com/Engineer-of-Stuff/stable-diffusion-paperspace/blob/master/other/build-xformers.sh).\n", "\n", - "This will take over 25 minutes but you should only have to do this once. Leave the Xformers `.whl` in `/notebooks/` and it will automatically be installed by the notebook's installer." + "This will take over 25 minutes but you should only have to do this once. Leave the Xformers `.whl` in `/notebooks/` and it will automatically be installed by the notebook's installer.\n", + "\n", + "To build a minimal version of the xformers library, add this in front of `MAX_JOBS=$(nproc)`\n", + "\n", + "`XFORMERS_DISABLE_FLASH_ATTN=1 NVCC_FLAGS=\"--use_fast_math -DXFORMERS_MEM_EFF_ATTENTION_DISABLE_BACKWARD\"`" ] }, { @@ -1600,7 +1643,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 --no-dependencies --wheel-dir=\"$TMP\" \"git+https://github.com/facebookresearch/xformers.git@$LATEST_TAG#egg=xformers\"\n", + "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",