NOTICE
This article introduces how to use Stable Diffusion with an AMD GPU using Stable Diffusion amdgpu, but we recommend referring to the article below to use Stable Diffusion Forge instead.(Japanese article)
The purpose
Stable Diffusion typically requires an Nvidia GPU (such as GeForce).
While the page below describes creating an environment that runs on a CPU, this article will guide you through setting up an environment to run it on an AMD GPU.
Even with an onboard GPU, the generation time has been shortened.
Environment setup
Install Python and Git.
For details, please refer to the environment setup in the article below.
stable-diffusion-webui-amdgpu
Clone
Obtain stable-diffusion-webui-amdgpu.
Create a folder to install stable-diffusion-webui-amdgpu.
Launch Command Prompt, navigate to the created folder, and execute the following command.
git clone https://github.com/lshqqytiger/stable-diffusion-webui-directml
If the process completes and files are created in the installation folder, it’s a success.
run webui-user.bat
Since webui-user.bat
is created in the installation folder, double-click to run it from File Explorer.
If the following error appears immediately after execution (the process will continue), execute the displayed git config~
command.

Also, the process will likely terminate with the following error.

Once you’ve confirmed the error mentioned above, launch Command Prompt, navigate to the installation folder, and then execute the following command.
cd venv\Scripts
activate.bat
Executing the above command will make (venv)
appear at the beginning of your Command Prompt.
pip install torch_directml
Do not close the Command Prompt where you executed the above command, as you may need to use it.
After the command processing is complete, open webui-user.bat
and change the COMMANDLINE_ARGS
line as follows (these are the arguments to use the environment you set up after activate.bat
).
set COMMANDLINE_ARGS=--use-directml
webui-user.batをエクスプローラから実行します。
If git config~
is prompted during execution, run the specified command, then execute webui-user.bat
again from File Explorer. (You may need to repeat this several times.)

If the above error appears, execute the following command in the Command Prompt where you ran activate.bat
pip install gradio
If the GUI is displayed in your browser as shown below, you’re done.

Troubleshooting Runtime Errors
RuntimeError: Input type (float) and bias type (struct c10::Half) should be the same
If you encounter a ‘RuntimeError: Input type (float) and bias type (struct c10::Half) should be the same’ during execution, open the webui-user.bat
file and modify COMMANDLINE_ARGS
as follows: (add --no-half
)
set COMMANDLINE_ARGS=--use-directml --no-half
After making the correction, execute webui-user.bat
again.
Out of Memory
If you encounter a memory (VRAM) shortage error, open the webui-user.bat
file and modify COMMANDLINE_ARGS
as follows: (add --medvram
)
set COMMANDLINE_ARGS=--use-directml --no-half --medvram
Runtime Error after –medvram modification
If a Runtime error appears after changing to --medvram
, open the webui-user.bat
file and modify COMMANDLINE_ARGS
as follows: (change --medvram
to --lowvram
)
set COMMANDLINE_ARGS=--use-directml --no-half --medvram
Result
By entering a prompt into the displayed GUI and clicking Generate, I was able to create an image.

The image generation times when executed on a CPU are as follows.
* When running on the GPU, COMMANDLINE_ARGS
are set to --use-directml --no-half --opt-sub-quad-attention --upcast-sampling --lowvram
for optimization.
Time | |
CPU | 04:22 |
GPU(this article) | 01:03 |
Even on a PC with an onboard GPU (2GB VRAM), the speed has become about 4 times faster than when run on the CPU.
comment