Hidream: Allow loading hidream text encoders in CLIPLoader and DualCLIPLoader (#7676)

* Hidream: Allow partial loading text encoders

* reformat code for ruff check.
This commit is contained in:
power88
2025-04-20 07:47:30 +08:00
committed by GitHub
parent 4486b0d0ff
commit f43e1d7f41
3 changed files with 42 additions and 4 deletions

View File

@@ -109,11 +109,15 @@ class HiDreamTEModel(torch.nn.Module):
if self.t5xxl is not None:
t5_output = self.t5xxl.encode_token_weights(token_weight_pairs_t5)
t5_out, t5_pooled = t5_output[:2]
else:
t5_out = None
if self.llama is not None:
ll_output = self.llama.encode_token_weights(token_weight_pairs_llama)
ll_out, ll_pooled = ll_output[:2]
ll_out = ll_out[:, 1:]
else:
ll_out = None
if t5_out is None:
t5_out = torch.zeros((1, 1, 4096), device=comfy.model_management.intermediate_device())