caopulan / GANInverter

A GAN inversion toolbox based on PyTorch library. We design a unified pipeline for inversion methods and conduct a comprehensive benchmark.
MIT License
60 stars 3 forks source link

Cannot find pretrained_models/79999_iter.pt when running SAM #6

Open artificialnouveau opened 2 months ago

artificialnouveau commented 2 months ago

When running the following code:

!python scripts/infer.py \
    --embed_mode encoder \
    --refine_mode sam \
    --test_dataset_path test_images \
    --output_dir e4e_sam \
    --save_code true \
    --auto_resume True \
    --stylegan_weights pretrained_models/stylegan2-ffhq-config-f.pt

I get the following error:

Traceback (most recent call last):
  File "scripts/infer.py", line 138, in <module>
    main()
  File "scripts/infer.py", line 55, in main
    inversion = TwoStageInference(opts)
  File "/root/rfv-models/development/trait-rating/encoding_scripts/GANInverter/./inference/two_stage_inference.py", line 20, in __init__
    self.embedding_module = EncoderInference(opts)
  File "/root/rfv-models/development/trait-rating/encoding_scripts/GANInverter/./inference/encoder_infer.py", line 31, in __init__
    decoder_checkpoint = torch.load(opts.stylegan_weights, map_location='cpu')
  File "/opt/conda/lib/python3.8/site-packages/torch/serialization.py", line 699, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "/opt/conda/lib/python3.8/site-packages/torch/serialization.py", line 230, in _open_file_like
    return _open_file(name_or_buffer, mode)
  File "/opt/conda/lib/python3.8/site-packages/torch/serialization.py", line 211, in __init__
    super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'pretrained_models/79999_iter.pt'

I cannot find 79999_iter.pt only, only 79999_iter.pth. Where did you find the original model, or did you convert it? Should I be getting this error, or did I do something wrong?