Nodes/Comfyui-Qwen-Image-Prompt-Rewrite-T8/Qwen Image 2.1 PE Rewrite T8
ComfyUI Node

Qwen Image 2.1 PE Rewrite T8

The prompt writer that runs on your own GPU

By T8mars·Created 22 days ago·Updated 7 days ago· 48
Qwen Image 2.1 PE Rewrite T8
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • image_6
  • image_7
  • image_8
  • image_9
  • image_10
  • rewritten_prompt
  • pe_result
  • diagnostics
◄user_prompt►
◄taskauto►
◄aspect_ratioauto►
◄output_languageauto►
◄transparent_rgbafalse►
◄t2i_model(no local GGUF found)►
◄edit_model(no local GGUF found)►
◄vision_modelAuto►
◄model_lifetimeafter_run►
◄seed42►
◄startup_timeout900►

First, the thing everyone gets wrong

The four GGUFs this pack downloads are prompt rewriters. They do not make images. Give this node your rough idea - or your rough idea plus up to ten reference images - and it hands back a well-formed prompt in the style Qwen Image 2.1 wants. You still need a diffusion model, text encoder and VAE for pixels, and those come from Comfy-Org/Qwen-Image-2.1, not from here.

Why bother? Because Qwen Image 2.1 is LLM-encoded - you prompt it like an instruction, not like tag soup - and Alibaba published official system-prompt templates for the text-to-image and edit paths. This node runs those exact templates (shipped in prompts/) through a local llama-server. No key, no cloud, no filter.

The author is T8star (GitHub T8mars), a prolific Chinese ComfyUI workflow maker with Bilibili and YouTube channels and a Hugging Face mirror at t8star/qwen-image-2.1-comfy. The Registry listing publishes under t8star but was still pending review at the time of writing, which matters for install.

What it does under the hood

The sequence: ComfyUI is asked to free ~12 GB of VRAM, the node starts its own llama-server (bound to 127.0.0.1, everything offloaded with -ngl 99), ships one multimodal request with every connected image in port order, and validates the answer hard. Context is sized by job - 24,576 tokens for text-to-image, up to 65,536 for ten images. Images are downscaled to about a million pixels for the vision pass, but their original dimensions are kept for the Canvas node.

Nothing is silently forgiven. Bad JSON, a reference to an image you didn't supply, the wrong language, a broken ratio rule - it retries once (thinking disabled if the first pass was truncated) and then errors out. Loud failure beats a quietly mangled prompt.

The inputs you'll actually touch

  • user_prompt - your instruction. Empty is an error; even an image-only edit needs a stated goal.
  • task - auto / t2i / edit. auto reads the graph: images connected means edit, none means text-to-image. t2i refuses images, edit requires at least one. Editing also needs a matching mmproj vision file, which Auto resolves by filename.
  • aspect_ratio - auto plus twelve fixed ratios. An explicit choice overrides the model's own suggestion and is what feeds Canvas, so set it here rather than fighting it downstream.
  • output_language - auto, 中文, English. With an explicit choice the node checks the rewrite for stray characters of the wrong script and runs a constrained translation pass with the same local model if needed; diagnostics tells you whether that fired. Text inside quotation marks is left alone either way.
  • transparent_rgba - wraps the final prompt in RGBA/alpha language. It is a prompt constraint only; whether your PNG actually has alpha depends on the downstream model and VAE.
  • model_lifetime - after_run (default) kills the server after every run; keep_loaded keeps it warm for iteration.
  • image_1 … image_10 - one IMAGE each, not a batch. None ports are skipped and the rest renumber in port order, so <image2> in the output may be your image_9. Multi-image rewrites must reference every tag; the mapping lands in pe_result.image_input_ports.

Outputs: rewritten_prompt (STRING, straight into TextEncodeQwenImage21), pe_result (the structured packet Canvas and Unload consume), and diagnostics (JSON - task, models, timings, token usage, whether a retry fired).

Installing it

ComfyUI Manager → search qwen-image-prompt-rewrite-t8 (may not be offered while the Registry entry is pending), or:

