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

Not sure about eval.py #14

Closed l1x closed 3 years ago

l1x commented 3 years ago

I am trying to use the code in this repo and the first part work:

 python train.py --path ../imgs/ --name fast --iter 500 --batch_size 2 --im_size 1024
Setting up Perceptual loss...
Loading model from: /data/FastGAN-pytorch/lpips/weights/v0.1/vgg.pth
...[net-lin [vgg]] initialized
...Done
Namespace(batch_size=2, ckpt='None', cuda=0, im_size=1024, iter=500, name='fast', path='../imgs/', start_iter=0)
  GAN: loss d: 2.85532    loss g: -1.84026
100%| .... | 501/501 [03:16<00:00,  2.55it/s]

This generates the following:

 ls train_results/fast/
args.txt  diffaug.py  eval.py  images  models  models.py  operation.py  __pycache__  train.py

I am having trouble when trying to use eval.py

$ python eval.py --n_sample 10
Traceback (most recent call last):
  File "eval.py", line 66, in <module>
    checkpoint = torch.load(ckpt, map_location=lambda a,b: a)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/serialization.py", line 525, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/serialization.py", line 212, in _open_file_like
    return _open_file(name_or_buffer, mode)
  File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/serialization.py", line 193, in __init__
    super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: './models/60000.pth'

Is there a particular reason it is looking for 60000.pth?

odegeasslbc commented 3 years ago

Sorry, I did not refine the eval.py, it was not ready to be used by others. I would suggest you look into the code in eval.py and modify it for your own purpose of use. Basically, you just need to specify the path of your trained model and use that path instead.

l1x commented 3 years ago

Sorry, I did not refine the eval.py, it was not ready to be used by others. I would suggest you look into the code in eval.py and modify it for your own purpose of use. Basically, you just need to specify the path of your trained model and use that path instead.

Thank you very much!