ComfyUI Node

Auto Label

Old-school BLIP captions, no API key required

By fexploit·Created 2 years ago·Updated about a year ago· 12
Auto Label
  • image
  • main_object_description
prompta photography of
repo_idSalesforce/blip-image-captioning-base
inference_mode
get_model_onlinetrue

Auto Label answers the question "what's actually in this image?" without leaving ComfyUI. You wire in an image, it hands back a sentence - "a photography of a red car parked in front of a building" - and that string is ready to feed into a text encoder, a save node, or a dataset pipeline. It's the simplest kind of custom node there is: one input, one string output, one model. If you've ever wanted to auto-prompt an img2img loop or caption a folder of generations without spinning up a separate tool, this is the node for the job.

The engine is BLIP (Salesforce's blip-image-captioning-base), pulled from Hugging Face on first run. Under the hood it's just transformers - BlipProcessor + BlipForConditionalGeneration, exactly the pattern you'd use in a notebook. Your image tensor gets squeezed down to a PIL image, the processor converts it plus your text prefix into tokens, model.generate() produces the caption, and out comes a plain string. No API, no key, nothing cloud-hosted. It's a 2021-era caption model running locally, for better and for worse.

The inputs that actually matter

Most of the fields are set-and-forget. The ones worth touching:

  • image - your IMAGE tensor. Feed it one image at a time. The node squeezes the tensor to a single frame and doesn't batch; dropping a batch of several images in will misbehave rather than caption each one.
  • prompt - the text prefix that biases the caption. Default is a photography of, so you get "a photography of a …" sentences. Change it to a cartoon of or a close-up photo of and the caption bends that direction. This is BLIP's conditioning, and it's more useful than it looks.
  • inference_mode - gpu_float16 (what the node actually ships with, despite the README claiming "gpu"), gpu, or cpu. float16 halves the VRAM footprint of the model; cpu works but is noticeably slow for a ~1 GB model.
  • get_model_online - set false to force offline mode. Only works if the model's already in your Hugging Face cache.

repo_id defaults to Salesforce/blip-image-captioning-base and you can point it at another HF caption repo if you ever want to. The one output, main_object_description (STRING), plugs straight into CLIPTextEncode's text input or a text save/display node.

Installing it

Two ways, both boring. Via ComfyUI Manager, search "ComfyUI-AutoLabel" and hit install. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/fexploit/ComfyUI-AutoLabel
cd ComfyUI-AutoLabel
pip install -r requirements.txt

Then restart ComfyUI. The requirements are transformers, accelerate, datasets, sentencepiece, plus torch and Pillow (which ComfyUI already ships). The real "download" isn't the pip step - it's the model, roughly a gigabyte, fetched from Hugging Face the first time the node runs. Budget for that if you're on slow internet or a metered connection.

Where it bites

The honest take: BLIP is old. For captioning LoRA training data, the community moved past it years ago - the KB's own training lore calls BLIP captions formulaic and "pure trash" next to JoyCaption or Florence 2, which is why this is a quick utility, not a training-workhorse. If your plan is dataset captions for modern models, use a WD14 tagger (Illustrious/Pony lineage) or JoyCaption (LLM-encoder models) instead. Where Auto Label still earns its keep is describing a single image fast, with no external tool and no key.

Two gotchas grounded in the code. First, the error handling is quiet: if generation fails, the node swallows the exception and returns the string "Error occurred during caption generation" - so downstream, your prompt can silently become that garbage text. If captions suddenly look wrong, check the console. Second, an empty repo_id throws "Need a repo_id or local_model_path" even though the field is called repo_id - the node's idea of "local model path" is a HF repo ID. Minor, but it'll confuse you exactly once.

It's a single-purpose node from a small pack with basically no community footprint. It won't transform your workflow - but when you need a caption string from an image, it does exactly that, without any of the drama.

CategoryAutoLabel

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
promptSTRINGa photography of
repo_idSTRINGSalesforce/blip-image-captioning-base
inference_modeCOMBO3 options: gpu_float16, gpu, cpu
get_model_onlineBOOLEANtrue

Outputs (1)

NameTypeDescription
main_object_descriptionSTRING