Anima Caption Prepare
The caption janitor that fixes what the VLM got wrong
- TASK_LIST
- TASK_LIST
- prepare_log
Auto-captions are never clean enough to train on. AnimaCaptionPrepare is the cleanup pass that runs across your whole TASK_LIST right before training: it scrubs the training pollution that VLM and tagger outputs love to smuggle in, makes sure the trigger word leads every caption, and creates a .txt file for any image that still lacks one. It's the reason the batch trains on consistent captions instead of whatever the model happened to say.
How it works
For every image in every task, the node reads the sidecar .txt caption (or notes that there isn't one) and runs it through the pack's clean_caption function. That function is a small but determined text pipeline: it strips markdown and model chatter (<think>...</think> blocks, "FINAL:" prefixes, "image content:" labels), lowercases, de-duplicates tags, and then removes what the README lists as training pollution - masterpiece, best quality, worst quality, score, rating, watermark, logo, signature, artist names, and copyright names. These are exactly the tokens the KB's Danbooru and lora-training panels warn about: quality/score tags narrow the output distribution and leak boilerplate into a character concept. The trigger word is forced to the front, anime illustration is guaranteed in second position, and the result is written back as a UTF-8 .txt.
It also handles the "no caption at all" case: with create_missing_caption = true it writes a minimal fallback - default_caption_body (anime illustration by default) - so training never hits an image with a missing caption file, which would otherwise train that image with garbage or nothing.
The inputs
- TASK_LIST - the scanned tasks.
- trigger_mode -
folder_name,parent_folder, orroot_folder, deciding which name is the trigger. - normalize_existing_caption (true) - rewrite existing captions through the cleaner; leave it on.
- create_missing_caption (true) - write fallback captions for images that have none.
- default_caption_body - the fallback text, default
anime illustration.
Outputs are the updated TASK_LIST (with refreshed caption_counts) and prepare_log, a per-file line of NORMALIZE:, CREATE:, or SKIP: entries ending in Caption prepare finished. created=N, normalized=N, skipped=N.
Installing it
It ships in 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
It has no models of its own - this is pure text munging. Restart ComfyUI after install.
Common issues
The subtle one is that the cleaner is opinionated and lowercasing: a carefully hand-written caption with capitalization or artist names you wanted to keep will be normalized away. It's tuned for the Anima hybrid format (tags + one short phrase), so if you run it on a different caption style, expect edits. Also note normalize_existing_caption runs even on captions the VLM just wrote, which is fine - it's idempotent (an already-clean caption is skipped, not rewritten). The bigger practical advice from the community still applies: auto-caption at scale with a VLM, but for a small character set the manual gold standard beats every cleaner - this node makes your auto-captions consistent, it can't make them true to the image, and consistency-plus-accuracy is what actually trains a good Anima LoRA.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| TASK_LIST | TASK_LIST | — | |
| trigger_mode | COMBO | folder_name | 3 options: folder_name, parent_folder, root_folder |
| normalize_existing_caption | BOOLEAN | true | — |
| create_missing_caption | BOOLEAN | true | — |
| default_caption_body | STRING | anime illustration | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| TASK_LIST | TASK_LIST | — |
| prepare_log | STRING | — |