← all repositories
caogang/wgan-gp

WGAN-GP: when your GAN needs a gradient penalty and a time machine

A 2017 PyTorch port of the improved Wasserstein GAN paper, complete with toy datasets, MNIST, and charmingly garbled language generation.

wgan-gp
Velocity · 7d
+0.5
★ / day
Trend
steady
star history

What it does

This repo implements “Improved Training of Wasserstein GANs” in PyTorch, swapping the original TensorFlow code for PyTorch’s autograd. It covers toy 2D datasets, MNIST, CIFAR-10, and a character-level language model — all using the gradient-penalty trick to keep discriminator training stable without weight clipping.

The interesting bit

The language model is a curiosity: it uses 1D convolutions for both generator and discriminator on character data, producing output that reads like “The witl is f ont UAy Y nalence.” The author admits they “haven’t run enough epochs” because it’s “very time-comsuming” — a refreshing honesty rarely seen in READMEs.

Key highlights

  • Four working scripts: toy datasets, MNIST, CIFAR-10, and character-level language
  • CIFAR-10 support came via community PR, not the original author
  • Directly acknowledges parent implementations by Ishaan Gulrajani and Martin Arjovsky
  • Results folder contains actual sample images, not just loss curves
  • Requires “a latest master version of Pytorch” — very 2017 energy

Caveats

  • 64×64 architecture is unimplemented and marked “Looking forward to your pull request”
  • MNIST generator and discriminator both use nn.Conv1d, which is unconventional for image data
  • Language model results are extremely preliminary (8,699 epochs, still gibberish)

Verdict

Worth a look if you’re studying GAN history or need a minimal PyTorch reference for WGAN-GP. Skip it if you want production code or modern diffusion models — this is a 2017 paper implementation that stayed in 2017.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.