diff --git a/nodes_model_loading.py b/nodes_model_loading.py index dedd060..68239da 100644 --- a/nodes_model_loading.py +++ b/nodes_model_loading.py @@ -1153,7 +1153,7 @@ class WanVideoModelLoader: # currently this can be VACE, MTV-Crafter, Lynx or Ovi-audio weights if extra_model is not None: for _model in extra_model: - print("Loading extra model: ", _model["path"]) + log.info(f"Loading extra model: {_model['path']}") if gguf: if not _model["path"].endswith(".gguf"): raise ValueError("With GGUF main model the extra model must also be GGUF quantized, if the main model already has VACE included, you can disconnect the extra module loader") diff --git a/nodes_sampler.py b/nodes_sampler.py index c2203bd..d6afd6b 100644 --- a/nodes_sampler.py +++ b/nodes_sampler.py @@ -875,7 +875,9 @@ class WanVideoSampler: # LongCat-Avatar longcat_ref_latent = None + longcat_num_ref_latents = longcat_num_cond_latents = 0 longcat_avatar_options = image_embeds.get("longcat_avatar_options", None) + if longcat_avatar_options is not None: longcat_ref_latent = longcat_avatar_options.get("longcat_ref_latent", None) if longcat_ref_latent is not None: @@ -884,8 +886,10 @@ class WanVideoSampler: seq_len = math.ceil((latent.shape[2] * latent.shape[3]) / 4 * latent.shape[1]) insert_len = longcat_ref_latent.shape[1] clean_latent_indices = list(range(0, insert_len)) + [i + insert_len for i in clean_latent_indices] + longcat_num_ref_latents = longcat_ref_latent.shape[1] latent_video_length += insert_len - log.info(f"LongCat clean_latent_indices: {clean_latent_indices}") + longcat_num_cond_latents = len(clean_latent_indices) + log.info(f"LongCat num_cond_latents: {longcat_num_cond_latents} num_ref_latents: {longcat_num_ref_latents}") audio_stride = 2 if transformer.is_longcat else 1 #controlnet @@ -1565,8 +1569,8 @@ class WanVideoSampler: "ovi_negative_text_embeds": ovi_negative_text_embeds, # Audio latent model negative text embeds for Ovi "flashvsr_LQ_latent": flashvsr_LQ_latent, # FlashVSR LQ latent for upsampling "flashvsr_strength": flashvsr_strength, # FlashVSR strength - "longcat_num_cond_latents": len(clean_latent_indices) if transformer.is_longcat else 0, - "longcat_num_ref_latents": longcat_ref_latent.shape[1] if longcat_ref_latent is not None else 0, + "longcat_num_cond_latents": longcat_num_cond_latents, + "longcat_num_ref_latents": longcat_num_ref_latents, "longcat_avatar_options": longcat_avatar_options, # LongCat avatar attention options "sdancer_input": sdancer_input, # SteadyDancer input "one_to_all_input": one_to_all_data, # One-to-All input diff --git a/wanvideo/modules/model.py b/wanvideo/modules/model.py index 19abc84..89f180f 100644 --- a/wanvideo/modules/model.py +++ b/wanvideo/modules/model.py @@ -2210,7 +2210,6 @@ class WanModel(torch.nn.Module): torch.tensor([ref_frame_index], dtype=dtype, device=device), torch.arange(0, steps_t - longcat_num_ref_latents, dtype=dtype, device=device) ], dim=0) - print("grid_t:", grid_t) img_ids[:, :, :, 0] = img_ids[:, :, :, 0] + grid_t.reshape(-1, 1, 1) else: # Standard temporal encoding @@ -2639,7 +2638,6 @@ class WanModel(torch.nn.Module): self.cached_key == cache_key): freqs = self.cached_freqs else: - log.info("Generating new RoPE frequencies") freqs = self.rope_encode_comfy( F, H, W, freq_offset=freq_offset, @@ -2650,6 +2648,7 @@ class WanModel(torch.nn.Module): device=x.device, dtype=x.dtype ) + log.info("Generated new RoPE frequencies") if s2v_ref_latent is not None: freqs_ref = self.rope_encode_comfy( @@ -2855,8 +2854,6 @@ class WanModel(torch.nn.Module): human_num = len(multitalk_audio_embedding) # LongCat-Avatar specific - tqdm.write(f"longcat_num_cond_latents: {longcat_num_cond_latents}, longcat_num_ref_latents: {longcat_num_ref_latents}") - if longcat_num_ref_latents > 0: audio_start_ref = multitalk_audio_embedding[:, [0], :, :] # padding multitalk_audio_embedding = torch.cat([audio_start_ref, multitalk_audio_embedding], dim=1).contiguous()