Recently, I took over a project that needs to use Stable Diffusion, and I need to redeploy a set of SD environment. This is not quite the same as my previous SD deployment, and I encountered some problems during the deployment process, and summarized a more perfect installation plan, which I'd like to share with you here.
Project address: https://github.com/AUTOMATIC1111/stable-diffusion-webui
environmental preparation
Before I start deploying, I use the following environment:
- Python 3.10.6 (this version is recommended to avoid some compatibility issues)
- NVIDIA RTX 4090 24GB
- Windows 11
- Native CUDA 12.4
deployment process
At first I was installing the dependencies one by one in a step-by-step fashion, but found it tedious to switch directories too many times. Then I wrote a simple script to automate the process.
First, clone the main project:
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
Conda environment creation
conda create -p .Dlab python=3.10.6 -y
Then create a dependency library directory:
mkdir -p repositories && cd repositories
Here's the auto-install script I wrote to get all the dependencies installed at once:
repos=(
"Stability-AI/stablediffusion:stable-diffusion-stability-ai"
"CompVis/taming-transformers:taming-transformers"
"sczhou/CodeFormer:CodeFormer"
"salesforce/BLIP:BLIP"
"Stability-AI/generative-models:generative-models"
)
for repo in "${repos[@]}"; do
IFS=':' read -r github_path local_path <<< "$repo"
echo "Cloning and installing $github_path..."
git clone "https://github.com/$github_path.git" "$local_path"
cd "$local_path"
pip install -e .
cd ...
done
The next step is to install the other necessary dependencies, these are the versions that I've summarized after stepping through the pits, and they work perfectly:
# installs the base dependencies
pip install transformers==4.19.2 diffusers invisible-watermark --prefer-binary
# k-diffusion must be installed from git.
pip install git+https://github.com/crowsonkb/k-diffusion.git --prefer-binary
# Go back to the home directory and install project dependencies
cd ...
pip install -r requirements.txt --prefer-binary
# These are the versions that I have tested over and over again, and I recommend installing them accordingly.
pip install pytorch_lightning==1.9
pip install -U xformers==0.0.28.post2 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/cu124
pip install pydantic==1.10.11
pip install wandb==0.15.12
Finally start the service:
python launch.py --xformers --no-gradio-queue
Pothole Record
- Dependency version conflict
The pitfall is the dependency versioning issue, in particular the versions of PyTorch and xformers have to match. The version combinations I listed above are tested over and over again and work perfectly. - network problem
Scientific Internet access. If you really can't download it, we recommend using a mirror source.
Chinese localization
Enter the interface and selectExtensions
ClickLoad from
(of cargo etc) load
locatezh_CN Localization
strike (on the keyboard)Install
Once installed you can see in the installed plugins screen the
Then come.User interface
interfaces
optionzh_CN
Apply settings and restart the UI
After restarting the webui, the interface is already in Chinese.
Generated images for testing and ran successfully!