Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tigefa4u/cadf4e32678200320e09b254328c00b8 to your computer and use it in GitHub Desktop.
Save tigefa4u/cadf4e32678200320e09b254328c00b8 to your computer and use it in GitHub Desktop.

Revisions

  1. @geerlingguy geerlingguy renamed this gist Oct 26, 2022. 1 changed file with 0 additions and 0 deletions.
  2. @geerlingguy geerlingguy revised this gist Sep 1, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions stable-diffusion-ubuntu-2004-amd.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # Note: This will only work on Navi21 GPUs (6800/6900+).
    # See: https://github.com/RadeonOpenCompute/ROCm/issues/1668#issuecomment-1043994570

    # Install Conda (latest from https://docs.conda.io/en/latest/miniconda.html#linux-installers)
    wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh
  3. @geerlingguy geerlingguy revised this gist Sep 1, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions stable-diffusion-ubuntu-2004-amd.txt
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Note: This will only work on Navi21 GPUs (6800/6900+).

    # Install Conda (latest from https://docs.conda.io/en/latest/miniconda.html#linux-installers)
    wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh
    bash Miniconda3-py39_4.12.0-Linux-x86_64.sh
  4. @geerlingguy geerlingguy renamed this gist Sep 1, 2022. 1 changed file with 0 additions and 0 deletions.
  5. @geerlingguy geerlingguy revised this gist Aug 31, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion stable-diffusion.txt
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ cd stable-diffusion/
    conda remove cudatoolkit -y
    pip3 uninstall torch torchvision -y
    # Install PyTorch ROCm
    pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/rocm5.1.1
    pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/rocm5.1.0
    pip3 install transformers==4.19.2 scann kornia==0.6.4 torchmetrics==0.6.0

    # Generate an image
  6. @geerlingguy geerlingguy revised this gist Aug 31, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion stable-diffusion.txt
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ ln -s -r sd-v1-4.ckpt models/ldm/stable-diffusion-v1/model.ckpt
    # Install AMD ROCm support
    wget https://repo.radeon.com/amdgpu-install/22.10/ubuntu/focal/amdgpu-install_22.10.50100-1_all.deb
    sudo apt-get install ./amdgpu-install_22.10.50100-1_all.deb
    sudo amdgpu-install --rocmrelease=5.2.3 --usecase=dkms,graphics,rocm,lrt,hip,hiplibsdk
    sudo amdgpu-install --usecase=dkms,graphics,rocm,lrt,hip,hiplibsdk
    # make sure you see your GPU by running rocm-smi

    # Make AMD GPU work with ROCm
  7. @geerlingguy geerlingguy created this gist Aug 31, 2022.
    38 changes: 38 additions & 0 deletions stable-diffusion.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    # Install Conda (latest from https://docs.conda.io/en/latest/miniconda.html#linux-installers)
    wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh
    bash Miniconda3-py39_4.12.0-Linux-x86_64.sh
    # follow the prompts to install it, and run `conda` to make sure it's working.

    # Install git and curl, and clone the stable-diffusion repo
    sudo apt install -y git curl
    cd Downloads
    git clone https://github.com/CompVis/stable-diffusion.git

    # Install dependencies and activate environment
    cd stable-diffusion
    conda env create -f environment.yaml
    conda activate ldm

    # Download Stable Diffusion weights
    curl https://www.googleapis.com/storage/v1/b/aai-blog-files/o/sd-v1-4.ckpt?alt=media > sd-v1-4.ckpt

    # Symlink the weights into place
    mkdir -p models/ldm/stable-diffusion-v1/
    ln -s -r sd-v1-4.ckpt models/ldm/stable-diffusion-v1/model.ckpt

    # Install AMD ROCm support
    wget https://repo.radeon.com/amdgpu-install/22.10/ubuntu/focal/amdgpu-install_22.10.50100-1_all.deb
    sudo apt-get install ./amdgpu-install_22.10.50100-1_all.deb
    sudo amdgpu-install --rocmrelease=5.2.3 --usecase=dkms,graphics,rocm,lrt,hip,hiplibsdk
    # make sure you see your GPU by running rocm-smi

    # Make AMD GPU work with ROCm
    cd stable-diffusion/
    conda remove cudatoolkit -y
    pip3 uninstall torch torchvision -y
    # Install PyTorch ROCm
    pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/rocm5.1.1
    pip3 install transformers==4.19.2 scann kornia==0.6.4 torchmetrics==0.6.0

    # Generate an image
    python scripts/txt2img.py --prompt "a photograph of an astronaut riding a horse" --plms