MinusZone - ApplyCUDAGenerator
The odd node that forces seed reproducibility on CUDA
- model
- MODEL
MZ_ApplyCUDAGenerator is the strangest node in this pack, and possibly the least useful-looking: one input, one output, both just MODEL, and it doesn't seem to change anything. It doesn't change the model at all. It patches ComfyUI's noise generator so the same seed produces the same starting noise - on CUDA, deterministically. You wire model → MZ_ApplyCUDAGenerator → KSampler, and its entire contribution happens at the moment the sampler draws random noise.
How it works
By default, ComfyUI generates the initial latent noise with a CPU-side random generator seeded by your KSampler seed. That's usually fine, but it means the noise is created on one device and moved - and on some setups, especially ROCm or with certain dtype paths, the same seed can give you different noise depending on hardware quirks, which breaks "same seed, same image" expectations. This node monkey-patches ComfyUI's prepare_noise to build a torch.Generator directly on CUDA, seeded with your KSampler seed, and generates the noise tensors on-device. Same seed → identical starting noise → reproducible outputs, at the cost of pinning you to CUDA for the noise step.
That's the whole mechanism: it swaps a global function in comfy.sample so every KSampler downstream uses the CUDA generator. It's why the node sits in the model chain - it has to be "executed" before sampling happens, and hanging it off the model is the convenient way to guarantee that.
Inputs and outputs
model- any MODEL (typically your Kolors model, but it doesn't have to be).- Output:
MODEL, unchanged. You're not transforming the model; you're arming the environment.
When you'd use it
Two realistic cases. First, you're chasing reproducibility - matching a seed exactly across runs or across machines (on CUDA hardware) and the default generator is letting you down. Second, you're on a graph where you've seen seed drift and want to rule out noise generation as the culprit. If you never have seed-matching problems, this node does literally nothing for you and you should leave it out - it adds a CUDA dependency to a step that normally works everywhere.
Install
Standard pack install: ComfyUI Manager search "ComfyUI-Kolors-MZ", or git clone https://github.com/MinusZoneAI/ComfyUI-Kolors-MZ into custom_nodes, restart. No model downloads, no dependencies - it's pure code. The one honest caveat: because it overrides a global in ComfyUI core, it's sensitive to ComfyUI updates; if a core change renames or moves prepare_noise, this node breaks until the pack catches up. On CUDA-only, it's a small, sharp tool; on CPU or MPS-only machines it's a trap, since "CUDA" is in the name.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |