mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-12 12:13:29 +08:00
fix hunyuandit controlnet
This commit is contained in:
parent
a3e9b5fb14
commit
e5577ac9fd
@ -472,7 +472,6 @@ def load_controlnet_hunyuandit(controlnet_data):
|
||||
logging.debug("unexpected controlnet keys: {}".format(unexpected))
|
||||
|
||||
latent_format = comfy.latent_formats.HunyuanDit()
|
||||
# latent_format.shift_factor = 0 #SD3 controlnet weirdness
|
||||
control = ControlNetWarperHunyuanDiT(control_model, compression_ratio=1, latent_format=latent_format, load_device=load_device, manual_cast_dtype=manual_cast_dtype)
|
||||
return control
|
||||
|
||||
|
||||
@ -226,13 +226,13 @@ class HunYuanControlNet(nn.Module):
|
||||
_, _, oh, ow = x.shape
|
||||
th, tw = oh // self.patch_size, ow // self.patch_size
|
||||
|
||||
# Get image RoPE embedding according to `reso`lution.
|
||||
freqs_cis_img = calc_rope(x, self.patch_size, self.hidden_size // self.num_heads) # (cos_cis_img, sin_cis_img)
|
||||
|
||||
# ========================= Build time and image embedding =========================
|
||||
t = self.t_embedder(t, dtype=self.dtype)
|
||||
x = self.x_embedder(x)
|
||||
|
||||
# Get image RoPE embedding according to `reso`lution.
|
||||
|
||||
# ========================= Concatenate all extra vectors =========================
|
||||
# Build text tokens with pooling
|
||||
|
||||
@ -372,8 +372,6 @@ class HunYuanDiT(nn.Module):
|
||||
if layer > self.depth // 2:
|
||||
if controls is not None:
|
||||
skip = skips.pop() + controls.pop()
|
||||
print(f"###### skip sum: {skip.sum()} ######")
|
||||
# breakpoint()
|
||||
else:
|
||||
skip = skips.pop()
|
||||
x = block(x, c, text_states, freqs_cis_img, skip) # (N, L, D)
|
||||
|
||||
@ -57,8 +57,6 @@ class ControlNetApplyAdvancedHunYuan:
|
||||
c_net = cnets[prev_cnet]
|
||||
else:
|
||||
c_net = control_net.copy().set_cond_hint(control_hint, strength, (start_percent, end_percent), vae)
|
||||
# c_net.set_extra_arg('encoder_hidden_states_t5', d.get('conditioning_mt5xl', None))
|
||||
# c_net.set_extra_arg('text_embedding_mask_t5', d.get('attention_mask_mt5xl', None))
|
||||
|
||||
c_net.set_previous_controlnet(prev_cnet)
|
||||
cnets[prev_cnet] = c_net
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user