Nodes/comfyui_AcademiaSD/AcademiaSD Captioner
ComfyUI Node

AcademiaSD Captioner

Caption your whole training dataset with a local VLM — no API key, no per-image bill

By AcademiaSD·Created about a year ago·Updated 4 days ago· 76
AcademiaSD Captioner
  • model
  • image
  • caption
promptDescribe this image in detail.
max_tokens512

The good news up front: the name is not a lie about the important part. This is the engine behind the pack's dataset-captioning pipeline, and it runs fully on your own GPU - no API calls, no keys, no per-image charge. You feed it a loaded vision-language model, an image, and a text instruction, and out comes a caption string you can drop straight into your training folder. It's the node that answers the question "what should I even write in these .txt files?" at dataset scale.

It's one piece of a four-node chain in this pack: the AcademiaSD VLModel (Down)Loader fetches a VLM from HuggingFace, this node does the interrogating, and the pack's batch loader, Counter (from file), and Save Dataset Caption nodes turn it into an automated "load image → caption → write sidecar .txt" loop for a whole folder of images. If you're building that loop, this is the piece in the middle.

How it works. It expects an ACADEMIA_MODEL input - that's a dict from the pack's loader holding the loaded model and its processor. The node converts your image tensor to a PIL image, builds a Qwen-style chat template with the image token inserted, runs generation with max_new_tokens capped and a sampling temperature of 0.6, then strips the prompt prefix and decodes the answer. The output is a single caption STRING. Nothing surprising under the hood - but it means the loader and this node are a matched pair; you can't run one without the other.

The inputs that matter:

  • model - from the AcademiaSD VLModel Loader. Non-negotiable; the whole design is "load once, caption many".
  • image - an IMAGE tensor, usually from your dataset loader.
  • prompt - the instruction, default "Describe this image in detail." This is where you shape caption style; be specific about what you want described.
  • max_tokens - 64 to 2048, default 512. Bump it for long, detailed captions.

Install - and the gotcha. ComfyUI Manager → search comfyui_AcademiaSD → install → restart, or cd ComfyUI/custom_nodes && git clone https://github.com/AcademiaSD/comfyui_AcademiaSD. The catch: this pack ships no requirements.txt, so nothing gets auto-installed for the vision nodes. If the loader crashes on import, you need these in your ComfyUI environment:

pip install transformers bitsandbytes accelerate huggingface_hub

Then the first run downloads the whole model into ComfyUI/models/vision/ - multi-gigabyte, so expect a long first wait. And note the default repo, Qwen/Qwen2-VL-2B-Instruct, is gated on HuggingFace: you must accept the terms and run huggingface-cli login or the download dies with a 401/403. The README's own example sidesteps all of that with huihui-ai/Huihui-Qwen3-VL-2B-Instruct-ablite, an open, uncensored Qwen3-VL fine-tune - a genuinely better default, since it also skips the built-in safety filtering that can refuse to describe perfectly ordinary training images.

Troubleshooting. The loader's low_vram option uses 4-bit bitsandbytes quantization. If you get CUDA setup errors, that's bitsandbytes not matching your torch/CUDA build - reinstall it for your exact CUDA version. And if captions come back formulaic or off-target, that's prompt engineering on your side, not a bug: the model writes whatever your instruction asks for.

One honest take before you commit: if you're captioning the anime/tag lineage (Pony, Illustrious, NoobAI), the community default is still JoyCaption, because those models are trained on tag-style captions. This node writes natural-language prose, which is what you want for LLM-encoder models - Flux, Qwen3-based checkpoints and their cousins. Match the captioner to your target model, not the other way around, and you'll save yourself a retrain.

CategoryAcademiaSD

Inputs (4)

NameTypeDefaultDescription
modelACADEMIA_MODEL
imageIMAGE
promptSTRINGDescribe this image in detail.
max_tokensINT51264–2048

Outputs (1)

NameTypeDescription
captionSTRING