Nodes/danbot-comfy-node/Danbot Generation Config
ComfyUI Node

Danbot Generation Config

The sampler settings for a text model, not an image model

By p1atdev·Created 2 years ago·Updated about a year ago· 35
Danbot Generation Config
    • generation_config
    max_new_tokens256
    do_sampletrue
    temperature1.00
    top_p1.0
    top_k50
    min_p0.00
    num_beams1

    If you've ever tuned a KSampler, you already know what Danbot Generation Config does - just for a language model instead of an image one. The Danbot transformer that turns your sentence into Danbooru tags samples from a probability distribution over tokens, and this node is the dial panel for that sampling. Temperature, top_p, top_k, all the usual suspects, plus a couple of LLM-specific ones.

    It's an optional node in most workflows, and that's the first thing to know: leave it out and the generator falls back to greedy decoding, which picks the single most likely token every step. That's deterministic, fast, and often fine - it'll give you the safe, boring tag list. You reach for this node when greedy output feels stiff, repetitive, or just wrong, and you want the model to actually think.

    The settings that matter

    • temperature (default 1.0) - the big one. Lower = more deterministic, higher = more creative/random. The tooltip's guidance is worth taking seriously: keep it under 1.5, or the tag output starts degenerating into token soup.
    • top_p (default 1.0) - nucleus sampling: only sample from the smallest token set whose cumulative probability passes the threshold. 1.0 means "ignore this, use everything."
    • top_k (default 50) - sample from only the top 50 most likely tokens. The author suggests staying in the 10–200 range. Together with top_p, these are your diversity brakes.
    • min_p (default 0.0) - a newer knob: drop any token with probability below this. The author's tip here is genuinely useful - set it to ~0.1–0.2 and you can safely push temperature and top_k higher without the output falling apart. It's a gentler filter than top_k.
    • max_new_tokens (default 256, max 512) - hard cap on how many tokens the model generates. If tag lists are getting cut off, bump this.
    • num_beams (default 1) - beam search. 1 = off. The tooltip's the honest take: it's mostly useful as a rescue when temperature is too high and you want coherent-but-random output.
    • do_sample - literally a "true/false" toggle for sampling vs greedy. Leave it on true if you plugged this node in at all.

    The output is a generation_config handle, not a string, and it feeds the Danbot Generator or Danbot V2408 Pipeline. You only need one per workflow - build it once, share it to both nodes.

    Install

    Same story as the rest of the pack. 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.) The pack's real dependencies are transformers, sentencepiece, protobuf; restart ComfyUI afterward and it'll be in the prompt/Danbooru Tags Translator menu.

    Categoryprompt/Danbooru Tags Translator

    Inputs (7)

    NameTypeDefaultDescription
    max_new_tokensINT2561–512Maximum number of tokens to generate
    do_sampleCOMBOtrueWhether to use sampling or greedy decoding
    temperatureFLOAT1.000.1–5Temperature for sampling. Lower values are more deterministic, higher values more random. Default value is 1.0. Recommended to be less than 1.5.
    top_pFLOAT1.00.1–1Tokens are sampled from the smallest set whose cumulative probability exceeds the probability p. Default value is 1.0.
    top_kINT5010–1000Tokens are sampled from the top k most likely tokens. Larger values mean more diversity and randomness. Default value is 50. Recommended to be between 10 and 200.
    min_pFLOAT0.000–1Minimum probability to select tokens from. Tokens with probability less than this value are going to be ignored. Default value is 0.00. If you set this value to around 0.1 ~ 0.2, you can set higher temperature and top_k values.
    num_beamsINT11–10Number of beams to use for beam search. 1 means no beam search. It is effective when the temperature is too high. Default value is 1.

    Outputs (1)

    NameTypeDescription
    generation_configDANBOT_GENERATION_CONFIGGeneration config for the upsampler node.