Nodes/danbot-comfy-node/Danbot V2408 Formatter
ComfyUI Node

Danbot V2408 Formatter

The node that builds the model's actual prompt string

By p1atdev·Created 2 years ago·Updated about a year ago· 35
Danbot V2408 Formatter
  • model
  • template_config
  • format_kwargs
  • tag_template
template_name

The Danbot model doesn't read your sentence directly and wing it. It expects a specific prompt shape - a chat-like scaffold with rating, aspect-ratio, and length tokens up front, then marker slots for copyright, character, translation, and extension tags. Danbot V2408 Formatter is the node that assembles that scaffold. It's the plumbing between the config dials and the Generator, and honestly, it's the one you most want to understand if you ever want to peek under the hood.

Why does the scaffold exist at all? Because the model is an encoder-decoder trained to fill in these slots. Hand it a template with the right tokens and it knows exactly what job it's doing - "translate this sentence" vs "extend this tag list." Skip the template and the Generator produces garbage, because the model genuinely doesn't know what to emit.

The inputs

Three required:

  • model - the danbot_model handle from Danbot Load Model. The formatter needs it because the prompt templates live inside the model wrapper, loaded from the pack's config/prompt_templates.yml.
  • template_config - a V2408 Template Config handle carrying the rating/aspect/length dials.
  • template_name - translation or extension, usually wired from the Template Config node's second output. Selects which template to build.

One optional: format_kwargs (type DANBOT_FORMAT_KWARGS) - this is where the Translation Extractor and Extension Extractor plug in. In a two-pass graph, the translation extractor's copyright/character/translation keys get splashed into the extension template so the second pass has context to extend from.

The output

A single string: tag_template. That's what you feed into the Danbot Generator's tag_template input. It looks like gibberish - <|bos|>, <|rating:general|>, <|aspect_ratio:tall|>, <|translate:exact|>, <copyright>... - but every token is load-bearing. The Generator passes it verbatim to the model.

Practical notes

  • In the bundled V2408 Pipeline this formatting is internal; you only build the Formatter graph by hand when you want fine control (e.g. a different config per pass, or extractor kwargs you've edited).
  • The v2408 half of the pack's README example uses translation + very_short for pass one and extension + long for pass two. Copy that split; it's the tuned recipe.
  • EXPERIMENTAL flag in source - the node is just string formatting, and it's stable enough that the pack's own shipped workflows depend on it.

Install

ComfyUI Manager → 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.) Restart ComfyUI; dependencies are transformers, sentencepiece, protobuf.

Categoryprompt/Danbooru Tags Translator

Inputs (4)

NameTypeDefaultDescription
modelDANBOT_MODEL
template_configDANBOT_TEMPLATE_CONFIG
template_nameCOMBO2 options: translation, extension
format_kwargsoptDANBOT_FORMAT_KWARGS

Outputs (1)

NameTypeDescription
tag_templateSTRINGFormatted tag template that should be passed to the upsampler node.