Nodes/danbot-comfy-node/Danbot Extension Extractor
ComfyUI Node

Danbot Extension Extractor

The typo in the name hides a genuinely useful second pass

By p1atdev·Created 2 years ago·Updated about a year ago· 35
Danbot Extension Extractor
  • danbot_model
  • extension_kwargs
generated_tags

Yes, that's "Etension" - missing the "x". The class name and the node name carry the typo, and you'll see it in the search bar exactly like that. It's annoying, but it's also the sort of thing that makes this node easy to find again, so maybe thank the author later.

Functionally it's the mirror image of the Danbot Translation Extractor, doing for the extension pass what that node does for the translation pass. In a translate-then-extend workflow, the model makes two passes: first it translates your sentence into base tags, then it "extends" that list with additional tags the sentence never mentioned - clothing details, backgrounds, character specifics the model thinks belong in the scene. The extension output comes wrapped in <extension>...</extension> markers, and this node pulls those out.

What it takes and gives

Inputs are the same two-handle setup: danbot_model from Danbot Load Model, and generated_tags - again, feed it the Generator's raw_output string with the special tokens intact, not the cleaned list. The output is an extension_kwargs handle (type DANBOT_FORMAT_KWARGS) containing a dict with a single extension key.

Where it actually pays off is back in the Danbot V2408 Formatter. The extension template has slots for copyright, character, and translation context plus the extension tags themselves. Wire this node's output into the Formatter alongside the Translation Extractor's, and you can loop: translate, extend, extract, re-extend. Each pass the model sees more context and the tag list grows more specific. That's the "extension" in the README's example table - the difference between the first sparse column and the fat second column of tags.

Gotchas

  • Raw output, not clean output. Same trap as its sibling node; wrong input = empty dict.
  • The extension pass defaults to the </general> stop token, which matches the standard extension template. If you swap templates, check the Generator's stop_token matches the new template's closing tag or generation will run long.

Install

Standard pack install - ComfyUI Manager, search danbot-comfy-node, or:

cd ComfyUI/custom_nodes
git clone https://github.com/p1atdev/danbot-comfy-node
cd danbot-comfy-node
pip install -r requirements.txt

(portable: ../../../python_embeded/python.exe -s -m pip install -r requirements.txt.) Deps are transformers, sentencepiece, protobuf; restart ComfyUI after installing. And when you search for the node, type "Etension" - the "Extension" spelling won't match.

Categoryprompt/Danbooru Tags Translator

Inputs (2)

NameTypeDefaultDescription
danbot_modelDANBOT_MODEL
generated_tagsSTRINGThe tags generated by the model.

Outputs (1)

NameTypeDescription
extension_kwargsDANBOT_FORMAT_KWARGS