deep_gen
Getting usable text out of DeepSeek R1 inside ComfyUI (think tags and all)
- deep_model
- STRING
DeepSeek R1 answers every question in two parts: a private chain-of-thought wrapped in <think> tags, then the actual answer. deep_gen - the generation half of the comfyui-deepseek-r1 pack - hands you the whole string, thinking included. Knowing that up front saves you the half-hour everyone else spent wondering why their "prompt" output looked like a robot's diary.
What it is
deep_gen is what makes this pack interesting. deep_load pulls a DeepSeek-R1 distill into ComfyUI's memory manager; this node runs the model and returns text. Wire its STRING output into a CLIP Text Encode and you're feeding a reasoning model's words straight into image generation. Or just use ComfyUI as a local chat front end. No API key, no Ollama daemon, nothing external - at release in January 2025, that was rare enough that the author's whole pitch was "we're the only ones doing R1 natively in ComfyUI."
How it works
It's a thin wrapper around HuggingFace transformers. The node builds a chat message list (an empty system message plus your user_prompt), runs it through the model's chat template, then calls model.generate() with your sampling parameters. The seed is applied via set_seed(seed % 9999999), and the decoded response comes back as one STRING, skip_special_tokens=True.
The inputs that matter
A beginner only really touches three of these:
- user_prompt - the ask. Multiline, so you can paste in a whole brief.
- max_tokens - default 500. Every token costs GPU seconds on a 7B+ model, so when you only need a sentence to feed into an image prompt, trim this hard.
- temperature - 0 to 2, default 1.0. Drop toward 0.7 if the answers are wandering; it's a reasoner, not a poet.
seed (default 888), top_k (50), and top_p (1.0) are there if you want reproducibility, but the defaults are fine for day one. Then deep_model - the DEEP_MODEL output from deep_load.
The output is STRING: the raw completion. Wire it into a CLIP Text Encode, a display node, or a text saver.
The <think> gotcha
R1 doesn't just answer; it reasons first, and that reasoning comes out as <think>...your chain of thought...</think> followed by the actual response. deep_gen doesn't strip it - the reasoning is part of what you get. If you're feeding this into an image prompt, you only want the part after </think>. The community workaround is a text-split node keyed on </think> keeping the second half, then a strip_tags pass to clean up the leftover blank. Works fine, just don't be surprised the first time.
Speed, and the elephant in the room
On the author's 24GB 3090, the 7B distill answers in about 10–15 seconds; the 14B takes ~150 seconds. If yours is slower, it's VRAM pressure - the v0.2 build pins the model to CUDA, and a smaller card means offloading. Also note v0.2 removed the system prompt input, so don't go hunting for it; the system message is hardcoded empty.
And the bigger caveat: the GitHub repo is 404 now. As of mid-2026 github.com/ziwang-com/comfyui-deepseek-r1 is gone and the pack was never in the ComfyUI-Manager registry, so fresh installs come from the author's portable bundle (zwpython/comfyui-deepseek-r1-portable on HuggingFace) or an archived copy. The one-line dependency is transformers>=4.37.0.
The R1-comfyui moment was a snapshot of early 2025, and this node is a period piece - but it's also the cleanest demonstration of the idea that followed it: a real LLM living inside ComfyUI's graph. Grab a copy and it still runs, fully offline, today.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| deep_model | DEEP_MODEL | — | |
| user_prompt | STRING | — | |
| seed | INT | 8880–18446744073709550000 | — |
| max_tokens | INT | 5000–18446744073709550000 | — |
| temperature | FLOAT | 1.000–2 | — |
| top_k | INT | 500–101 | — |
| top_p | FLOAT | 1.000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |