Run Stable Diffusion locally on a PC without using a GPU

This article can be read in about 6 minutes.
PR

The purpose 

Usually, Stable Diffusion requires an Nvidia GPU (such as GeForce).

Here, we will introduce how to run Stable Diffusion using only the CPU on a PC that doesn’t have an Nvidia GPU.

PR

Environment setup

Install Python

 Download and install Python 3.10.6 from the following page.

Python Release Python 3.10.6
The official home of the Python Programming Language

When installing, please check the ‘Add Python 3.10 to PATH’ option.

Verification of Installation

Open the command prompt and execute the following command.

python3 –version

If executed correctly, it’s a success. (In my environment, it showed ‘Python’.)

The Python version is fixed.

3.10.6 is the specific version designated at the time of article creation.

Please refer to the following page for details.

GitHub - lshqqytiger/stable-diffusion-webui-amdgpu: Stable Diffusion web UI
Stable Diffusion web UI. Contribute to lshqqytiger/stable-diffusion-webui-amdgpu development by creating an account on GitHub.

Install git

Please download and install git from the following page.

Git - Downloading Package

Verification of Installation

Launch the command prompt and execute the following command.

git

Success if done correctly. (Help will be provided).

PR

stable-diffusion-webui-amdgpu

Clone

Obtain stable-diffusion-webui-amdgpu.

Create a folder to install stable-diffusion-webui-amdgpu.

Launch a command prompt, navigate to the created folder, and execute the following command:

git clone https://github.com/lshqqytiger/stable-diffusion-webui-directml

Success is indicated by the process completing and files being created in the installation folder.

Execute webui-user.bat

webui-user.bat file will be created in the installation folder. Double-click it from File Explorer to run.

If the following error appears immediately after execution (processing will continue), run the git config command that is displayed.

I expect the process to terminate with the following error.

If an error occurs, open webui-user.bat with a text editor such as Notepad, and modify the COMMANDLINE_ARGS line as follows.

set COMMANDLINE_ARGS=--skip-torch-cuda-test

Save the above changes and run webui-user.bat again from Explorer. If a message appears during execution asking you to run git config~, execute the specified command and then run webui-user.bat from Explorer again. (Repeat this process as needed.)

If the above error appears, launch a new command prompt and execute the following command

pip install gradio

It’s generally safer to open a new command prompt because using an already open one may not reflect updated environment variables

The process is complete when the GUI appears in your browser as shown below.

PR

Handling Runtime Errors

If you encounter a “RuntimeError: Input type (float) and bias type (struct c10::Half) should be the same” error during runtime, open the webui-user.bat file and modify the COMMANDLINE_ARGS to add --no-half.

set COMMANDLINE_ARGS=--skip-torch-cuda-test --no-half

After making the changes, run webui-user.bat again.

PR

Result

We can generate an image by entering a prompt into the displayed GUI and clicking the “Generate” button.

PR

Reference

GitHub - lshqqytiger/stable-diffusion-webui-amdgpu: Stable Diffusion web UI
Stable Diffusion web UI. Contribute to lshqqytiger/stable-diffusion-webui-amdgpu development by creating an account on GitHub.
Mini PC HX80G(AMD製GPU RX6600M)でStable Diffusionを使ってみる - Qiita
はじめに久しぶりにStable DiffusionをAMD製GPUのWindows PCで使おうとしたのですが、環境構築方法をすっかり忘れていてたので、CPUのみを使う場合とGPUを使う場合の両方…
[Bug]: Input type (float) and bias type (struct c10::Half) should be the same · Issue #9496 · AUTOMATIC1111/stable-diffusion-webui
Is there an existing issue for this? I have searched the existing issues and checked the recent builds/commits What happened? I chose Upscalers with 'ESRGAN‘ in...

comment

Copied title and URL