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.
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
- Clone or copy this repository into
ComfyUI/custom_nodes/LD-ComfyUI-Prompt-Nodes. - Install dependencies:
Or let ComfyUI-Manager install them automatically.pip install -r requirements.txt - (Recommended) Install the CUDA-enabled build of
llama-cpp-python:
The script auto-detects CUDA, Metal, or CPU and installs the matching prebuilt wheel. Use/path/to/ComfyUI/venv/bin/python install_llama_cpp.py--dry-runfirst 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 promptsPROMPT_LIST— JSON-encoded list of prompt lists
SlopPrompt
Converts/enhances prompts using SlopPrompt-v5 with 11 conversion modes:
tags -> longtags -> shorttags -> jsontags_hallucination -> longtags_hallucination -> shorttags_hallucination -> jsonlong -> jsonjson -> longlong -> shortjson -> shortshort -> 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 textOUTPUT_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 whenllama-cpp-pythonis built with CUDA.transformers: uses the HF Transformers model (SlopPrompt-v5). Guaranteed CUDA usage viatransformers+accelerate, but uses ~10 GB of disk and more VRAM than the GGUF. Theprecisioninput selectsbfloat16(default),float16,fp8, orfloat32. 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_sizeis passed only when the installedllama-cpp-pythonbuild 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, andmax_tokensto steer results. - For llama.cpp you may see a harmless
n_ctx_seq < n_ctx_trainwarning; 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-conv1dcan make it even faster, but is not required.
Troubleshooting slow generation
- Check the console for the selected backend.
- If you are on
llama.cppand it is slow, yourllama-cpp-pythonwheel may be CPU-only. Run the bundled installer from inside the node folder:
Or install manually:/path/to/ComfyUI/venv/bin/python install_llama_cpp.pyCMAKE_ARGS="-DGGML_CUDA=on" pip install --force-reinstall --no-cache-dir llama-cpp-python - Or select
backend=transformersto 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