mirror of
https://github.com/Comfy-Org/ComfyUI.git
synced 2026-08-19 15:55:21 +08:00
feat(minimax): support prompt embeddings (#15697)
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user