Skip to content

Instantly share code, notes, and snippets.

@d8ahazard
Last active October 24, 2022 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d8ahazard/85d5a90e4c10cf20ed7d98856deb16f1 to your computer and use it in GitHub Desktop.
Save d8ahazard/85d5a90e4c10cf20ed7d98856deb16f1 to your computer and use it in GitHub Desktop.
Setup WSL For Dreambooth Stable Diffusion (Ubuntu)
#!/bin/bash
sudo apt-get update
sudo apt-get -y upgrade
# Get git
sudo apt-get -y install git
# install conda (if not already done)
if [ ! -f "./Anaconda3-2022.10-Linux-x86_64.sh" ]; then
wget https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh
fi
chmod +x Anaconda3-2022.10-Linux-x86_64.sh
bash ./Anaconda3-2022.10-Linux-x86_64.sh -b -p $HOME/anaconda3
echo 'export PATH=~/anaconda3/bin:$PATH' >> ~/.bashrc
# Clone webui repo
git clone https://github.com/d8ahazard/stable-diffusion-webui.git -b Dreambooth
cd ./stable-diffusion-webui
# Create and activate conda env
conda env create -f environment-wsl2.yaml
conda activate automatic
# Install CUDA Toolkit
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
wget https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda-repo-wsl-ubuntu-11-3-local_11.3.0-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-11-3-local_11.3.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-wsl-ubuntu-11-3-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
echo 'export CUDA_HOME=/usr/local/cuda-11.3' >> ~/.bashrc
export PATH=~/anaconda3/bin:$PATH
export CUDA_HOME=/usr/local/cuda-11.3
pip install deepspeed accelerate bitsandbytes
@camenduru
Copy link

https://anaconda.org/nvidia/cuda
https://anaconda.org/nvidia/cuda-toolkit

for 11.3:
conda install -c "nvidia/label/cuda-11.3.0" cuda
conda install -c "nvidia/label/cuda-11.3.0" cuda-toolkit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment