Skip to content

Commit 6225a78

Browse files
Add CLIPTextEncodeHunyuanDiT.
Useful for testing what each text encoder does.
1 parent b6779d8 commit 6225a78

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

comfy_extras/nodes_hunyuan.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
class CLIPTextEncodeHunyuanDiT:
2+
@classmethod
3+
def INPUT_TYPES(s):
4+
return {"required": {
5+
"clip": ("CLIP", ),
6+
"bert": ("STRING", {"multiline": True, "dynamicPrompts": True}),
7+
"mt5xl": ("STRING", {"multiline": True, "dynamicPrompts": True}),
8+
}}
9+
RETURN_TYPES = ("CONDITIONING",)
10+
FUNCTION = "encode"
11+
12+
CATEGORY = "advanced/conditioning"
13+
14+
def encode(self, clip, bert, mt5xl):
15+
tokens = clip.tokenize(bert)
16+
tokens["mt5xl"] = clip.tokenize(mt5xl)["mt5xl"]
17+
18+
output = clip.encode_from_tokens(tokens, return_pooled=True, return_dict=True)
19+
cond = output.pop("cond")
20+
return ([[cond, output]], )
21+
22+
NODE_CLASS_MAPPINGS = {
23+
"CLIPTextEncodeHunyuanDiT": CLIPTextEncodeHunyuanDiT,
24+
}

nodes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,6 +2037,7 @@ def init_builtin_extra_nodes():
20372037
"nodes_sd3.py",
20382038
"nodes_gits.py",
20392039
"nodes_controlnet.py",
2040+
"nodes_hunyuan.py",
20402041
]
20412042

20422043
import_failed = []

0 commit comments

Comments
 (0)