dorarad / gansformer

Generative Adversarial Transformers
MIT License
1.33k stars 149 forks source link

PyTorch implementation generates same image samples #34

Closed kwhuang88228 closed 2 years ago

kwhuang88228 commented 2 years ago

Hi, I'm getting the same output image samples (see below) when I train the PyTorch implementation on FFHQ from scratch. The only changes I made (due to some memory issues mentioned in #33) were adding --batch-gpu 1 and removing saving attention map functionality (commenting out pytorch_version/training/visualize.py lines 167-206).

python run_network.py --train --gpus 0 --batch-gpu 1 --ganformer-default --expname ffhq-scratch --dataset ffhq 000120 000240

dorarad commented 2 years ago

Hi, Thank you for sharing that! Based on the info that seems to be a bug, I've started now several experiments that seek to identify the source of the problem and hope to get back to you in couple days with more info!

dorarad commented 2 years ago
kwhuang88228 commented 2 years ago

Thank you for looking into this! I have Num images: 20004. And this is my reals.png. reals

dorarad commented 2 years ago

Thanks! I had a small bug in the PyTorch initialization of the mapping network's weight parameters (see e98744879e1a01da7200a9d2cd38c1f457200600), that should both resolve the same-images issue, and more importantly, I expect it to speed up the model's learning substantially.

Please consider retraining a new model from scratch (so that the weights get initialized correctly) to achieve the improved learning. I will run too further experiments now to verify it indeed gets resolved and get back to you!

python run_network.py --train --gpus 0 --batch-gpu 1 --ganformer-default --expname ffhq-scratch-new --dataset ffhq
dorarad commented 2 years ago

Alright I tested the model and things look good!

kwhuang88228 commented 2 years ago

Can also confirm PyTorch model is no longer generating the same images. Thank you!