Add code to detect if a z image fun controlnet is broken or not. (#11341)

This commit is contained in:
comfyanonymous 2025-12-15 17:51:06 -08:00 committed by GitHub
parent d02d0e5744
commit 41bcf0619d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -248,7 +248,10 @@ class ModelPatchLoader:
config['n_control_layers'] = 15
config['additional_in_dim'] = 17
config['refiner_control'] = True
config['broken'] = True
ref_weight = sd.get("control_noise_refiner.0.after_proj.weight", None)
if ref_weight is not None:
if torch.count_nonzero(ref_weight) == 0:
config['broken'] = True
model = comfy.ldm.lumina.controlnet.ZImage_Control(device=comfy.model_management.unet_offload_device(), dtype=dtype, operations=comfy.ops.manual_cast, **config)
model.load_state_dict(sd)