ComfyUI Node

Danbooru Tags Upsampler

A local LLM that writes your Danbooru tags for you

By rookiestar28·Created about a year ago·Updated 23 days ago· 16
Danbooru Tags Upsampler
    • upsampled_prompt
    prompt1girl, solo
    model_namedart-v1-sft
    tag_lengthlong
    seed0
    temperature1.00
    top_k30
    top_p1.00
    num_beams1
    model_devicecpu
    model_backendONNX (Quantized)
    max_new_tokens128
    negative_prompt_tags
    ban_tags
    cfg_scale1.5
    debug_loggingfalse

    Type 1girl, solo into this thing and it writes the rest of the tag list for you: ahoge, animal ears, blue hair, blush, fox girl, looking at viewer, smile.... That's the whole pitch, and unlike a lot of ComfyUI "AI prompt helper" nodes it's not calling some cloud API with a key - it's running a small language model locally and giving you the output as a plain string.

    Danbooru Tags Upsampler is a ComfyUI port of p1atdev's sd-danbooru-tags-upsampler extension for AUTOMATIC1111. It's powered by DART, a family of small LLMs p1atdev trained on Danbooru tags to "complete" a prompt the way a booru-literate person would. Both are real and have been around since 2024; this pack is a fairly obscure port by rookiestar28 that makes the same trick work inside ComfyUI without leaving your workflow. The author is upfront that all credit for the concept, model, and core logic goes to p1atdev.

    Why you'd reach for it

    Models in the Danbooru-trained lineage - Illustrious, NoobAI, Pony - respond to the board's exact tag vocabulary, not to prose. A correct tag beats a sentence, and the community's own advice is to stop guessing tags and learn the taxonomy you're prompting against. This node is the "predictive" version of the old random-tag generators, which produced contradictory garbage because nothing checked whether tags actually co-occur. DART learned which tags go together from the board itself, so you get plausible, coherent completions instead of 1girl plus two male character names. There's a reason gwern pointed at this exact approach years ago.

    How it works

    Your prompt goes through an analyzer that classifies what you typed against the bundled tag lists (character.txt, copyright.txt, quality.txt - about 15,000 tags total). The DART model then gets a special length token - <|long|>, <|short|>, and friends - plus your tags, and generates a completion. The node joins your original prompt with the generated tags into one upsampled_prompt string. Sampling is standard: temperature, top_k, top_p, num_beams, max_new_tokens.

    Three backends matter here. Original runs the plain Hugging Face model and is the only one that supports CFG. ONNX and ONNX (Quantized) - the default - are optimized exports that enforce ban_tags but reject CFG requests. Models auto-download from Hugging Face on first use (pinned revisions), into the usual HF cache.

    The inputs that actually matter

    • prompt - your base tags, e.g. 1girl, solo (default). Garbage in, garbage out; give it a real seed prompt.
    • tag_length - very short / short / long / very long. This is the big one; long (< 40 tags) is a sensible start.
    • ban_tags - comma-separated tags or wildcards to exclude, like english text, * background.
    • model_backend and model_device - default to ONNX (Quantized) and cpu.

    The output is upsampled_prompt (a single STRING), which you wire straight into a CLIPTextEncode node and then into the KSampler.

    Installing it

    The easy way is ComfyUI Manager: search "Danbooru Tags Upsampler" and install. Manual:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/rookiestar28/ComfyUI-Danbooru-Tags-Upsampler.git
    cd ComfyUI-Danbooru-Tags-Upsampler
    python install.py
    

    requirements.txt pulls transformers, optimum[onnxruntime], tokenizers, and sentencepiece. PyTorch is deliberately not pinned - ComfyUI manages its own torch, so don't pip-install a separate build. Then restart and the node appears under Prompt Styling → casual_gamer28.

    Where people get burned

    • The first run looks hung. It's downloading a DART model into the HF cache. Watch the console and be patient.
    • CFG needs the Original backend. negative_prompt_tags + cfg_scale only do anything there (and cfg_scale is ignored unless you supply negative tags). ONNX rejects CFG outright.
    • Not every model works on every backend. dart-v2-moe-sft is Original-only; dart-v2-sft only ships a quantized ONNX. The node falls back with a warning when an artifact is missing, so read the log.
    • Reproducibility is loose. The seed tooltip says results can still vary across backends, devices, and library versions - don't expect bit-identical prompts after swapping machines.
    • Bracket weirdness. The node escapes/unescapes () and [] (inherited from the original extension), and their interaction with CLIPTextEncode is a known fiddly spot.

    One honest caveat: this is a prompt writer, not a quality button. Feed it to an Illustrious/NoobAI/Pony workflow where tags are the language. On a natural-language model like Flux, a generated tag list is mostly noise.

    CategoryPrompt Styling/casual_gamer28

    Inputs (15)

    NameTypeDefaultDescription
    promptSTRING1girl, soloComma-separated Danbooru tags to analyze and expand.
    model_nameCOMBOdart-v1-sftAllowlisted DART model. Model files use a pinned revision and may download on first use.
    tag_lengthCOMBOlongTarget amount of detail requested from the DART model.
    seedINT00–4294967295Generation seed. Reproducibility can still vary across backends, devices, and library versions.
    temperatureFLOAT1.000.01–5Sampling randomness; higher values produce more varied tag choices.
    top_kINT300–1000Limits sampling to the highest-probability tokens; 0 disables this limit.
    top_pFLOAT1.000–1Nucleus-sampling probability mass; 1.0 keeps the full distribution.
    num_beamsINT11–20Beam-search width. Larger values use more time and memory.
    model_deviceCOMBOcpuRequested execution device. Failed CUDA initialization falls back to CPU and is logged.
    model_backendCOMBOONNX (Quantized)Original supports CFG. ONNX variants enforce ban tags but reject CFG; unavailable artifacts fall back with a warning.
    max_new_tokensINT1288–512Maximum number of new tokens generated for the tag completion.
    negative_prompt_tagsoptSTRINGTags used for CFG with the Original backend. ONNX rejects CFG requests.
    ban_tagsoptSTRINGComma-separated tags or supported wildcard patterns to block on every backend.
    cfg_scaleoptFLOAT1.51–10Classifier-free guidance strength for negative tags; supported only by Original.
    debug_loggingoptBOOLEANfalseEnable detailed node/runtime logs for troubleshooting.

    Outputs (1)

    NameTypeDescription
    upsampled_promptSTRINGThe original prompt plus generated Danbooru tag completions.