odegeasslbc / FastGAN-pytorch

Official implementation of the paper "Towards Faster and Stabilized GAN Training for High-fidelity Few-shot Image Synthesis" in ICLR 2021
GNU General Public License v3.0
600 stars 100 forks source link

Fix error in eval.py #35

Closed suigenk closed 2 years ago

suigenk commented 2 years ago

Hi, thank you very much for releasing the code : )

Background

When I run eval.py, I've got the following error.

RuntimeError: Error(s) in loading state_dict for Generator:
    Missing key(s) in state_dict: "init.init.0.weight_orig", "init.init.0.weight",...
    Unexpected key(s) in state_dict: "module.init.init.0.weight_orig", "module.init.init.0.weight_u", ...

Root cause

Basically, it is simple key error mentioned as follows. https://stackoverflow.com/questions/69478457/fastgan-runtimeerror-errors-in-loading-state-dict-for-generator

Solution

Remove prefix module before load_state_dict().

If you like it, please feel free to merge it : )