Nodes/ComfyUI-AnimaForge-Windows/Anima Batch VLM Caption
ComfyUI Node

Anima Batch VLM Caption

Caption a whole dataset by HTTP without leaving ComfyUI

By AI-KSK·Created 3 months ago·Updated 3 months ago· 0
Anima Batch VLM Caption
  • TASK_LIST
  • VLM_CAPTION_CONFIG
  • TASK_LIST
  • caption_log

Captioning a training set by hand is the most reliable thing you can do, and also the most tedious. AnimaBatchVlmCaption is the automation lane: it walks every image in your TASK_LIST, sends each one to a vision-language model over HTTP, and writes the cleaned caption straight into a .txt file next to the image. You watch the caption_log, it prints OK: 001.png -> ... for every image, and an entire dataset captions itself.

How it works

This is the API path, as opposed to the in-graph llama-cpp path the shipped workflow uses (AnimaLoadCaptionImageBatch → llama-cpp nodes → AnimaSaveLlamaCppCaptions). Here the node does the whole loop itself. For each image it base64-encodes the file into a data URL, builds an OpenAI-format chat.completions request with a captioning prompt, and POSTs it to api_url (configured in AnimaVlmCaptionConfig). The response is parsed, run through the pack's clean_caption cleaner, and written as image.txt.

Where does the VLM live? Your call, and the pack's default tells you the intended shape: http://127.0.0.1:8000/v1/chat/completions - a local server. The repo even ships a vlm_server.py that can stand up a llama-cpp compatible server (defaulting to a Gemma4-class GGUF) on port 8000. This is the "local uncensored VLM, free per call" pattern the KB's LLM-in-ComfyUI notes describe - no cloud key required, which is a big deal for captioning anime datasets where a censored API would mangle things.

The inputs

  • TASK_LIST - from AnimaBatchFolderLoader. Empty → ERROR: TASK_LIST is empty.
  • VLM_CAPTION_CONFIG - the config object from AnimaVlmCaptionConfig. It carries the endpoint, model name, caption mode, trigger mode, temperature, timeout, and the overwrite flag.

Outputs are TASK_LIST (same tasks, with refreshed caption counts) and caption_log - a per-image summary that ends with VLM caption finished. saved=N, skipped=N, failed=N. The skip logic comes from the config's overwrite_existing_caption: false (the default) means images that already have a non-empty caption are skipped, so re-running the workflow only fills the gaps.

Installing it

Part of the AnimaForge Windows pack: ComfyUI Manager → "ComfyUI-AnimaForge-Windows", or

cd C:\ComfyUI\custom_nodes
git clone https://github.com/AI-KSK/ComfyUI-AnimaForge-Windows.git
cd ComfyUI-AnimaForge-Windows
powershell -ExecutionPolicy Bypass -File .\scripts\install_windows.ps1

The pack's requirements.txt is just requests and pillow - nothing heavy. The heavy part is the VLM server: a Gemma-class GGUF and its matching mmproj file (the README's layout is ComfyUI\models\LLM\gemma-3-12b-it-heretic-Q6_K.gguf plus the mmproj). Restart ComfyUI after install.

Common issues

Everything here surfaces as a per-image ERROR in the log rather than a crash, which is both kind and easy to miss. The big three: the server isn't running (connection refused - start your VLM server first), the model name in the config doesn't match what the server exposes (HTTP 400), and images with weird formats failing the base64/verify step. Timeouts default to 120s per image, so a slow model just logs VLM API connection failed after a couple of minutes if the server is wedged. And a note from real users: AnimaForge's auto-captions can run long - one community report mentioned 1200+ characters of mostly natural language - and it still trains fine, but it's worth spot-checking a few .txt files before a big run, because every VLM fumbles multi-subject attribution.

CategoryAnima/Batch LoRA

Inputs (2)

NameTypeDefaultDescription
TASK_LISTTASK_LIST
VLM_CAPTION_CONFIGVLM_CAPTION_CONFIG

Outputs (2)

NameTypeDescription
TASK_LISTTASK_LIST
caption_logSTRING