StyleGAN Sampler
The node that turns a StyleGAN latent into pixels
- stylegan_model
- stylegan_latent
- IMAGE
StyleGAN workflows in ComfyUI are weirdly inverted compared to everything else you use. There's no prompt, no KSampler, no denoising loop. You load a model, you make a latent, and this node - StyleGAN Sampler - is where pixels finally happen. If you've googled this node, you're probably one step away from "wait, that's it?" and then 64 images a second, which is roughly the point of the whole pack.
What it actually does
The StyleGAN generator is two networks bolted together: a mapping network that turns random z noise into a w style code, and a synthesis network that draws the image from that w. The sampler is the synthesis half. Give it a loaded STYLEGAN model plus a STYLEGAN_LATENT, and it runs the synthesis network and hands you an IMAGE out the other side, already converted from the model's internal [-1, 1] range to the [0, 1] range every other ComfyUI node expects.
It's a batch-friendly node, too. If your latent holds 8 vectors, it renders all 8 and concatenates them into one image batch. Wire the IMAGE output straight into a Preview or Save node.
The inputs that matter
Four inputs, and only two of them are decisions:
stylegan_model- theSTYLEGANoutput from Load StyleGAN Model.stylegan_latent- from Generate StyleGAN Latent (or the inversion node, if you're reconstructing a real photo).noise_mode-constorrandom. This is the interesting one. Every StyleGAN layer has a small stochastic noise input that isn't part of the latent at all.constpins it to a fixed pattern, so the render is clean and reproducible.randomlets each layer's noise roll fresh, which shifts subtle texture and detail from run to run - the same latent, slightly different skin grain. For stills you wantconst. For generating animation frames where a little per-frame flicker is desirable,random.seed- seeds the RNG, which mostly matters whennoise_modeisrandom. Inconstmode the render is deterministic regardless.
Installation
Install the pack once and every node in it comes along. From ComfyUI Manager, search "ComfyUI-StyleGan", or:
cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-StyleGan
Then restart ComfyUI and drop a model into ComfyUI/models/stylegan/ (create the folder - it doesn't exist by default). That part is easy. The hard part is the custom CUDA extensions.
Where people get burned
StyleGAN ships CUDA kernels (bias_act_plugin, upfirdn2d_plugin, filtered_lrelu_plugin) that compile at runtime - the first time you run a workflow you'll see "Setting up PyTorch plugin..." in the console, and it takes 30–60 seconds. That build is where almost every failure lives. The README is blunt about it: you need the CUDA Toolkit, ninja, and a C++ toolchain (GCC on Linux, Visual Studio on Windows), plus the right CUDA_HOME / PATH / LD_LIBRARY_PATH set. ComfyUI portable users often have to copy the Include/ and libs/ folders from a full system Python 3.10 install into python_embeded.
A common symptom from real users: GLIBCXX_3.4.32 not found when bias_act_plugin fails to load. That's your conda/SwarmUI environment shipping a stale libstdc++.so.6 while the freshly built plugin needs a newer one - upgrade the system/conda libstdc++, or move the pack to a Python environment that isn't pinned to an old toolchain. Note the pack's requirements.txt is just numpy, pickle, ninja - no fake dependencies hiding in there. The pain is the compiler, not the pip line.
Once built, it's fast. The README clocks 64 images/sec on a 3090 with a large batch, though the preview encode throttles realtime use to around 8 fps. That's still silly fast next to a 30-step diffusion pass, and it's the whole reason to bother with GANs in 2026.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| stylegan_model | STYLEGAN | — | |
| stylegan_latent | STYLEGAN_LATENT | — | |
| noise_mode | COMBO | 2 options: const, random | |
| seed | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |