Skip to content

Commit 4322fd6

Browse files
committed
Fix FLUX.1-dev step count to 20-25 steps and add async offloading
1 parent 42fed55 commit 4322fd6

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

run_comfyui.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ fi
2828

2929
export PYTHONUNBUFFERED=1
3030

31-
# Launch ComfyUI with PyTorch SDPA cross-attention and APU memory flags
31+
# Launch ComfyUI with PyTorch SDPA cross-attention, async offload streams, and APU memory flags
3232
python -u main.py \
3333
--use-pytorch-cross-attention \
3434
--disable-pinned-memory \
35+
--async-offload 2 \
3536
"$@" 2>&1 | tee -a comfyui.log

web_studio/studio_server.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,14 @@ async def generate_image(payload: dict):
197197
negative_prompt = payload.get("negative_prompt", "")
198198
seed = int(payload.get("seed", 42))
199199

200-
# Schnell, Klein, and Flux models require CFG 1.0, simple/sgm_uniform scheduler, and empty negative prompt
200+
# Schnell and Klein require 4-8 steps; FLUX.1-dev requires 20-25 steps
201+
is_dev = "dev" in ckpt_name.lower()
201202
is_flux = ("schnell" in ckpt_name.lower() or "klein" in ckpt_name.lower() or "flux" in ckpt_name.lower() or ckpt_name.endswith(".gguf"))
202203
if is_flux:
203-
steps = 4 if steps > 8 or steps == 25 else steps
204+
if is_dev:
205+
steps = steps if steps >= 15 else 20
206+
else:
207+
steps = 4 if (steps > 8 or steps == 25) else steps
204208
cfg = 1.0
205209
if scheduler == "normal":
206210
scheduler = "simple"

0 commit comments

Comments
 (0)