Nodes/ComfyUI_DW_Chat/Gemma 2 IT Prompt Generator
ComfyUI Node

Gemma 2 IT Prompt Generator

Local Gemma 2 that writes SDXL, Kolors, or Flux prompts with a toggle

By yiwangsimple·Created 2 years ago·Updated about a year ago· 89
Gemma 2 IT Prompt Generator
    • positive_prompt
    • negative_prompt
    theme
    max_tokens1000
    top_p0.95
    devicecpu
    precisionfloat32
    prompt_type
    seed-1

    Gemma 2 IT Prompt Generator is the local, no-API-key prompt writer in the pack - and the one with the most carefully tuned prompt recipes. You give it a theme, and it runs Google's gemma-2-2b-it on your own machine to produce a positive and negative prompt. The clever bit is the prompt_type dropdown: sdxl, kolors, or flux. Each one swaps in a completely different system prompt. SDXL gets the classic tag stack ("(best quality,4k,8k,highres,masterpiece:1.2)..."), negative tags for bad anatomy and bad hands; kolors gets a natural-Chinese DALL·E-3-style description; flux gets a 180+-word English paragraph with composition, lighting, and atmosphere guidance. The node even hands you a pre-written negative prompt per type (the SDXL one is the longest - mutation warnings and all).

    Mechanically it loads the model with HuggingFace transformers, runs generation with temperature=0.7, top_p from the input, and do_sample=True. The seed input defaults to -1, which means "random seed each run" - set a fixed seed if you want repeatable prompts. device (cuda/cpu) and precision (float32/float16) let you squeeze it onto weaker hardware; float16 on cuda is the sane choice for a 2B model.

    Inputs: theme (multiline), max_tokens (default 1000), top_p (0.95), device, precision, prompt_type, seed. Outputs: positive_prompt and negative_prompt, both STRING - wire them into the two conditioning paths directly.

    Installing it - this one needs a manual model download

    The README is explicit here. The model is not auto-downloaded:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yiwangsimple/ComfyUI_GroqChat
    

    then grab gemma-2-2b-it from HuggingFace and drop it in:

    mkdir -p ComfyUI/models/LLavacheckpoints/gemma-2-2b-it
    # download https://huggingface.co/google/gemma-2-2b-it/tree/main into that folder
    

    Note it's a gated model - you'll need to accept Google's terms on HuggingFace and use a token (or huggingface-cli login) to download it. transformers>=4.41.1 and torch come from requirements.txt.

    Gotchas

    If the model folder is empty or missing, the node raises "Model not found... Please manually download the model" - a loud, honest failure. Watch out for the path mismatch though: the source checks models/LLavacheckpoints/gemma-2-2b-it (the README says the same), but the error message confusingly links google/gemma-2b-it. Follow the README's path, not the error's. This is also the heavyweight node of the pack: a 2B model is small, but the first run downloads/loads it and the float32-on-cpu path is slow - give the first execution a moment. Honestly, for most people the Groq or Gemini prompt nodes are the easier win; this one earns its keep when you want prompts generated with zero network calls.

    Category🌙DW/prompt_utils

    Inputs (7)

    NameTypeDefaultDescription
    themeSTRING
    max_tokensINT10001–2000
    top_pFLOAT0.950–1
    deviceCOMBOcpu2 options: cuda, cpu
    precisionCOMBOfloat322 options: float32, float16
    prompt_typeCOMBO3 options: sdxl, kolors, flux
    seedINT-1-1–18446744073709550000

    Outputs (2)

    NameTypeDescription
    positive_promptSTRING
    negative_promptSTRING