style-based-gan-pytorch icon indicating copy to clipboard operation
style-based-gan-pytorch copied to clipboard

Bug in function accumulate

Open ParthaEth opened this issue 4 years ago • 5 comments

The accumulate function found in train.py - https://github.com/rosinality/style-based-gan-pytorch/blob/master/train.py#L25. Only accumulates running average of optimiser trainable parameters fo the generator model. If the generator has parameters that are not trained by optimiser such as the ones found in batch_norm layers, then this function will not accumulate those parameters. Stylegan model specifically does not have those kind of parameters so for this particular project this function is valid but should not be copied over to another project.

ParthaEth avatar Jan 06 '21 12:01 ParthaEth

Is there a reason you made same issue for this repositories and this (https://github.com/rosinality/stylegan2-pytorch/issues/172)?

rosinality avatar Jan 06 '21 12:01 rosinality

Just so people who use this repo gets a warning. Also, these are two unrelated repos

ParthaEth avatar Jan 08 '21 06:01 ParthaEth

@rosinality Why do you use EMA to update the model rather than directly optimize the model?

shoutOutYangJie avatar Apr 04 '21 02:04 shoutOutYangJie

@shoutOutYangJie The exponential moving average is used to increase stability and sample quality in GANs. Check Section C.1 of Large Scale GAN Training for High Fidelity Natural Image Synthesis

benearnthof avatar Sep 12 '21 15:09 benearnthof

@ParthaEth The original Implementation uses the function setup_as_moving_average_of defined here They explicitly set the beta for nontrainable variables to 0, thus the implementation provided by @rosinality matches the official implementation exactly in this regard.

benearnthof avatar Sep 12 '21 16:09 benearnthof