Gemma 2 IT Prompt Generator
Local Gemma 2 that writes SDXL, Kolors, or Flux prompts with a toggle
- positive_prompt
- negative_prompt
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.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| theme | STRING | — | |
| max_tokens | INT | 10001–2000 | — |
| top_p | FLOAT | 0.950–1 | — |
| device | COMBO | cpu | 2 options: cuda, cpu |
| precision | COMBO | float32 | 2 options: float32, float16 |
| prompt_type | COMBO | 3 options: sdxl, kolors, flux | |
| seed | INT | -1-1–18446744073709550000 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| positive_prompt | STRING | — |
| negative_prompt | STRING | — |