Windows 2022
Sponsored Link

Stable Diffusion : Install2024/02/23


Install [Stable Diffusion] that is the Text-to-Image model of deep learning.


Install Python, refer to here.


Install CUDA, refer to here.

[3] Run PowerShell with Admin Privilege and work.
Install [Git] first.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\Administrator> Invoke-WebRequest -Uri "" -OutFile "Git-2.43.0-64-bit.exe" 

# install Git with silent mode
PS C:\Users\Administrator> ./Git-2.43.0-64-bit.exe /silent 

# installation processes are running
PS C:\Users\Administrator> Get-Process -Name "Git*", "setup*" 

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
    134      11     4820       7880       0.16   2284   0 Git-2.43.0-64-bit
    243      19    74912      89144      12.83   4256   0 Git-2.43.0-64-bit.tmp

# after finishing installation, processes above finish
PS C:\Users\Administrator> Get-Process -Name "Git*", "setup*" 

# reload environment variables
PS C:\Users\Administrator> $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") 

PS C:\Users\Administrator> git -v 
git version
[4] Install [Stable Diffusion].
# add firewall rule for Stable Diffusion
PS C:\Users\Administrator> New-NetFirewallRule `
-Name "Stable Diffusion Server Port" `
-DisplayName "Stable Diffusion Server Port" `
-Description 'Allow Stable Diffusion Server Port' `
-Profile Any `
-Direction Inbound `
-Action Allow `
-Protocol TCP `
-Program Any `
-LocalAddress Any `
-LocalPort 7860 

PS C:\Users\Administrator> git clone 
PS C:\Users\Administrator> cd stable-diffusion-webui 
PS C:\Users\Administrator\stable-diffusion-webui> pip3 install packaging 

# download a model
PS C:\Users\Administrator\stable-diffusion-webui> Invoke-WebRequest -Uri "" -OutFile "./models/Stable-diffusion/v1-5-pruned-emaonly.safetensors" 

# lowvram ⇒ add it if your Graphic Card has few amount of memory
# xformers ⇒ use library for performance improvement
# listen ⇒ listen on
# - if not specify the option, listen on
PS C:\Users\Administrator\stable-diffusion-webui> python --lowvram --xformers --listen 


Launching Web UI with arguments: --lowvram --xformers --listen
Style database not found: C:\Users\Administrator\stable-diffusion-webui\styles.csv
Calculating sha256 for C:\Users\Administrator\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors: Running on local URL:

To create a public link, set `share=True` in `launch()`.
Startup time: 23.8s (prepare environment: 4.0s, import torch: 6.7s, import gradio: 1.8s, setup paths: 2.1s, initialize shared: 0.5s, other imports: 1.4s, setup codeformer: 0.2s, load scripts: 1.9s, create ui: 0.9s, gradio launch: 4.3s).
Loading weights [6ce0161689] from C:\Users\Administrator\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors
Creating model from config: C:\Users\Administrator\stable-diffusion-webui\configs\v1-inference.yaml
Applying attention optimization: xformers... done.
Model loaded in 26.3s (calculate hash: 15.0s, load weights from disk: 0.4s, create model: 5.2s, apply weights to model: 3.2s, apply half(): 1.5s, calculate empty prompt: 0.9s).
[5] Access to the port 7860 that was shown on your command line, then you can use [Stable Diffusion].
[6] Input any text and click [Generate] button, then image will be generated.
The example below is [a Minotaur, rampaging, realistic].
Matched Content