MinusZone - CLIPTextEncode(LLamaCPP Universal)
Turn a half-idea into a full SD prompt with a local LLM
- clip
- llama_cpp_model
- llama_cpp_options
- customize_instruct
- text
- conditioning
- text_raw
The name is doing two different jobs, and that's actually the point. MZ_LLamaCPPCLIPTextEncode is not a CLIP text encoder. It's a local LLM - run through llama.cpp - that takes your rough idea and expands it into a full, structured Stable Diffusion prompt, then hands that prompt to your real CLIP model so it becomes conditioning. Think of it as "prompt beautifier, then encode." The universal node in the pack, and the one you should reach for instead of the older v1 nodes, which this supersedes.
Type a girl in a raincoat standing in neon-lit street, cyberpunk into the text box and the LLM returns something structured: a description, a long prompt, style words, subject words, lighting, environment. The node wraps the keyword groups in (...) weight syntax, optionally slaps the quality preset you picked in front, and encodes the whole thing with whatever clip you wire in.
What actually matters on the node
The inputs you'll set 95% of the time:
text- your rough idea. Keep it short; the whole job of the LLM is to expand it.style_presets-none,high_quality,photography, orillustration. These prepend A1111-style quality text (((high quality:1.4), (best quality:1.4), (masterpiece:1.4)...)and so on). If your checkpoint is a newer LLM-encoder model, that vocabulary does almost nothing and you're better off withnone- the preset text is written for the SD 1.5/SDXL era.translate- setTrueif you want to write your idea in Chinese and have it auto-translated to English first (via an Argos model downloaded on first use).format- on by default; strips newlines, turns periods into commas, and collapses double commas into a clean A1111-style tag string. Turn it off if you want the LLM's natural phrasing preserved.seedandkeep_device- seed drives the LLM's generation;keep_devicekeeps the model resident in VRAM between runs (faster when iterating, eats VRAM otherwise).
Outputs: text (the beautified prompt), conditioning (feed this to your sampler - leave clip unwired and it comes back None), and text_raw, the same text string if you want to route it somewhere else or save it.
The two optional inputs worth knowing: llama_cpp_model (a config from the pack's model-selector nodes - see ModelConfigManualSelect(LLamaCPP) / DownloaderSelect) and llama_cpp_options (from LLamaCPPOptions). Plug nothing in and it defaults to Meta-Llama-3-8B-Instruct.Q4_K_M, which the pack will auto-download into ComfyUI/models/gguf on first run.
How it works under the hood
The node builds a JSON-schema prompt asking the model to fill structured fields, runs it through llama.cpp with your sampling options, parses the JSON (with a half-JSON repair fallback), and flattens the arrays into parenthesized keyword groups. That's the same trick CLIP Interrogator-style tools use, inverted: instead of reading an image, it's reading your sentence. Conditioning is produced with A1111-style weight scaling, crediting BlenderNeko's ComfyUI_ADV_CLIP_emb - so (word:1.3) in the LLM output actually means something.
Installing
The pack is in ComfyUI Manager - search "ComfyUI-Prompt-MZ" (or just "MinusZone") - or clone it manually:
cd ComfyUI/custom_nodes
git clone https://github.com/MinusZoneAI/ComfyUI-Prompt-MZ
Restart ComfyUI. The heavy lifting comes from llama-cpp-python and diskcache in requirements.txt; the LLM itself is a ~5GB GGUF download on first run. Note the README is bilingual Chinese-first, and the author is a Chinese creator (Bilibili: minus_zone) - the pack has a bigger footprint in the Chinese scene than on English Reddit.
Troubleshooting
The README FAQ is basically three items, all llama-cpp-python related: module 'llama_cpp' has no attribute 'LLAMA_SPLIT_MODE_LAYER' means your llama-cpp-python is too old - upgrade it. LLama.dll failing to load means a CUDA mismatch - switch your PyTorch install to CUDA 12.1. And a pip wheel build returning nonzero exit status is a network problem - set a proxy or install llama_cpp_python by hand first. If the model never downloads, check that ComfyUI/models/gguf exists and you have disk space; the downloader hits ModelScope, which some non-China networks reach slower than HuggingFace.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| style_presets | COMBO | high_quality | 4 options: none, high_quality, photography, illustration |
| text | STRING | — | |
| keep_device | COMBO | false | 2 options: false, true |
| seed | INT | 00–18446744073709550000 | — |
| translate | COMBO | false | 2 options: false, true |
| format | COMBO | true | 2 options: false, true |
| clipopt | CLIP | — | |
| llama_cpp_modelopt | LLamaCPPModelConfig | — | |
| llama_cpp_optionsopt | LLamaCPPOptions | — | |
| customize_instructopt | CustomizeInstruct | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| conditioning | CONDITIONING | — |
| text_raw | STRING | — |