Stablediffusion 2 — Make it work on your Linux
Stablediffusion 2 has been released few days ago and it is accessible here: https://github.com/Stability-AI/stablediffusion
Unfortunatly, the official documentation to make it works is complicated and.. it does not work except if you change few things that I explain here.
Current installation recommandation
Following screenshot is the current installation recommandations.
My installation recommandations
Here are the command lines I used to make it work.
Clone the repo
First, clone the stablediffusion repo.
git clone https://github.com/Stability-AI/stablediffusion.git
cd stablediffusion
Change python 3.8.5 to python 3.9 in environment.yml
If you keep the official configuration of environment.yml, you will not be able to install xFormers.
gedit environment.yml
Find line with python (under dependencies) and change the version to 3.9
Create the conda env and install requirements
conda env create -f environment.yaml
conda activate ldm
pip install -r requirements.txt
Install xFormers using the official command
xFormers repo can be found here. To install xFormers:
conda install xformers -c xformers/label/dev
Download model weights
To run the model on your computer, you have to download the weights. They can be found here.
Run the model
Now, you should be able to run the model on your linux computer. The official example is excellent:
python scripts/txt2img.py — prompt “a professional photograph of an astronaut riding a horse” — ckpt <path/to/768model.ckpt/> — config configs/stable-diffusion/v2-inference-v.yaml — H 768 — W 768
Don’t forget to update the path to model weights you just downloaded.
You should be good !