Skip to content

Commit adf6f58

Browse files
committed
Disable dynamic caching (FB cache) when using Flux fill
- seems like cache barely works and results in garbage output for fill models
1 parent df78dd2 commit adf6f58

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ai_diffusion/workflow.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,11 @@ def inpaint(
801801
target_bounds = params.target_bounds
802802
extent = ScaledExtent.from_input(images.extent) # for initial generation with large context
803803

804+
is_inpaint_model = params.use_inpaint_model and models.control.find(ControlMode.inpaint) is None
805+
if is_inpaint_model and models.arch is Arch.flux:
806+
checkpoint.dynamic_caching = False # doesn't seem to work with Flux fill model
807+
sampling.cfg_scale = 30 # set Flux guidance to 30 (typical values don't work well)
808+
804809
model, clip, vae = load_checkpoint_with_lora(w, checkpoint, models.all)
805810
model = w.differential_diffusion(model)
806811
model_orig = copy(model)
@@ -848,12 +853,10 @@ def inpaint(
848853
)
849854
inpaint_patch = w.load_fooocus_inpaint(**models.fooocus_inpaint)
850855
inpaint_model = w.apply_fooocus_inpaint(model, inpaint_patch, latent_inpaint)
851-
elif params.use_inpaint_model and models.control.find(ControlMode.inpaint) is None:
856+
elif is_inpaint_model:
852857
positive, negative, latent_inpaint, latent = w.vae_encode_inpaint_conditioning(
853858
vae, in_image, initial_mask, positive, negative
854859
)
855-
if models.arch is Arch.flux: # flux1-fill based model
856-
sampling.cfg_scale = 30
857860
inpaint_model = model
858861
else:
859862
latent = w.vae_encode(vae, in_image)

0 commit comments

Comments
 (0)