Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

feat(minimax): support prompt embeddings (#15697)

Silvere5a38e3f7b91
diff --git a/comfy/text_encoders/minimax.py b/comfy/text_encoders/minimax.py
index c2dc47f7f..d79ccf0ea 100644
--- a/comfy/text_encoders/minimax.py
+++ b/comfy/text_encoders/minimax.py
@@ -127,10 +127,6 @@ class MiniMaxH3Tokenizer(comfy.sd1_clip.SD1Tokenizer):
tokenizer = lambda *a, **kw: Qwen3VLSDTokenizer(*a, **kw, embedding_size=5120, embedding_key="qwen3vl_32b")
super().__init__(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data, name="qwen3vl_32b", tokenizer=tokenizer)
- def _text_ids(self, text):
- tok = self.qwen3vl_32b.tokenizer
- return tok(text, add_special_tokens=False)["input_ids"]
-
@staticmethod
def _vision_entry(data, video_block=False):
emb = {"type": "image", "data": data, "original_type": "image"}
@@ -143,7 +139,16 @@ class MiniMaxH3Tokenizer(comfy.sd1_clip.SD1Tokenizer):
entries = []
def add_text(s):
- entries.extend((tid, 1.0) for tid in self._text_ids(s))
+ if not s:
+ return
+ token_batches = self.qwen3vl_32b.tokenize_with_weights(
+ s,
+ return_word_ids=False,
+ disable_weights=True,
+ )
+ if len(token_batches) != 1:
+ raise ValueError("MiniMax H3 text segment exceeds the supported prompt length.")
+ entries.extend(token_batches[0])
def add_vision(data, video_block=False):
entries.append((VISION_START, 1.0))