StyleGAN2 locally. Part I: ComfyUI
How to run a GAN on your machine.
StyleGAN2 locally. Part I: ComfyUI
How to run a GAN on your machine.
See also Part 2: Running Infinite Latent Space locally.
I trained an AI on my memory. I was blown away. But that’s another story. Probably. In 2021, I used my Instagram photo collection as a training dataset for StyleGAN2. Could AI reconstruct my visual memory?
I used the brilliant ML Labs platform (R.I.P.) by RunwayML. It’s “RIP”, because RunwayML decided to sunset it, leaving many many artists without their tool. Classical case of vendor lock-out.
I tried to find the original developers of the initial platform or to reconstruct the system, but I was unsuccessful. Until today.
Today, I asked Claude.
Part I. ComfyUI
ComfyUI is a great user interface for diffusion models, even if at the beginning it may look weird. There are too many nodes and lines. But don’t trust your first impression.
I’ve led workshops for schools and a general audience, who didn’t know anything about Generative AI — and after a while, they could navigate ComfyUI with ease.
[embed]Read more in my review 2025
ComfyUI is created for open source diffusion models, such as Stable Diffusion, FLUX etc.
Running on your local machine
- makes you independent of any corporation or provider,
- keeps your personal data on your computer,
- and is sustainable (you can even run it on your laptop as long as the battery lasts).
But can it also work with OldSkool GAN models? Yes, it can!
What do you need?
- Your GAN model in .pkl format, such as those you obtained by training in ML Lab.
- Custom Nodes

A short architecture structure for running in ComfyUI.
How to?
Follow the instructions in the Readme file in my GitHub repository.
Alternatively, you can follow these steps:
- Copy init.py and nodes.py into your folder ComfyUI/custom_nodes/stylegan2_explorer/. If this subfolder does not exist, you will need to create it.
- Then, clone the StyleGAN2 repository into the same custom_nodes folder:
cd ComfyUI/custom_nodes
git clone https://github.com/NVlabs/stylegan2-ada-pytorch.git
- You will need to install Ninja to ComfyUI Python:
ComfyUI\python_embeds\python.exe -m pip install ninja
-
Place your .pkl file into ComfyUI\input\
-
Start ComfyUI (it will take longer than usual to open the entire interface, but you won’t regret it once it’s open!).
Now look for custom nodes “StyleGAN2” (you will find 4 nodes, they are what we’re looking for):

Our StyleGAN nodes
What can we do with these nodes?
- with StyleGAN2 Model Loader you can select the trained GAN-model.
- with StyleGAN2 Sampler you can get an image from the GAN Latent Space, using a seed.
- StyleGAN2 Interpolate (batch) — for running batches of images or even for creating animation
- StyleGAN2 Latent Walk — for possible Latent Walk (still working on it)
Use case 1: Image generation
To get a single image, use this workflow. You will need an additional node called “Preview Image.”

Here you can see a latent image from my Dataset CCCCCOOMem.pkl with the seed 1551890028.

Note: “Control after generate” should be set auf “randomize” to get another random seed after this run. Otherwise you will have still the same seed over and over.
Use Case 2: Creating an interpolation between two latent images

To do this, you need the“batch” node. Seed_a (here: value 0) will the first image, ans seed_b (value 42) will be the second. Define the number of interpolation frames to get eight images.
If you re-run this workflow, you will get the same images, since the seeds are still the same. To randomize them, load two “Primitive” nodes, connect them to seed_a and seed_b, and set “control after generate” to “randomize”:

Each time a batch is generated, a new random value is transmitted to the seeds field.
Use case 3: GAN Interpolation video

In this case, replace “Preview Image” with a node from the MixLab collection, “ComfyUI-MixLab-Nodes: Video Combine.”
In StyleGAN2 Interpolate (batch), you can set the number of frames. The more frames, the longer the video and the longer it will take to generate.
In Video Combine, you can set the frame rate. In my experience, anything under 12–14 is too slow. The higher the framerate, the more fluid the video. Under “Format,” you can choose between GIF, MP4, and other video formats.
Et voilà!

And now you can combine all possible nodes of ComfyUI to an orchestrated GenAI dream.
Latent Walk?
Honestly, this is not really feasible on ComfyUI. But in the next part, I will show you how to replicate an entire latent browser from RunwayML ML Labs.
You can do it!
Stay tuned!

메타데이터
- post_id
- e83df2f4fb3f
- slug
- stylegan2-locally-part-i-comfyui-e83df2f4fb3f
- url
- https://medium.com/merzazine/stylegan2-locally-part-i-comfyui-e83df2f4fb3f
- canonical_url
- https://medium.com/merzazine/stylegan2-locally-part-i-comfyui-e83df2f4fb3f
- author_url
- https://medium.com/@merzmensch
- status
- ok
- fetched_at
- 2026-06-10 15:53:41