种子
One seed, several samplers, and a way to get the good one back
- SEED
The seed is the most emotionally loaded number in this whole hobby. You get a great image on a random seed, you go to lock it down, and it's gone - because the number in the box was replaced at the end of the run. That's not a bug in any particular node; it's control_after_generate, and it's the single most reliable beginner injury in ComfyUI.
种子 (QG_Seed) exists to make that injury not happen. It's one seed on its own INT wire, with a card that shows you the number, a mode switch, and - the important bit - the seed that actually ran.
How it works
The backend is almost nothing, on purpose. There's one seed integer input, one SEED integer output, and the node passes the value straight through. It also ships {"ui": {"seed": [seed]}} back to the frontend with the value it just used.
That return payload is the whole design. In randomize mode the frontend replaces the number the moment you hit Queue, so the box on the node already shows next run's seed while this run is still sampling. Reading the box is therefore useless for recovering what you liked - you have to read the value that came back from execution, which is exactly what this node surfaces. The line under the box shows the last run's real seed. Use last drops it back into the box and pins it. The ▾ menu keeps the last several.
The 随机值 / 固定 / Step segmented control on the card is appearance over ComfyUI's own machinery: it drives the control_after_generate widget that core attaches to any integer, then hides that widget so the node looks like a purpose-built seed card. Step goes up or down by one per queue; clicking Step again flips the direction.
There's a compatibility detail that matters if you have old workflows: the -1 / -2 / -3 sentinel convention that rgthree popularised is translated into "mode + a concrete seed" when the graph loads. So a two-year-old workflow with -1 in a seed field opens with Randomize selected and existing links intact, rather than erroring or silently sampling at -1.
Inputs and outputs
seed(required, INT, 0 to 2^64−1) - the number sent downstream. How it changes between runs is set by the card's mode control.- Output
SEED(INT) - the value this run actually used.
Wire SEED into every sampler's seed. If you've converted each sampler's seed widget to an input (right-click → convert to input), one 种子 card now feeds all of them, and a multi-pass workflow - base, hires, detailer - stays on one number. That's the whole reason to use it rather than typing the same seed four times.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/live1617/ComfyUI-QG-tools
Full restart; look for [QG-tools] v0.9.2 加载完成 | 节点数 24 in the console. Manager search for ComfyUI-QG-Tools where the registry entry is live. No pip dependencies - the pack's requirements file is comments-only so Manager has no pip step, and this node needs nothing beyond Python.
The card interface comes from AusBoss (MIT); the pack's changelog credits rgthree for the earlier sentinel-based model it replaced. Search seed, random seed or 种子.
Where people get burned
The box is not the truth in randomize mode. This is the node's central lesson and its central confusion: in Randomize, what you see is the next seed, not the current one. Trust the line underneath, or hit Use last.
Global widget control mode still rules the rest of the graph. This node sidesteps the problem by reporting what ran, but if your other nodes still use ComfyUI's default "after" behaviour, their seeds are still being replaced post-run. Setting widget control mode to Before once in ComfyUI's settings makes the box show the number that will be used, everywhere. The KB records a +231 tutorial making this the first thing to change in a fresh install; it's good advice regardless of pack.
Multiple seeds for one image. If your detailer sampler is on its own independent seed, the "one seed" promise is broken even though the node works fine. Convert every seed widget to an input and wire them all from this one node, or resign yourself to non-reproducible second passes.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| seed | INT | 00–18446744073709550000 | 发给下游的种子。卡片上的「随机值 / 固定 / Step」决定每次排队之后它怎么变:随机值重新抽一个、固定不动、Step 每次 +1 或 -1。 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SEED | INT | 本次实际使用的种子值。 |