Wednesday | 28 FEB 2024
[ previous ]
[ next ]

(Success) Notes on Installing Stable Diffusion - Electric Boogaloo

Date: 2022-09-01

I had installed Ubuntu under WSL1. I didn't realize that. Explains so much now.

In powershell you can list out the linux distros you have and the versions they running under.

> wsl -l -v
NAME      STATE           VERSION
Ubuntu    Stopped         1
Debian    Running         2

Always turn on virtualization in the bios. I found it in bios under Advanced -> CPU configuration -> SVM mode. This should be enabled. This is for the Asus UEFI bios version 2.2.

Once I had virtualization set, then I enabled WSL2.

In powershell:

> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
> wsl --set-default-version 2
> wsl --install -d debian

Now I could start debian and install cuda and actually get it working.These are the steps to install CUDA.

$ sudo apt-key del 7fa2af80
$ wget
$ sudo mv /etc/apt/preferences.d/cuda-repository-pin-600
$ wget
$ sudo dpkg -i cuda-repo-wsl-ubuntu-11-7-local_11.7.0-1_amd64.deb
$ sudo apt-get update
$ sudo apt-get -y install cuda

The testing to make sure it was installed properly.

$ git clone
$ cd cuda-samples/Samples/1_Utilities/deviceQuery
$ make
$ ./deviceQuery
./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "NVIDIA GeForce RTX 3060 Ti"
CUDA Driver Version / Runtime Version          11.7 / 11.7

Steps to get conda.

$ wget
$ bash 
$ wsl.exe --shutdown

Steps to get the code for stable diffusion, I had to get the optimized version due to not having enough vram.

$ git clone

Download the weights after creating an account and accepting the license. Then copy the weights over to the stable-diffusion folder. This will need to get placed in this place specifically.

$ cd stable-diffusion
$ mkdir stable-diffusion/models/ldm/stable-diffusion-v1
$ cd stable-diffusion/models/ldm/stable-diffusion-v1
$ explorer.exe .

Now create the conda environment. This can take some time.

$ conda env create -f environment.yaml
$ conda activate ldm

Now I can actually run the command:

$ python optimizedSD/ --prompt "the future we were promised, computers, robots, magic, vaporware, neon, vivid colors, 4k, artstation" --H 512 --W 512 --seed 27 --n_iter 2 --ddim_steps 50 --ckpt sd-v1-4.ckpt

Images can be found under the outputs/txt2img-samples/.