"""临时调试节点: 导出 CLIP 的 cond embeds 到 models/minimax_h3_adapter/cond_official_ref.npy。 用法(黑屏诊断,插进官方工作流): CLIPLoader(官方 qwen3vl-32B GGUF) -> MiniMaxH3ExportCond -> MiniMaxH3ImageToVideo 节点透传 clip 对象(不改变工作流行为),执行时导出 cond npy 并打印路径。 ComfyUI 惰性执行会剪枝无输出节点,故必须输出透传 clip 才能被触发。 """ import os import numpy as np import folder_paths class MiniMaxH3ExportCond: @classmethod def INPUT_TYPES(cls): return {"required": { "clip": ("CLIP",), "prompt": ("STRING", {"default": "a red apple rotating on a wooden table, studio lighting, 3d render", "multiline": True}), }} RETURN_TYPES = ("CLIP",) RETURN_NAMES = ("clip",) FUNCTION = "run" CATEGORY = "model/conditioning/minimax" def run(self, clip, prompt): tokens = clip.tokenize(prompt) cond = clip.encode_from_tokens_scheduled(tokens) embeds = cond[0][0].float().cpu().numpy() out_dir = folder_paths.get_folder_paths("minimax_h3_adapter")[0] os.makedirs(out_dir, exist_ok=True) path = os.path.join(out_dir, "cond_official_ref.npy") np.save(path, embeds) extra = "" if len(cond[0]) > 1 and isinstance(cond[0][1], dict) and "minimax_token_tags" in cond[0][1]: tags = cond[0][1]["minimax_token_tags"].cpu().numpy() extra = f" tags_unique={sorted(set(tags.tolist()))}" print(f"[export_cond] saved {path} shape={embeds.shape} dtype={embeds.dtype}{extra}", flush=True) return (clip,)