From bd2c2f7375842cbb476a4e06d52bf9c40f10a726 Mon Sep 17 00:00:00 2001 From: Yousef Rafat <81116377+yousef-rafat@users.noreply.github.com> Date: Fri, 28 Nov 2025 18:21:20 +0200 Subject: [PATCH] removed additional token injection --- comfy/ldm/hunyuan_image_3/model.py | 2 +- comfy_extras/nodes_hunyuan_image.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/ldm/hunyuan_image_3/model.py b/comfy/ldm/hunyuan_image_3/model.py index eb4d7e2d0..f4cf935ef 100644 --- a/comfy/ldm/hunyuan_image_3/model.py +++ b/comfy/ldm/hunyuan_image_3/model.py @@ -1103,7 +1103,7 @@ class HunyuanImage3ForCausalMM(nn.Module): inputs_embeds = torch.cat([*input_args, joint_image], dim = 1) else: - inputs_embeds = torch.cat([*input_args, joint_image[:, 1:, :]], dim = 1) # joint_image == eos_token + inputs_embeds = torch.cat([*input_args], dim = 1) attention_mask = torch.ones(inputs_embeds.shape[1], inputs_embeds.shape[1], dtype=torch.bool).tril(diagonal=0).repeat(bsz, 1, 1) for i in range(bsz): diff --git a/comfy_extras/nodes_hunyuan_image.py b/comfy_extras/nodes_hunyuan_image.py index 7d765d53a..8eb4d8b80 100644 --- a/comfy_extras/nodes_hunyuan_image.py +++ b/comfy_extras/nodes_hunyuan_image.py @@ -76,7 +76,7 @@ class HunyuanImage3Conditioning(io.ComfyNode): vae_mask = vae_mask.unsqueeze(0).unsqueeze(-1) else: pad_token = torch.tensor([-100.0]).view(1, 1, 1).expand(batch_size, 1, hidden_size) - joint_image = torch.cat([pad_token, fn("<|endoftext|>")], dim = 1) + joint_image = torch.cat([pad_token, fn("<|endoftext|>")], dim = 1) # look into vae_mask = torch.empty_like(joint_image) ragged_tensors = torch.nested.nested_tensor([joint_image, vae_mask, text_tokens.to(joint_image.dtype)])