stable-diffusion
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| stable-diffusion [2025/02/21 00:00] – [Prerequisites] jianwu | stable-diffusion [2025/02/25 05:09] (current) – jianwu | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{navi> | + | [[https:// |
| - | < | + | |
| - | < | + | |
| - | .dokuwiki { | + | |
| - | font-size: 1.200em; | + | |
| - | } | + | |
| - | </ | + | |
| - | </ | + | |
| ====== Stable Diffusion Version 2 - Run locally. Abandon if this doesn' | ====== Stable Diffusion Version 2 - Run locally. Abandon if this doesn' | ||
| Line 70: | Line 63: | ||
| [[https:// | [[https:// | ||
| - | <note important> | + | :!: python3.10.6 was recommended, |
| - | [IMPORTANT]\\ | + | |
| - | python3.10.6 was recommended, | + | |
| - | nevertheless 2023/09/03 Operation has been confirmed in python3.11.4 | + | |
| - | </ | + | |
| [[python-installation|Python Installation]] | [[python-installation|Python Installation]] | ||
| Line 88: | Line 77: | ||
| Make conda environment for stable diffusion | Make conda environment for stable diffusion | ||
| - | <note important> | + | :!: to activate conda environment, |
| - | [IMPORTANT]\\ | + | |
| - | to activate conda environment, | + | |
| - | </ | + | |
| Here we use environment name '' | Here we use environment name '' | ||
| - | < | + | < |
| E:\> conda create --name webui_env python==3.10.6 | E:\> conda create --name webui_env python==3.10.6 | ||
| </ | </ | ||
| Location of envs are | Location of envs are | ||
| - | < | + | < |
| C: | C: | ||
| </ | </ | ||
| activate env | activate env | ||
| - | < | + | < |
| E:\> conda activate webui_env | E:\> conda activate webui_env | ||
| </ | </ | ||
| for reference | for reference | ||
| - | < | + | < |
| (webui_env) E:> conda list | (webui_env) E:> conda list | ||
| # packages in environment at C: | # packages in environment at C: | ||
| Line 136: | Line 122: | ||
| </ | </ | ||
| and maybe followings are needed. | and maybe followings are needed. | ||
| - | < | + | < |
| - | conda config --append channels conda-forge | + | > conda config --append channels conda-forge |
| - | conda config --append channels nvidia | + | > conda config --append channels nvidia |
| </ | </ | ||
| Line 147: | Line 133: | ||
| === installing stablediffusion === | === installing stablediffusion === | ||
| installing stablediffusion using requirements.txt | installing stablediffusion using requirements.txt | ||
| - | < | + | < |
| (webui_env) E:\> mkdir stable_diffusion | (webui_env) E:\> mkdir stable_diffusion | ||
| (webui_env) E:\> cd stable_diffusion | (webui_env) E:\> cd stable_diffusion | ||
| Line 155: | Line 141: | ||
| </ | </ | ||
| - | <note important> | + | |
| - | [IMPORTANT]\\ | + | :!: if you got following error |
| - | if you got following error | + | |
| ... | ... | ||
| running build_rust | running build_rust | ||
| Line 164: | Line 149: | ||
| You need to Install Rust from | You need to Install Rust from | ||
| [[https:// | [[https:// | ||
| - | </ | ||
| === Installing NVIDIA CUDA Toolkit === | === Installing NVIDIA CUDA Toolkit === | ||
| Line 175: | Line 159: | ||
| and execute following command | and execute following command | ||
| - | < | + | < |
| (webui_env) E: | (webui_env) E: | ||
| </ | </ | ||
| Line 194: | Line 178: | ||
| It says | It says | ||
| - | < | + | < |
| - | pip3 install --pre torch torchvision torchaudio --index-url https:// | + | > pip3 install --pre torch torchvision torchaudio --index-url https:// |
| </ | </ | ||
| But we execute more precisely, | But we execute more precisely, | ||
| - | < | + | < |
| (webui_env) E: | (webui_env) E: | ||
| </ | </ | ||
| - | <note important> | + | :!: This is one of the most important checkpoints. At this point torch.cuda should be available. Check it! |
| - | [IMPORTANT]\\ | + | < |
| - | This is one of the most important checkpoints. | + | |
| - | At this point torch.cuda should be available. | + | |
| - | Check it! | + | |
| - | </ | + | |
| - | < | + | |
| (webui_env) E: | (webui_env) E: | ||
| >>> | >>> | ||
| Line 217: | Line 196: | ||
| </ | </ | ||
| for reference | for reference | ||
| - | < | + | < |
| (webui_env) E: | (webui_env) E: | ||
| open-clip-torch | open-clip-torch | ||
| Line 228: | Line 207: | ||
| === Installing xFormers === | === Installing xFormers === | ||
| - | < | + | :!: You don't need to do this, if you only use with webui. |
| - | You don't need to do this, if you only use with webui. | + | < |
| - | </ | + | |
| - | < | + | |
| (webui_env) E: | (webui_env) E: | ||
| Successfully installed xformers-0.0.22+cfad52d.d2023090 | Successfully installed xformers-0.0.22+cfad52d.d2023090 | ||
| Line 238: | Line 215: | ||
| === Installing diffusers === | === Installing diffusers === | ||
| - | < | + | < |
| (webui_env) E: | (webui_env) E: | ||
| Successfully uninstalled transformers-4.19.2 | Successfully uninstalled transformers-4.19.2 | ||
| Line 256: | Line 233: | ||
| download '' | download '' | ||
| from [[https:// | from [[https:// | ||
| - | < | + | < |
| (webui_env) E: | (webui_env) E: | ||
| </ | </ | ||
| - | <note warning> | + | :!: txt2img.py makes 9 images. So it takes so much time and large memory. [[stable-diffusion# |
| - | [WARNING] | + | |
| - | txt2img.py makes 9 images. So it takes so much time and large memory. [[stable-diffusion# | + | |
| - | </ | + | |
| === scripts/ | === scripts/ | ||
| we need to download [[https:// | we need to download [[https:// | ||
| - | < | + | < |
| (webui_env) E: | (webui_env) E: | ||
| outputs/ | outputs/ | ||
| Line 277: | Line 251: | ||
| [[https:// | [[https:// | ||
| - | < | + | < |
| (webui_env) E: | (webui_env) E: | ||
| (webui_env) E: | (webui_env) E: | ||
| Line 287: | Line 261: | ||
| '' | '' | ||
| - | < | + | < |
| @echo off | @echo off | ||
| Line 298: | Line 272: | ||
| call webui.bat | call webui.bat | ||
| </ | </ | ||
| - | <note important> | + | :!: We need to install xformers for webui.And It should be 0.0.20 not 0.0.22 at current condition. |
| - | [IMPORTANT] | + | |
| - | We need to install xformers for webui.And It should be 0.0.20 not 0.0.22 at current condition. | + | |
| - | </ | + | |
| then execute '' | then execute '' | ||
| - | < | + | < |
| (webui_env) E: | (webui_env) E: | ||
| Running on local URL: http:// | Running on local URL: http:// | ||
| Line 315: | Line 286: | ||
| for reference | for reference | ||
| - | < | + | < |
| (webui_env) E: | (webui_env) E: | ||
| >>> | >>> | ||
| Line 324: | Line 295: | ||
| >>> | >>> | ||
| </ | </ | ||
| - | < | + | < |
| (webui_env) E: | (webui_env) E: | ||
| open-clip-torch | open-clip-torch | ||
| Line 337: | Line 308: | ||
| followings are checked by programs | followings are checked by programs | ||
| - | < | + | < |
| CUDA_HOME = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2 | CUDA_HOME = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2 | ||
| CUDA_PATH = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8 | CUDA_PATH = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8 | ||
| Line 345: | Line 316: | ||
| </ | </ | ||
| maybe not correnponding | maybe not correnponding | ||
| - | < | + | < |
| CUDA_PATH_V11_8 = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8 | CUDA_PATH_V11_8 = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8 | ||
| CUDA_PATH_V12_2 = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2 | CUDA_PATH_V12_2 = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2 | ||
| Line 355: | Line 326: | ||
| If you got error like following, | If you got error like following, | ||
| - | < | + | < |
| torch.cuda.OutOfMemoryError: | torch.cuda.OutOfMemoryError: | ||
| </ | </ | ||
| edit windows system environment variables | edit windows system environment variables | ||
| - | < | + | < |
| set PYTORCH_NO_CUDA_MEMORY_CACHING=1 | set PYTORCH_NO_CUDA_MEMORY_CACHING=1 | ||
| Line 367: | Line 338: | ||
| </ | </ | ||
| - | < | + | :!: About '' |
| - | About '' | + | |
| '' | '' | ||
| Line 377: | Line 347: | ||
| That can ensure the feasibility of running large images while maximizing performance. | That can ensure the feasibility of running large images while maximizing performance. | ||
| - | </ | ||
| ==== venv folder ==== | ==== venv folder ==== | ||
| If you change some environments and use the same directory, you should delete the '' | If you change some environments and use the same directory, you should delete the '' | ||
| - | < | + | < |
| stable-diffusion-webui\venv | stable-diffusion-webui\venv | ||
| </ | </ | ||
stable-diffusion.1740063632.txt.gz · Last modified: 2025/02/21 00:00 by jianwu