Skip to content

Commit f874801

Browse files
committed
Set Flux models to eval mode to restore FP8 performance
Fixes performance regression introduced in Comfy-Org#9854 where the fp8_linear optimization path was being skipped during inference because Flux models were not explicitly set to eval mode.
1 parent d68ece7 commit f874801

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

comfy/model_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,7 @@ def extra_conds(self, **kwargs):
834834
class Flux(BaseModel):
835835
def __init__(self, model_config, model_type=ModelType.FLUX, device=None, unet_model=comfy.ldm.flux.model.Flux):
836836
super().__init__(model_config, model_type, device=device, unet_model=unet_model)
837+
self.diffusion_model.eval().requires_grad_(False)
837838
self.memory_usage_factor_conds = ("ref_latents",)
838839

839840
def concat_cond(self, **kwargs):

0 commit comments

Comments
 (0)