lucidrains / stylegan2-pytorch

Simplest working implementation of Stylegan2, state of the art generative adversarial network, in Pytorch. Enabling everyone to experience disentanglement
https://thispersondoesnotexist.com
MIT License
3.67k stars 591 forks source link

Is train loop memory-efficient? #253

Open GLivshits opened 2 years ago

GLivshits commented 2 years ago

Hi. I've found, that you unfreeze the whole GAN, and making steps only via specific optimizer (for generator and discriminator). But when you do loss.backward, gradients are computed for the WHOLE GAN, whereas for certain optimizer only their own gradients are needed. It causes additional memory uses and increased iteration time. Please correct me if I am wrong.

Cads182 commented 2 years ago

Totally not.