Stable Diffusion Quickstart with WSL2 and RTX3070

Ryo Koyajima / 小矢島 諒
3 min readSep 19, 2022


~Generate Boss Baby-ish Profile Image ~


To generate my profile image on Twitter.

Unlike LinkedIn or Facebook, Twitter is a bit anonymous service, so I don’t want to use my photo as a profile image. Therefore, I’ve sought a nice picture to use my SNS icon.


  • Windows 10 Home 21H2
  • WSL2 Ubuntu 20.04.5 LTS
# run on wsl to show the version
lsb_release -a
  • Kernel: Linux version
# run on cmd to show the version
wsl cat /proc/version
  • CPU: Ryzen 5 5600X
  • GPU: GeForce RTX 3070
  • RAM: 32GB
  • VRAM: 8GB
  • Package management: Anaconda
  • Not using Docker
  • Use optimized stable diffusion due to VRAM limitation

Quick Guide

  1. Install WSL2 and update the latest version

# run on cmd
wsl --install
wsl --update
wsl --install -d Ubuntu-20.04

2. Install CUDA Toolkit

# run on wsl
sudo mv /etc/apt/preferences.d/cuda-repository-pin-600
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

3. Clone Stable Diffusion (Optimized one)

# run on wsl
git clone
cd stable-diffusion

4. Download model “sd-v1–4.ckpt”

5. Rename and move the model

# run on wsl
mkdir -p models/ldm/stable-diffusion-v1
mv sd-v1–4.ckpt models/ldm/stable-diffusion-v1/model.ckpt

6. Install Anaconda

# run on wsl

7. Install Python Packages

# run on wsl
conda env create -f environment.yaml
conda activate ldm

8. Prepare image

# run on wsl
mkdir img
mv [path to your image file] img/001.jpg
# image file name and path are depend on you. whatever is okay.

9. Run Script

# run on wsl
python optimizedSD/ --prompt "boss baby" --init-img img/001.jpg --strength 0.8 --n_iter 10 --n_samples 10 --H 512 --W 512


  • prompt: text you want to combine
  • init-img: the image you want to combine
  • n_samples: number of images generated

Lastly, check the stable-diffusion/outputs/img2img-samples/boss_baby directory.

My new SNS icon

I hope this helps!

*2022/11/6: modify some commands according to a comment.