From 05e484203308adb3324f7a9edd1412ed9762e359 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 5 Apr 2026 20:03:06 -0700 Subject: [PATCH] Fix image generation: default to SDPA attention backend --- modules/image_models.py | 2 +- modules/shared.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/image_models.py b/modules/image_models.py index eed8783c..e244c3c8 100644 --- a/modules/image_models.py +++ b/modules/image_models.py @@ -129,7 +129,7 @@ def load_image_model(model_name, dtype='bfloat16', attn_backend='sdpa', cpu_offl modules = ["transformer", "unet"] - # Set attention backend + # Set attention backend (diffusers defaults to native/SDPA) if attn_backend == 'flash_attention_2': for name in modules: mod = getattr(pipe, name, None) diff --git a/modules/shared.py b/modules/shared.py index 92c4f56c..e04f28f3 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -364,7 +364,7 @@ settings = { 'image_llm_variations_prompt': 'Write a variation of the image generation prompt above. Consider the intent of the user with that prompt and write something that will likely please them, with added details. Output only the new prompt. Do not add any explanations, prefixes, or additional text.', 'image_model_menu': 'None', 'image_dtype': 'bfloat16', - 'image_attn_backend': 'flash_attention_2', + 'image_attn_backend': 'sdpa', 'image_cpu_offload': False, 'image_compile': False, 'image_quant': 'none',