Skip to content

Commit

Permalink
Alternative fix for #5767
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Nov 26, 2024
1 parent 24dc581 commit 497db62
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion comfy/model_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,13 @@ def __init__(self, model_config, model_type=ModelType.FLUX, device=None):
super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.flux.model.Flux)

def concat_cond(self, **kwargs):
num_channels = self.diffusion_model.img_in.weight.shape[1] // (self.diffusion_model.patch_size * self.diffusion_model.patch_size)
try:
#Handle Flux control loras dynamically changing the img_in weight.
num_channels = self.diffusion_model.img_in.weight.shape[1] // (self.diffusion_model.patch_size * self.diffusion_model.patch_size)
except:
#Some cases like tensorrt might not have the weights accessible
num_channels = self.model_config.unet_config["in_channels"]

out_channels = self.model_config.unet_config["out_channels"]

if num_channels <= out_channels:
Expand Down

0 comments on commit 497db62

Please sign in to comment.