Running Flux.1 on Local Stable Diffusion Forge in a CUDA-less Environment (CPU)

This article can be read in about 6 minutes.
PR

The purpose 

Normally, Stable Diffusion Forge requires an Nvidia GPU (like GeForce).

The article below introduced how to use Stable Diffusion Forge with an AMD GPU (via DirectML).

However, as mentioned in the article, Flux.1 will not run in the environment described in the article above.

This article introduces a method to run Flux.1 in an environment without CUDA by executing it on the CPU, without using a GPU.


Here’s the translation:

Since it’s running on the CPU, execution is quite slow. (It takes about 20 minutes per image in my environment.)


Please check the license for the usage conditions of the created images.

lllyasviel/flux1_dev at main
We’re on a journey to advance and democratize artificial intelligence through open source and open science.
PR

Environment setup

Download

Open 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.

Unpacking


Extract the downloaded zip file to any folder.

Modify bat

以下のファイルをメモ帳などのエディタで開きます

webui¥webui-user.bat

Please open the following file in a text editor like Notepad.

set COMMANDLINE_ARGS=

After:

set COMMANDLINE_ARGS=--always-cpu  --skip-torch-cuda-test  --no-half --opt-sub-quad-attention --upcast-sampling --opt-sdp-attention

That completes the environment setup.

--always-cpu and --skip-torch-cuda-test are mandatory, but you can adjust the other settings as needed.

Install model

You may need to log in to HuggingFace depending on the file. Please log in as appropriate.

Download flux1-dev-fp8.safetensors from the URL below and place it in the webui\models\Stable-diffusion folder.

lllyasviel/flux1_dev at main
We’re on a journey to advance and democratize artificial intelligence through open source and open science.

Download clip_l.safetensors and t5xxl_fp16.safetensors from the following URL and place them in the webui\models\VAE folder.

comfyanonymous/flux_text_encoders at main
We’re on a journey to advance and democratize artificial intelligence through open source and open science.

Download ae.safetensors from the following URL and place it in the webui\models\VAE folder.

black-forest-labs/FLUX.1-schnell at main
We’re on a journey to advance and democratize artificial intelligence through open source and open science.
PR

Execute


Run run.bat located in the extracted folder.

If you see the following error during execution (the process will continue), run the git config~ command that’s displayed. This error might appear repeatedly. If it reappears, run the command again in the same way (the folder path in the arguments should have changed).

If your browser launches and displays the GUI as shown below, it’s a success!

PR

Image Generation

It will be displayed, so make the following changes through the GUI:

UI: Check flux

CheckPoint: select flux1-dev-fp8.safetensors

VAE/TextEncoder: 


Please select the following three files (in any order): ae.safetensors, clip_l.safetensors, and t5xxl_fp16.safetensors.

Once the above settings are complete, you can create images by entering prompts, similar to Stable Diffusion.


Flux.1 recommends not entering negative prompts.

PR

Result


You were able to create an image by entering the prompt into the displayed GUI and clicking “Generate.”

comment

Copied title and URL