MergePrompts
The local-LLM prompt merger for text-to-video that needs a little surgery
- prompt
MergePrompts has a great idea hiding behind a rough implementation. It's a single node from the ZeptaframePromptMerger pack that runs a local Llama model and fuses three different video prompts into one cohesive text-to-video prompt - weighted so the subject's movements win over the scene description, which wins over whatever system caption got thrown in. If you've spent an evening fighting Wan or LTX because your motion prompt and your scene prompt kept fighting each other, you already know why someone would build this. It's a niche answer to a real problem; it's just not a finished one.
What it actually does
The node takes three STRING inputs, hands them to a GGUF Llama running via llama-cpp-python, and returns a single merged prompt STRING you wire into your text-to-video sampler's prompt input. Nothing here calls an API - it's all local, no key required.
The three inputs are the whole story, and they're worth listing because all of them have to be valid JSON, not plain text:
- subjectTextPrompts (highest priority, 8/10) - a JSON object mapping subjects to movement/appearance, like
{"bear near creek": "walking fast"}. - generalTextPrompt (7/10) - the overall scene description.
- generalSa2VAPrompt (2/10) - a system-generated caption, e.g. from a grounded-video (Sa2VA-style) pipeline. Treat it as background context.
Under the hood it json.loads all three, then builds an instruction that says "MOST IMPORTANT: subject descriptions… IMPORTANT: general description… BACKGROUND CONTEXT: system caption" and lets the LLM (n_ctx 4096, max_tokens 512, temperature 0.7, top_p 0.95) write the merged result. So it's a prompt-enhancer, same family as the LLM-rewrite nodes people use for image models - just tuned for the instruction-style, structured prompting that video and newer LLM-encoded models actually respond to.
How to install it
Via ComfyUI Manager, search "ComfyUI-ZeptaframePromptMerger" (it's on the Comfy Registry). Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Pablerdo/ComfyUI-ZeptaframePromptMerger
pip install llama-cpp-python
Then download a GGUF into ComfyUI/zepta/ - the README recommends llama-2-7b-chat.Q8_0.gguf, which is roughly 7GB. That's the real cost of this node: a whole 7B model loaded into memory just to rewrite a prompt. Q8 is basically fp16 at half the size, so if you're going to run it, that quantization choice is fine - but budget ~8GB of RAM/VRAM and a slow first execution every single run, because the model is constructed fresh inside the node's run() each time, not cached.
The gotcha that actually matters
As shipped, this node will almost certainly fail to load in stock ComfyUI. The module does folder_paths.folder_names_and_paths["zepta/llama-2-7b-chat.Q8_0.gguf"] at import time - but that dict is keyed by folder names (checkpoints, loras, …), maps them to (paths, extensions) tuples, and has no zepta key. So you get a KeyError before the node even appears in your menu. The README's own fix is the honest one: edit nodes/text_nodes.py and point it at a real path, e.g.
llama_model_path = "zepta/llama-2-7b-chat.Q8_0.gguf" # relative to ComfyUI root
Two more traps once it loads. First, the JSON requirement - paste a plain sentence into any input and json.loads throws a JSONDecodeError; quote your strings ("a serene forest scene"). Second, the requirements.txt is a firehose - torch, transformers, opencv, mss, librosa - for a node whose only real dependency is llama-cpp-python. Install the latter explicitly and don't be surprised if pip wants to churn your environment.
Verdict
The idea is genuinely useful for the video-prompt merge problem, and the importance-weighted framing is the right instinct. But between the import bug, the JSON requirements, and the 7GB model reloaded per run, the out-of-box experience is rough. If you're comfortable editing a few lines of Python, it's a fun experiment; if you just want merged prompts, a plain text-concat node plus your existing LLM habit will get you 90% there with none of the surgery.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| generalSa2VAPrompt | STRING | — | |
| generalTextPrompt | STRING | — | |
| subjectTextPrompts | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |