Clean Style From Caption
Strip the fluff out of your training captions
- clean_caption
Clean Style From Caption is a text-scrubbing node: you feed it a caption and it strips the boilerplate phrasing that image-captioning models love to add. Input "The image shows an anime-style illustration of a girl reading a book" comes out "a girl reading a book" - the "the image shows" opener and the whole "anime-style illustration of" preamble deleted in one pass.
This is a dataset-prep tool, plain and simple. If you've trained or even browsed LoRA training guides, you know the drill: captions like "a photo of" and "an illustration of" train the model to bake "photo of" and "illustration of" into everything, and they waste caption tokens on words that don't describe the subject. When you're captioning thousands of images - especially with auto-captioners like JoyCaption and friends, which generate exactly this kind of prose - you want the descriptive core and nothing else. This node is a cheap, deterministic way to strip the generic bits before captions hit your training set.
How it works
It's a small set of regex rules, applied in order:
- Removes leading openers: "the image shows", "the image is", "this image shows", "this image is" (case-insensitive).
- Removes a leading style block that ends in "of": any run of style words ("anime-style", "digital", "watercolor"...) followed by an optional article and a noun like drawing/illustration/painting/rendering/render/model/photo/photograph/image/scene, then "of". So "a digital painting of" vanishes.
- Tidies the leftovers - collapses double spaces, normalizes commas, strips stray "a ," artifacts.
It's important to know what this does not do: it only attacks the front of the caption, and only the specific patterns in its list. A style phrase in the middle of a caption survives. "a highly detailed illustration of a dragon" - the style words there aren't leading, so they stay. It's a targeted opener-scrubber, not a general caption cleaner.
Inputs and outputs
- caption (STRING) - the text to clean. Empty input returns empty output.
Output:
- clean_caption (STRING) - the scrubbed text.
Wire it between your caption source and your training dataset saver, or use it on a single caption to see how it rewrites things before you trust it at scale.
Installing it
Ships in ComfyUI Fictiverse Nodes. ComfyUI Manager → search "ComfyUI Fictiverse Nodes" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Fictiverse/ComfyUI_Fictiverse
Pure Python regex, no dependencies, no models. Apache 2.0.
Common issues
Pack gotcha: ModuleNotFoundError: No module named 'custom_nodes.ComfyUI_Fictiverse' means the folder isn't named exactly ComfyUI_Fictiverse; rename and restart.
For this node, the real-world issue is expectations. It was written for the specific caption style that auto-captioners produce - leading openers and "X of" style preambles. If your captions come from a different source (hand-written, or a tagger producing danbooru-style tags), it will do nothing, because those captions don't have that structure. That's not a bug; it just means check your caption source before wiring this in as a universal filter. And since it's regex, run it on a sample batch first and eyeball the output - regex edge cases (odd punctuation, multi-line captions) are exactly where silent caption corruption sneaks in.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| caption | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| clean_caption | STRING | — |