Nodes/Comfyui_image2prompt/T5 Text to Prompt 🐼
ComfyUI Node

T5 Text to Prompt 🐼

T5 Text to Prompt 🐼 — ComfyUI Node Guide

By zhongpei·Created 3 years ago·Updated about a year ago· 386
T5 Text to Prompt 🐼
  • model
  • string
text
seed777
max_tokens256
temperature1.0
top_p0.9
top_k50
repetition_penalty1.2

What it is

The generation node for this pack's T5 prompt-expansion path. Pair it with Load T5 Model (loaded with roborovski/superprompt-v1, currently the only option) and you've got a small, fast model whose entire job is taking a short prompt and expanding it into a longer, more descriptive one - the "SuperPrompt" idea the README name-checks directly. If Text to Prompt is this pack's general-purpose Qwen-based rewriter, this is the lighter-weight, more narrowly-focused alternative built specifically for prompt expansion.

How it works

Standard text-generation node: your input text goes into the T5 model, sampling settings shape how the output gets generated, and a seed controls reproducibility. Nothing about this is unique to T5 specifically - these are the same sampling knobs you'd recognize from any text-generation node, just applied to a small expansion-focused model instead of a general chat one.

Inputs and outputs

  • text - the short prompt you want expanded. Defaults to empty.
  • seed - default 777. Fix this if you want the same expansion every time you re-run with the same input text; change it to get variation.
  • model - the T5_MODEL, wired from Load T5 Model.
  • max_tokens - default 256, how long the expanded output can run.
  • temperature - default 1, minimum 0.1. Higher than Text to Prompt's default (0.2) - SuperPrompt is built specifically for expansion, so a higher default temperature makes sense here in a way it wouldn't for a general-purpose rewriter.
  • top_p - default 0.9, standard nucleus sampling cutoff.
  • top_k - default 50, standard top-k sampling cutoff.
  • repetition_penalty - default 1.2. Above 1 discourages the model from repeating phrases, which matters more for expansion tasks where a weak model can fall into looping the same descriptive phrase.

If none of temperature/top_p/top_k/repetition_penalty mean anything to you: temperature controls randomness (lower is more predictable), top_p and top_k both limit which tokens the model's allowed to pick from at each step (nucleus and top-k sampling, respectively), and repetition_penalty above 1 pushes back against the model repeating itself. The defaults are reasonable; touch temperature first if output feels too flat or too erratic before adjusting the rest.

Output: a single string - the expanded prompt, ready to feed into a CLIP Text Encode node or wherever else you're building your actual generation prompt.

Installing it

Ships with the full pack:

cd ComfyUI/custom_nodes
git clone https://github.com/zhongpei/Comfyui_image2prompt

Or install through ComfyUI Manager, searching "Comfyui_image2prompt." (The README's own clone command is typo'd to a hyphenated URL - use the underscored one above.) Restart ComfyUI afterward. You'll need Load T5 Model wired in ahead of this node; see that node's article for the model-download details.

Common issues

Forgetting the loader. This node does nothing without a T5_MODEL wired in from Load T5 Model - there's no model to generate with otherwise.

Expecting SuperPrompt to do more than expand. This model's whole training purpose is taking short input and making it longer and more descriptive - it's not a general chat model and won't reliably answer questions, translate, or follow arbitrary instructions the way this pack's Qwen-based Text to Prompt can. Use it specifically for the "make my short idea into a fuller prompt" job.

Output feels too random or too flat. temperature is the first thing to adjust - its default of 1 is meaningfully higher than Text to Prompt's 0.2, so if you're used to that node's more conservative output, T5 Text to Prompt will read as noticeably more varied by comparison. Lower it if you want tighter, more predictable expansions of the same input text.

Categoryfofo🐼/prompt

Inputs (8)

NameTypeDefaultDescription
textSTRING
seedINT777
modelT5_MODEL
max_tokensINT256
temperatureFLOAT1.0
top_pFLOAT0.9
top_kINT50
repetition_penaltyFLOAT1.2

Outputs (1)

NameTypeDescription
stringSTRING