A GAN that lets you preview on a budget, then pay for the pixels
It makes interactive GAN editing feasible by rendering cheap, consistent previews that you can finalize into high-fidelity output later.

What it does
Anycost GAN is a conditional generator built on StyleGAN2 that can render images at different resolutions and channel widths without switching models. You can ask for a low-cost preview while dragging a slider, then hit “finalize” to synthesize the full-resolution output. The project ships with pre-trained generators, encoders, and editing directions for human faces and cars, plus notebooks and an interactive demo.
The interesting bit
The consistency is the trick. Instead of training separate small networks that diverge from the full model, the authors use multi-resolution sampling, adaptive-channel training, and a generator-conditioned discriminator so every sub-configuration stays visually aligned with the largest one.
Key highlights
- Supports 4 resolutions and 4 uniform channel ratios out of the box, plus a flexible-channel mode.
- Pre-trained models available for FFHQ, CelebA-HQ, and LSUN Car datasets.
- Includes evaluation code for FID, perceptual path length, and attribute consistency across sub-generators.
- Training scripts rely on Horovod for distributed multi-GPU runs.
Caveats
- The reference training was done on 24 GB Titan RTX cards; smaller GPUs require manual tuning of resolution, batch size, and model size.
- Datasets are not bundled due to copyright; you must download and format FFHQ, CelebA-HQ, or LSUN Car yourself.
- Training the base StyleGAN2 checkpoint from scratch is described as time-consuming, so the authors recommend using their converted weights instead.
Verdict
Grab this if you are building interactive image-editing tools and need perceptually stable GAN previews under tight latency budgets. Skip it if you just want a standard off-the-shelf StyleGAN2 inference script.
Frequently asked
- What is mit-han-lab/anycost-gan?
- It makes interactive GAN editing feasible by rendering cheap, consistent previews that you can finalize into high-fidelity output later.
- Is anycost-gan open source?
- Yes — mit-han-lab/anycost-gan is open source, released under the MIT license.
- What language is anycost-gan written in?
- mit-han-lab/anycost-gan is primarily written in Python.
- How popular is anycost-gan?
- mit-han-lab/anycost-gan has 779 stars on GitHub.
- Where can I find anycost-gan?
- mit-han-lab/anycost-gan is on GitHub at https://github.com/mit-han-lab/anycost-gan.