User Tools

Site Tools


stable-diffusion

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
stable-diffusion [2025/02/21 00:07] – [download & installation] jianwustable-diffusion [2025/02/25 05:09] (current) jianwu
Line 1: Line 1:
-{{navi>navigationmenu}} +[[https://pctresearch.com/|{{:banner_image.jpg?nolink&800|}}]]
-<HTML> +
-<style> +
-  .dokuwiki { +
-    font-size1.200em;  /*it was 0.875 in design.less*/ +
-} +
-</style> +
-</HTML>+
  
 ====== Stable Diffusion Version 2 - Run locally. Abandon if this doesn't work. ====== ====== Stable Diffusion Version 2 - Run locally. Abandon if this doesn't work. ======
Line 240: Line 233:
 download ''v2-1_768-ema-pruned.ckpt'' download ''v2-1_768-ema-pruned.ckpt''
 from [[https://huggingface.co/stabilityai/stable-diffusion-2-1/blob/main/v2-1_768-ema-pruned.ckpt|stabilityai/stable-diffusion-2-1]] from [[https://huggingface.co/stabilityai/stable-diffusion-2-1/blob/main/v2-1_768-ema-pruned.ckpt|stabilityai/stable-diffusion-2-1]]
-<code Bash>+<code Dos>
 (webui_env) E:\stable_diffusion\stablediffusion> python scripts/txt2img.py --prompt "a professional photograph of an astronaut riding a horse" --ckpt "E:\difwork\SD2.1-v\v2-1_768-ema-pruned.ckpt" --config "E:\stable_diffusion\stablediffusion\configs\stable-diffusion\v2-inference-v.yaml" --H 768 --W 768 --device cuda (webui_env) E:\stable_diffusion\stablediffusion> python scripts/txt2img.py --prompt "a professional photograph of an astronaut riding a horse" --ckpt "E:\difwork\SD2.1-v\v2-1_768-ema-pruned.ckpt" --config "E:\stable_diffusion\stablediffusion\configs\stable-diffusion\v2-inference-v.yaml" --H 768 --W 768 --device cuda
 </code> </code>
-<note warning> +:!: txt2img.py makes 9 images. So it takes so much time and large memory. [[stable-diffusion#Out of memory|''Trouble shooting of Out of memory'']]. If you can't fix this error,skip this.
-[WARNING] +
-txt2img.py makes 9 images. So it takes so much time and large memory. [[stable-diffusion#Out of memory|''Trouble shooting of Out of memory'']]. If you can't fix this error,skip this. +
-</note>+
  
 === scripts/img2img.py === === scripts/img2img.py ===
  
 we need to download [[https://huggingface.co/stabilityai/stable-diffusion-2-1-base/blob/main/v2-1_512-ema-pruned.ckpt|SD2.1-base\v2-1_512-ema-pruned.ckpt]] we need to download [[https://huggingface.co/stabilityai/stable-diffusion-2-1-base/blob/main/v2-1_512-ema-pruned.ckpt|SD2.1-base\v2-1_512-ema-pruned.ckpt]]
-<code Bash>+<code Dos>
 (webui_env) E:\stable_diffusion\stablediffusion> python scripts/img2img.py --prompt "To create a commentary on modern technology and classical art, use an art style like Pop Art that often addresses cultural themes. Clearly mention the juxtaposition of elements. Pop Art painting of a modern smartphone with classic art pieces appearing on the screen." --init-img "E:\difwork\SD2.1-base\sample.png" --strength 0.8 --ckpt "E:\difwork\SD2.1-base\v2-1_512-ema-pruned.ckpt" (webui_env) E:\stable_diffusion\stablediffusion> python scripts/img2img.py --prompt "To create a commentary on modern technology and classical art, use an art style like Pop Art that often addresses cultural themes. Clearly mention the juxtaposition of elements. Pop Art painting of a modern smartphone with classic art pieces appearing on the screen." --init-img "E:\difwork\SD2.1-base\sample.png" --strength 0.8 --ckpt "E:\difwork\SD2.1-base\v2-1_512-ema-pruned.ckpt"
 outputs/img2img-samples outputs/img2img-samples
Line 261: Line 251:
 [[https://github.com/AUTOMATIC1111/stable-diffusion-webui|stable-diffusion-webui]] [[https://github.com/AUTOMATIC1111/stable-diffusion-webui|stable-diffusion-webui]]
  
-<code Bash>+<code Dos>
 (webui_env) E:\stable_diffusion\stablediffusion> cd .. (webui_env) E:\stable_diffusion\stablediffusion> cd ..
 (webui_env) E:\stable_diffusion> git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git (webui_env) E:\stable_diffusion> git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
Line 271: Line 261:
  
 ''webui-user.bat'': ''webui-user.bat'':
-<code Bash>+<code Dos>
 @echo off @echo off
  
Line 282: Line 272:
 call webui.bat call webui.bat
 </code> </code>
-<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. +
-</note>+
  
 then execute ''webui-user.bat'' then execute ''webui-user.bat''
-<code Bash>+<code Dos>
 (webui_env) E:\stable_diffusion\stable-diffusion-webui> webui-user.bat (webui_env) E:\stable_diffusion\stable-diffusion-webui> webui-user.bat
               Running on local URL:  http://127.0.0.1:7860               Running on local URL:  http://127.0.0.1:7860
Line 299: Line 286:
  
 for reference for reference
-<code Bash>+<code Dos>
 (webui_env) E:\webui\stable-diffusion-webui>python (webui_env) E:\webui\stable-diffusion-webui>python
 >>> import torch >>> import torch
Line 308: Line 295:
 >>> exit() >>> exit()
 </code> </code>
-<code Bash>+<code Dos>
 (webui_env) E:\webui\stable-diffusion-webui>conda list | findstr torch (webui_env) E:\webui\stable-diffusion-webui>conda list | findstr torch
 open-clip-torch           2.7.0                    pypi_0    pypi open-clip-torch           2.7.0                    pypi_0    pypi
Line 321: Line 308:
  
 followings are checked by programs followings are checked by programs
-<code Bash>+<code Dos>
 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 329: Line 316:
 </code> </code>
 maybe not correnponding maybe not correnponding
-<code Bash>+<code Dos>
 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 351: Line 338:
 </code> </code>
  
-<note> +:!: About ''max_split_size_mb''
-About ''max_split_size_mb''+
  
 ''max_split_size_mb'' prevents the native allocator from splitting blocks larger than this size (in MB). ''max_split_size_mb'' prevents the native allocator from splitting blocks larger than this size (in MB).
Line 361: 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.
-</note> 
  
 ==== venv folder ==== ==== venv folder ====
  
 If you change some environments and use the same directory, you should delete the ''venv'' folder completely. If you change some environments and use the same directory, you should delete the ''venv'' folder completely.
-<code Bash>+<code Dos>
 stable-diffusion-webui\venv stable-diffusion-webui\venv
 </code> </code>
stable-diffusion.1740064048.txt.gz · Last modified: 2025/02/21 00:07 by jianwu