cd ComfyUI/custom_nodes
git clone https://github.com/T8mars/Comfyui-Qwen-Image-Prompt-Rewrite-T8.git

Then, with the same Python environment ComfyUI uses:

cd Comfyui-Qwen-Image-Prompt-Rewrite-T8
python tools/download_models.py     # 3 main GGUFs + I2I mmproj, SHA256-checked, resumable

About 18 GB total: two 5.63 GB Q4_K_M mains (T2I and I2I, prithivMLmods quants), an optional 5.89 GB pe_t2i_heretic-Q4_K_M.gguf - an abliterated derivative, for when the stock model clams up - and a 0.92 GB BF16 mmproj.

You also need a llama-server binary; the node doesn't ship one. On Windows:

powershell -ExecutionPolicy Bypass -File tools/download_runtime.ps1

That pulls llama.cpp b11068 (CUDA 12.4) into runtime/. Everywhere else, install a recent llama-server yourself and point QWEN_PE_LLAMA_SERVER at it - new enough to support --jinja, which the node passes. Python-side it needs numpy and Pillow and nothing else. Models can live in the pack's models/llm/qwenimage-pe/, in ComfyUI/models/llm/qwenimage-pe/, or wherever QWEN_PE_MODEL_DIR points. Licence note that isn't buried deep enough: templates and weights are under the Qwen Research License - non-commercial research and evaluation only.

Where people get burned

"No local GGUF found" in the dropdowns. The lists are built when the node is instantiated, so drop the GGUFs in place and restart ComfyUI. PE Local Models T8 then shows what was actually discovered.

Edit mode complains about a missing mmproj. The main model and vision file have to share a base name (Qwen-Image-2.1-PE-I2I ...). Swap in an I2I quant from elsewhere and its mmproj won't pair, so you select vision_model by hand.

"model response reached the generation or context limit." It already retried without thinking. Still truncated? Fewer images, shorter instruction - ten images is a heavy request, especially with a diffusion model resident.

"model failed format validation." Both attempts failed a JSON, ratio, language or image-reference check. diagnostics carries the port mapping and the first format error; nine times out of ten your prompt mentions <image1> and <image2> while only one image is connected.

First rewrites feel slow - 5.6 GB off disk isn't instant. keep_loaded, plus PE Unload T8 when you're done, is the pairing the author intends.

And the gate that catches people: the full generation workflows need a recent ComfyUI with TextEncodeQwenImage21. Older builds run the rewrite fine and fail at generation, which looks like a bug in this pack and isn't.

CategoryQwen Image 2.1/Prompt Rewrite

Inputs (21)

NameTypeDefaultDescription
user_promptSTRING—
taskCOMBOauto3 options: auto, t2i, edit
aspect_ratioCOMBOautoauto 使用模型建议;指定比例将覆盖模型比例并控制 Canvas。
output_languageCOMBOauto控制改写描述的语言;图内原文保留用户指定文字。
transparent_rgbaBOOLEANfalse将 RGBA、alpha 通道和透明背景要求加入最终提示词。
t2i_modelCOMBO(no local GGUF found)1 options: (no local GGUF found)
edit_modelCOMBO(no local GGUF found)1 options: (no local GGUF found)
vision_modelCOMBOAuto1 options: Auto
model_lifetimeCOMBOafter_run2 options: after_run, keep_loaded
seedINT420–2147483647—
image_1optIMAGE—
image_2optIMAGE—
image_3optIMAGE—
image_4optIMAGE—
image_5optIMAGE—
image_6optIMAGE—
image_7optIMAGE—
image_8optIMAGE—
image_9optIMAGE—
image_10optIMAGE—
startup_timeoutoptINT90030–7200模型启动等待秒数,默认 900(15 分钟);加载较慢时可增大。 / Model startup timeout in seconds; increase for slow loading.

Outputs (3)

NameTypeDescription
rewritten_promptSTRING—
pe_resultPE_RESULT—
diagnosticsSTRING—