GPT Text Sampler
Run a local GGUF LLM inside your ComfyUI graph
- model
- STRING
This is the other half of GPT-Loader-Simple - the loader gets a GGUF language model into your graph, this node actually runs it. Feed it a prompt and a loaded model, and it generates text through llama-cpp-python, the same way you'd get output from any local llama.cpp setup, just wired into ComfyUI's node graph instead of a terminal or a separate chat UI.
How it works
Under the hood this is calling straight into llama.cpp's completion API, and the parameter list reflects that pretty directly if you've used any local LLM tooling before. prompt is your input text. model is the Llama instance from GPT-Loader-Simple, and this bare version of the sampler also wants model_path fed alongside it - the resolved checkpoint path the loader's second output provides. max_tokens (default 128) caps how much it generates. temperature, top_p, top_k, and tfs_z are the standard sampling knobs that trade determinism for variety; frequency_penalty, presence_penalty, and repeat_penalty all push against the model repeating itself. stop_token tells it when to quit generating early. prefix and suffix default to ### Instruction: and ### Response: - that's Alpaca-style instruction formatting, and it matters more than it looks: if you're running a model trained on a different chat template (ChatML, ordinary chat-turn formatting, whatever), leaving these defaults on can produce noticeably worse output. Match the prefix/suffix to whatever format your specific GGUF model actually expects.
The inputs and outputs that matter
Beyond prompt and model: cached (default NO) skips regenerating if the input hasn't changed, useful when you're iterating on something downstream and don't want to re-run the LLM every single queue. echo controls whether the prompt itself gets included alongside the generated text. print_output just dumps the result to your console, handy for debugging without wiring up a text-preview node.
Output is a single STRING - the generated text, ready to feed into a CLIP Text Encode if you're using this to auto-write or expand prompts, or anywhere else that takes text.
Installing the pack
- ComfyUI Manager - search "ComfyUI-N-Nodes," install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/Nuked88/ComfyUI-N-Nodes.git, then restart ComfyUI.
llama-cpp-python installs itself with prebuilt CUDA wheels now, per the README - no manual compile step needed for GPU support the way older guides describe.
Common issues & troubleshooting
Output reads like garbage or ignores your prompt. Check prefix/suffix against what your model actually expects. The Alpaca-style default (### Instruction: / ### Response: ) is right for Alpaca-format models and wrong for a lot of newer chat-tuned GGUFs - a template mismatch is one of the most common causes of nonsense output from any local LLM setup, this one included.
Generation is slower than you'd like. That's a loader-side setting, not this node - go back to GPT-Loader-Simple and check gpu_layers. If it's low, most of the compute is landing on CPU regardless of what this sampler's settings say.
Repeats itself in longer generations. Push repeat_penalty up from its default (1.17647) and check frequency_penalty/presence_penalty - all three exist specifically to fight this, and the default values are a reasonable starting point rather than the last word.
You're missing model_path and hitting an error. That input only exists on this older bare version of the sampler - if you're using GPT-Loader-Simple [n-suite]'s single model output, pair it with GPT Text Sampler [n-suite] instead, which drops the model_path requirement.
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| model | CUSTOM | — | |
| model_path | STRING | — | |
| max_tokens | INT | 2048 | — |
| temperature | FLOAT | 0.700.2–1 | — |
| top_p | FLOAT | 0.500.1–1 | — |
| logprobs | INT | 0 | — |
| echo | COMBO | disable | 2 options: enable, disable |
| stop_token | STRING | STOPTOKEN | — |
| frequency_penalty | FLOAT | 0.00 | — |
| presence_penalty | FLOAT | 0.00 | — |
| repeat_penalty | FLOAT | 1.18 | — |
| top_k | INT | 40 | — |
| tfs_z | FLOAT | 1.00 | — |
| print_output | COMBO | disable | 2 options: enable, disable |
| cached | COMBO | NO | 2 options: YES, NO |
| prefix | STRING | ### Instruction: | — |
| suffix | STRING | ### Response: | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |