@@ -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