BigGAN escapes TensorFlow, lands in PyTorch with luggage intact
A painstaking op-for-op port of DeepMind's image generator that brings pretrained weights along for the ride.

What it does This repo is a PyTorch reimplementation of DeepMind’s BigGAN, the class-conditional image generator famous for producing photorealistic 128×128 to 512×512 images. It ships with the original pretrained weights, converted from TensorFlow Hub, plus helper utilities for noise sampling, class selection, and even terminal image display via libsixel.
The interesting bit The author reverse-engineered the raw TensorFlow computation graph operation-by-operation and claims output variance within 1e-5 of the original. That’s less a port and more a forensic reconstruction. The included conversion scripts also mean you can audit (or re-audit) how the weights made the jump across frameworks.
Key highlights
- Pretrained “deep” models at 128, 256, and 512 pixels (≈50–56M params, ~200–225MB each)
- 51 sets of pre-computed batch norm statistics for different truncation values
one_hot_from_names()uses NLTK WordNet to resolve plain-English class names to ImageNet indicesdisplay_in_terminal()renders generated images directly in libsixel-compatible terminalsfrom_pretrained()downloads weights automatically from S3 and caches them locally
Caveats
- Only the generator is implemented; the discriminator lacks pretrained weights (DeepMind never released them) and is omitted entirely
- The README’s model size descriptions contain obvious copy-paste errors (e.g., “12-layer, 768-hidden, 12-heads” for BigGAN) that suggest BERT documentation leaked in
- Tested on Python 3.6 and PyTorch 1.0.1 — decidedly not recent
Verdict Worth grabbing if you need BigGAN in a PyTorch pipeline and don’t want to wrestle with TensorFlow Hub. Skip it if you need the discriminator, modern PyTorch compatibility, or training from scratch.