how to run Stable Diffusion Forge locally using an AMD GPU with DirectML

This article can be read in about 4 minutes.
PR

The purpose 


Normally, Stable Diffusion Forge requires an NVIDIA GPU (like a GeForce card).

The previous guide explained how to set up an environment to run it on a CPU. This article, however, will walk you through setting up Stable Diffusion Forge to run on a PC with an AMD GPU.


Even with an onboard GPU, it’s great to hear that your creation times have been reduced.

About Flux. 1

One of the advantages of Forge is supposed to be its support for Flux.1. However, using the method described in this guide along with Forge did not allow for Flux.1 image creation.

(While I was able to create images by modifying the code, they weren’t satisfactory, so I’ve omitted that method here.)

PR

Environment Setup

Download


Open the following page.

GitHub - lllyasviel/stable-diffusion-webui-forge
Contribute to lllyasviel/stable-diffusion-webui-forge development by creating an account on GitHub.

Scroll down the page to find the “Installing Forge” section, then click on the recommended binary to download it.

Extract

Extract the downloaded ZIP file to your desired folder.

Modify bat

Open the following file with an editor like Notepad.

webui¥webui-user.bat

You will modify the following line:

set COMMANDLINE_ARGS=

After

set COMMANDLINE_ARGS=--directml 0 --skip-torch-cuda-test --always-no-vram --always-offload-from-vram --no-half --opt-sub-quad-attention --upcast-sampling --opt-sdp-attention --all-in-fp16

That completes the environment setup.

–directml 0 –skip-torch-cuda-test are essential, but feel free to adjust the other arguments as needed.

PR

Execute


Run run.bat located inside the extracted folder.


If the following error appears during execution (the process will continue), run the git config~ command that is displayed. This error may appear repeatedly; if it does, execute the command again in the same manner (the folder path in the arguments should have changed).


If your browser launches and displays the GUI as shown below, the setup is successful!

PR

Result


You successfully created an image by entering a prompt into the displayed GUI and clicking Generate.

comment

Copied title and URL