Extensions/LD ComfyUI Prompt Nodes
ComfyUI Extension

LD ComfyUI Prompt Nodes

Contains SlopPrompt and BooruPromptGenerator nodes to automate prompt generation for anime models. SlopPrompt allows natural language prompt generation or advanced formats like json and various conversions between them, while BooruPromptGenerator will let you generate random prompts anchored around tags you specify with various sampling options.

By KoishiAI·Created about a month ago·Updated about a month ago· 6
KoishiAI/LD-ComfyUI-Prompt-Nodes
Nodes
On cloudLocal install
Stars6
Updatedabout a month ago
Readme

LD ComfyUI Prompt Nodes

Native ComfyUI nodes for SlopPrompt and Booru prompt generation.

  • Booru Prompt Generator — small transformer that generates Danbooru-style tag prompts.
  • SlopPrompt — Qwen3.5 4B fine-tune for converting prompts between tags, short phrases, long descriptions, and JSON.

Models are downloaded automatically on first use.

Installation

  1. Clone or copy this repository into ComfyUI/custom_nodes/LD-ComfyUI-Prompt-Nodes.
  2. Install dependencies:
    pip install -r requirements.txt
    
    Or let ComfyUI-Manager install them automatically.
  3. (Recommended) Install the CUDA-enabled build of llama-cpp-python:
    /path/to/ComfyUI/venv/bin/python install_llama_cpp.py
    
    The script auto-detects CUDA, Metal, or CPU and installs the matching prebuilt wheel. Use --dry-run first to preview the command.

Model Storage

Models are stored under ComfyUI/models/LLM/:

  • LD-BooruPromptGenerator/ — Booru model files (~65 MB)
  • LD-SlopPrompt/ — SlopPrompt GGUF files (~5.1 GB for Q8_0)
  • LD-SlopPrompt-HF/SlopPrompt-v5/ — SlopPrompt HF Transformers model (~10 GB)

You can also place manually downloaded files there.

Nodes

Booru Prompt Generator

Generates tag prompts with controls for:

  • Mode: Empirical, Diverse, or Custom alpha
  • Prompt count and length
  • Content rating (g, s, q, e)
  • Anchor and blacklist tags
  • Temperature, top-k, top-p
  • Distribution bias weight
  • Seed and VRAM keep/unload

Outputs:

  • PROMPTS — newline-separated prompts
  • PROMPT_LIST — JSON-encoded list of prompt lists

SlopPrompt

Converts/enhances prompts using SlopPrompt-v5 with 11 conversion modes:

  • tags -> long
  • tags -> short
  • tags -> json
  • tags_hallucination -> long
  • tags_hallucination -> short
  • tags_hallucination -> json
  • long -> json
  • json -> long
  • long -> short
  • json -> short
  • short -> long

Parameters: temperature, top-p, top-k, repetition penalty, n-gram blocking, seed, device selection, n_gpu_layers, VRAM keep/unload, backend, and precision (transformers only).

Outputs:

  • OUTPUT_TEXT — generated text
  • OUTPUT_MODE — echo of selected conversion mode

Backend selection

The backend input has three options:

  • auto (default): uses llama.cpp when it reports GPU offload support; otherwise falls back to the transformers backend so CUDA is guaranteed through PyTorch.
  • llama.cpp: uses the GGUF model (SlopPrompt-v5-Q8_0.gguf). Fastest when llama-cpp-python is built with CUDA.
  • transformers: uses the HF Transformers model (SlopPrompt-v5). Guaranteed CUDA usage via transformers + accelerate, but uses ~10 GB of disk and more VRAM than the GGUF. The precision input selects bfloat16 (default), float16, fp8, or float32. FP8 requires PyTorch 2.6+ and an Ada Lovelace/Blackwell-or-newer GPU.

If you select llama.cpp with device=cuda but the installed llama-cpp-python build does not support GPU offload, a warning is printed and generation will be slow. The precision setting has no effect on the llama.cpp backend.

Notes

  • First launch downloads models from Hugging Face.
  • no_repeat_ngram_size is passed only when the installed llama-cpp-python build supports it; otherwise it is ignored.
  • The conversion mode is selected via the system prompt. Actual output formatting depends on the model and chat template; tweak temperature, top_p, and max_tokens to steer results.
  • For llama.cpp you may see a harmless n_ctx_seq < n_ctx_train warning; the node limits context to 4096 tokens to keep VRAM usage low.
  • With the transformers backend you may see a message about the "fast path" not being available. This is optional; generation still uses CUDA and is fast on modern GPUs. Installing flash-linear-attention/causal-conv1d can make it even faster, but is not required.

Troubleshooting slow generation

  1. Check the console for the selected backend.
  2. If you are on llama.cpp and it is slow, your llama-cpp-python wheel may be CPU-only. Run the bundled installer from inside the node folder:
    /path/to/ComfyUI/venv/bin/python install_llama_cpp.py
    
    Or install manually:
    CMAKE_ARGS="-DGGML_CUDA=on" pip install --force-reinstall --no-cache-dir llama-cpp-python
    
  3. Or select backend=transformers to use PyTorch CUDA directly.

Credits

  • BooruPromptGenerator: https://huggingface.co/LoliRimuru/BooruPromptGenerator
  • SlopPrompt: https://huggingface.co/LoliRimuru/SlopPrompt
  • BooruPromptRNG space: https://huggingface.co/spaces/LoliRimuru/BooruPromptRNG