Locally Train Stable Diffusion with Dreambooth using WSL Ubuntu
If you are able to use Deepspeed, this may work on 8gb-12gb cards, but I haven’t been able to get below 10gb personally.
Command list:
wget https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh
chmod +x ./Anaconda3-2022.05-Linux-x86_64.sh
./Anaconda3-2022.05-Linux-x86_64.sh
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/cuda-96193861-keyring.gpg /usr/share/keyrings/
wget https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda-repo-wsl-ubuntu-11-7-local_11.7.1-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-11-7-local_11.7.1-1_amd64.deb
sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/cuda-*-keyring.gpg /usr/share/keyrings/
OR:
sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/cuda-96193861-keyring.gpg /usr/share/keyrings/cuda-archive-keyring.gpg
sudo apt-get update
sudo apt-get -y install cuda
Open a windows shell and type wsl –shutdown
git clone https://github.com/ShivamShrirao/diffusers.git
cd diffusers
pip install torch torchvision torchaudio –extra-index-url https://download.pytorch.org/whl/cu117
pip install -r requirements.txt
pip install -U –pre triton
pip install ninja bitsandbytes
pip install .
cd examples/dreambooth
pip install git+https://github.com/facebookresearch/xformers@1d31a3a#egg=xformers
accelerate config
huggingface-cli login
python convert_diffusers_to_original_stable_diffusion.py –model_path /home/MODEL-TO-CONVERT –checkpoint_path /OUTPUT PATH
Note: Windows drives mounted to /mnt/[drive letter]
wsl kernel updates
https://www.catalog.update.microsoft.com/Search.aspx?q=wsl%20kernel
Reddit Dreambooth guide by ThereforeGames
https://www.reddit.com/r/StableDiffusion/comments/ydip3s/guide_dreambooth_training_with_shivamshriraos/
Shivam Shiraro’s Diffuser’s Repo
https://github.com/ShivamShrirao/diffusers
Nice video! What GPU are you using?