Save medvram in settings, more docs, more settings

This commit is contained in:
Cyberes 2022-10-30 13:52:49 -06:00 committed by GitHub
parent 8c33fcc794
commit 7bcff87c45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 20 deletions

View File

@ -58,7 +58,7 @@
"\n",
"Select the section you want and do `ctrl + /` to uncomment.\n",
"\n",
"Make sure there isn't a space in front of any variable."
"Make sure there isn't a space in front of any variable. Don't put a trailing slash on directory paths. If you change any settings here, rerun this cell."
]
},
{
@ -73,9 +73,9 @@
"# repo_storage_dir = '/notebooks' # Where the repository will be downloaded to.\n",
"\n",
"# Paid Tier\n",
"# free_tier = False\n",
"# model_storage_dir = '/storage/models'\n",
"# repo_storage_dir = '/notebooks'\n",
"free_tier = False\n",
"model_storage_dir = '/storage/models'\n",
"repo_storage_dir = '/notebooks'\n",
"\n",
"\n",
"activate_xformers = False # Enables the xformers optimizations using pre-built wheels.\n",
@ -90,22 +90,27 @@
"activate_deepdanbooru = False # Enable and install DeepDanbooru -> https://github.com/KichangKim/DeepDanbooru\n",
"\n",
"activate_medvram = True # Enable medvram option.\n",
" # Set to False if VRAM capacity is available.\n",
" # These are model optimizations which will reduce VRAM usage at the expense of some speed.\n",
" # Set to False if you have a lot of VRAM.\n",
"\n",
"disable_pickle_check = False # Disable the automatic check for unexpected data in model files.\n",
" # Leave this set to False unless you have a reason to disable the check.\n",
"\n",
"# Don't put a trailing slash on directory paths.\n",
"# If you change any settings here, rerun this cell.\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",
"# ===============================================================\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"
"%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"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Don't forget, there's a script to update this notebook to [the latest version](https://github.com/Engineer-of-Stuff/stable-diffusion-paperspace/blob/main/StableDiffusionUI_Voldemort_paperspace.ipynb) on GitHub.**"
"<mark>If you see any errors please check your settings!</mark>\n",
"\n",
"**Don't forget, there's a block in the Tools section at the bottom to update this notebook to [the latest version](https://github.com/Engineer-of-Stuff/stable-diffusion-paperspace/blob/main/StableDiffusionUI_Voldemort_paperspace.ipynb) on GitHub.**"
]
},
{
@ -127,7 +132,7 @@
"outputs": [],
"source": [
"import os\n",
"%store -r free_tier model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae activate_deepdanbooru\n",
"%store -r free_tier model_storage_dir repo_storage_dir\n",
"%cd /notebooks/\n",
"\n",
"def delete_broken_symlinks(path):\n",
@ -176,7 +181,7 @@
},
"outputs": [],
"source": [
"%store -r free_tier model_storage_dir repo_storage_dir activate_xformers link_novelai_anime_vae download_scripts activate_deepdanbooru\n",
"%store -r free_tier 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",
@ -296,7 +301,7 @@
" !pip install --force-reinstall https://raw.githubusercontent.com/Cyberes/xformers-compiled/main/A6000/xformers-0.0.14.dev0-cp39-cp39-linux_x86_64.whl\n",
" else:\n",
" !pip install --force-reinstall https://raw.githubusercontent.com/Cyberes/xformers-compiled/main/various/xformers-0.0.14.dev0-cp37-cp37m-linux_x86_64.whl\n",
" 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",
" 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",
" # print('XFORMERS ERROR: no wheel built for your GPU! Xformers disabled.')\n",
" # activate_xformers = False\n",
" # %store activate_xformers\n",
@ -711,7 +716,7 @@
"metadata": {},
"outputs": [],
"source": [
"%store -r free_tier model_storage_dir repo_storage_dir link_novelai_anime_vae\n",
"%store -r model_storage_dir repo_storage_dir link_novelai_anime_vae\n",
"import os\n",
"import glob\n",
"\n",
@ -796,14 +801,12 @@
"source": [
"Run this block to launch the WebUI. You will get a link to nnn.gradio.app, that's your WebUI. Follow it.\n",
"\n",
"- See [webui.py](https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/modules/shared.py#L22) to view the code for the launch args. There's a lot of good info in there about exactly what the args do. If you aren't a programmer, [here's the wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Run-with-Custom-Parameters).\n",
"- If you have a lot of VRAM and desire high generation speeds, add `--disable-opt-split-attention` to disable VRAM optimizations.\n",
"- If you have a decent about of VRAM and aren't generating large images you can remove `--medvram` for a speed boost.\n",
"See [webui.py](https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/modules/shared.py#L22) to view the code for the launch args. There's a lot of good info in there about exactly what the args do. If you aren't a programmer, [here's the wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings).\n",
"\n",
"#### Troubleshooting\n",
"- If you have any issues, try restarting the kernel.\n",
"- `EOFError: Ran out of input` probably means you ran out of storage space and the model `.ckpt` file wasn't downloaded completely. Try cleaning up your files. There are some helpful scripts in the Tools section below.\n",
"- If you're having issues with your results not loading, that's a known bug. I used to suggest people use ngrok but apparently accounts were getting locked because tunneling proxies are against the terms of service even though the Paperspace terms of service doesn't mention anything like that. [More details in the Tools section below.](https://github.com/anderspitman/awesome-tunneling)"
"- `The file may be malicious, so the program is not going to read it` means the program encountered unexpected data in the model file (the technical term is \"pickle\"). Merging models can cause this. You can disable this feature by setting `disable_pickle_check` to True in the settings block. A pickel file can contain arbitrary code so be careful, you don't want to get pickled!"
]
},
{
@ -815,15 +818,18 @@
},
"outputs": [],
"source": [
"%store -r free_tier model_storage_dir repo_storage_dir activate_xformers activate_deepdanbooru\n",
"%store -r model_storage_dir repo_storage_dir activate_xformers activate_deepdanbooru activate_medvram disable_pickle_check gradio_port\n",
"%cd \"{repo_storage_dir}/stable-diffusion-webui\"\n",
"\n",
"# Enable optional args automatically\n",
"# Enable optional args automatically based on settings\n",
"x_arg = '--xformers' if activate_xformers else ''\n",
"dd_arg = '--deepdanbooru' if activate_deepdanbooru else ''\n",
"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",
"\n",
"# Launch args go below:\n",
"!python webui.py {x_arg} {dd_arg} {mvram_arg} --gradio-debug --share # --gradio-auth me:password1234"
"!python webui.py {x_arg} {dd_arg} {mvram_arg} {pickled} {port} --gradio-debug # --gradio-auth me:password1234"
]
},
{