Skip to content

Instantly share code, notes, and snippets.

@Kostassoid
Created September 17, 2022 17:45
Show Gist options
  • Save Kostassoid/8f8c151b1260ef8bd2f15bc7892413cd to your computer and use it in GitHub Desktop.
Save Kostassoid/8f8c151b1260ef8bd2f15bc7892413cd to your computer and use it in GitHub Desktop.
Stable Diffusion Vagrantfile
Vagrant.require_version ">= 2.2.8"
ENV['VAGRANT_EXPERIMENTAL'] = 'disks'
$script = <<-SCRIPT
echo Setting up Stable Diffusion
apt-get update && apt-get -y install curl build-essential libxrender-dev python3.8
apt update && apt install -y libsm6 libxext6
wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.12.0-Linux-x86_64.sh
bash Miniconda3-py38_4.12.0-Linux-x86_64.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
git clone https://github.com/CompVis/stable-diffusion.git
cd stable-diffusion/
conda init bash
conda env create -f environment.yaml
echo "conda activate ldm" >> /root/.bashrc
source /root/.bashrc
curl https://www.googleapis.com/storage/v1/b/aai-blog-files/o/sd-v1-4.ckpt?alt=media > sd-v1-4.ckpt
echo All done! Now go create some art.
echo Ex: python scripts/txt2img.py --prompt "YOUR-PROMPT-HERE" --plms --ckpt sd-v1-4.ckpt --skip_grid --n_samples 1
SCRIPT
Vagrant.configure("2") do |config|
config.vm.define "stablediffusion" do |h|
h.vm.box = "hashicorp/bionic64"
h.vm.provider :virtualbox do |v|
v.memory = 4096
v.cpus = 2
end
h.vm.disk :disk, size: "10GB", primary: true
h.vm.provision "shell", inline: $script
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment