WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit e2a800e

Browse files
authored
Fix for HunyuanVideo1.5 meanflow distil (#11212)
1 parent 9d252f3 commit e2a800e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

comfy/ldm/hunyuan_video/model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class HunyuanVideoParams:
4343
meanflow: bool
4444
use_cond_type_embedding: bool
4545
vision_in_dim: int
46+
meanflow_sum: bool
4647

4748

4849
class SelfAttentionRef(nn.Module):
@@ -317,7 +318,7 @@ def forward_orig(
317318
timesteps_r = transformer_options['sample_sigmas'][w[0] + 1]
318319
timesteps_r = timesteps_r.unsqueeze(0).to(device=timesteps.device, dtype=timesteps.dtype)
319320
vec_r = self.time_r_in(timestep_embedding(timesteps_r, 256, time_factor=1000.0).to(img.dtype))
320-
vec = (vec + vec_r) / 2
321+
vec = (vec + vec_r) if self.params.meanflow_sum else (vec + vec_r) / 2
321322

322323
if ref_latent is not None:
323324
ref_latent_ids = self.img_ids(ref_latent)

comfy/model_detection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,10 @@ def detect_unet_config(state_dict, key_prefix, metadata=None):
180180
dit_config["use_cond_type_embedding"] = False
181181
if '{}vision_in.proj.0.weight'.format(key_prefix) in state_dict_keys:
182182
dit_config["vision_in_dim"] = state_dict['{}vision_in.proj.0.weight'.format(key_prefix)].shape[0]
183+
dit_config["meanflow_sum"] = True
183184
else:
184185
dit_config["vision_in_dim"] = None
186+
dit_config["meanflow_sum"] = False
185187
return dit_config
186188

187189
if '{}double_blocks.0.img_attn.norm.key_norm.scale'.format(key_prefix) in state_dict_keys and ('{}img_in.weight'.format(key_prefix) in state_dict_keys or f"{key_prefix}distilled_guidance_layer.norms.0.scale" in state_dict_keys): #Flux, Chroma or Chroma Radiance (has no img_in.weight)

0 commit comments

Comments
 (0)