ComfyUI Node

Captioner

Writes one training caption per image: each frame of the batch (or of each batch in a list) goes on its own to the chat model of the connected LM Loader, with the style's built-in prompt (tags or prose) or your instruction, and comes out as two lists in the same order: image (the frame as it came in) and caption. Connect both to Save Image With Caption to write a dataset folder. For captions: thinking off, no system turn, at most 600 tokens, one seed for every frame, each frame's long side capped at 1024; sampling temperature 0.7, top_p 0.8, top_k 20, no presence penalty, or a connected LM Config's (the model's own defaults with the fields edited there). Style none sends the image alone, for an image-to-caption LoRA of your own (chosen on the LM Loader), with or without an instruction.

By 0xBeycan·Created 21 days ago·Updated about 24 hours ago· 2
Captioner
  • image
  • lm
  • config
  • image
  • caption
◄styleprose►
◄seed0►
◄instruction—►
CategoryBCNodes/lm

Inputs (6)

NameTypeDefaultDescription
imageIMAGEThe images to caption, one caption per frame: a single image, a batch, or a list of batches (each frame of each, in order). The model sees each frame with its long side capped at 1024 (never enlarged), then sized as its family sizes images.
lmBC_LMThe chat model, from an LM Loader: its model, precision and LoRA (at its strength), and whether it stays loaded after this node (off: unloaded once after the last frame, after an error too).
styleCOMBOproseThe built-in prompt. tags: one line of attribute groups (class word, shot type, pose, expression, clothing, accessory, setting, lighting, background), each field only when the image shows it. prose: two or three sentences, 30 to 50 words. Both open with the class word, woman or man, read off the image, and never describe hair or identity. none: no prompt, the model gets the image alone (a LoRA trained to caption without one). A connected instruction replaces it. Any style works with a LoRA.
seedINT00–18446744073709550000The sampling seed, the same for every frame. Its control starts at fixed, so queueing again gives the cached captions instead of a new run; set it to randomize for new captions each time.
instructionoptSTRINGYour own prompt in place of the style's built-in one, with any style; the model gets the image, then this text. Not connected, or only whitespace: the style decides. The answer is cut at 600 tokens.
configoptBC_LM_CONFIGSampling from an LM Config node in place of the Captioner's own (temperature 0.7, top_p 0.8, top_k 20, no presence penalty): the model's thinking-off defaults with the fields edited there, or fed by a link, over them. Not connected: the Captioner's own.

Outputs (2)

NameTypeDescription
imageIMAGEEvery frame of the input as it came in (not the resized copy the model saw), one list item per frame.
captionSTRINGEach frame's caption, in the same order: connect both outputs to Save Image With Caption to save every frame with its caption.