LonglongaaaGo / EXE-GAN

Facial image inpainting is a task of filling visually realistic and semantically meaningful contents for missing or masked pixels in a face image. This paper presents EXE-GAN, a novel diverse and interactive facial inpainting framework, which can not only preserve the high-quality visual effect of the whole image but also complete the face image with exemplar-like facial attributes.
MIT License
54 stars 3 forks source link

Error loading PSP checkpoint: #7

Open jiangzl2016 opened 1 week ago

jiangzl2016 commented 1 week ago

Hi, I ran into this issue when loading psp checkpoint to perform image guided recovery:

⚡ main ~/EXE-GAN python3 guided_recovery.py --psp_checkpoint_path ./pre-train/psp_ffhq_encode.pt --ckpt ./checkpoint/EXE_GAN_model.pt --masked_dir ./imgs/exe_guided_recovery/mask --gt_dir ./imgs/exe_guided_recovery/target --exemplar_dir ./imgs/exe_guided_recovery/exemplar --sample_times 10 --eval_dir .imgs/exe_guided_recovery/recover_out_gpu_run from .fused_act import FusedLeakyReLU, fused_leaky_relu from .upfirdn2d import upfirdn2d model name: exe_gan !!!!!!!!!!!!!!! start_latent :4 n_psp_latent :10 Loading ResNet ArcFace Traceback (most recent call last): File "/teamspace/studios/this_studio/EXE-GAN/guided_recovery.py", line 199, in <module> generator = get_model(args.arch, model_path=args.ckpt, psp_path=args.psp_checkpoint_path) File "/teamspace/studios/this_studio/EXE-GAN/test.py", line 299, in get_model generator = EXE_GAN(exe_ckpt_path=model_path, psp_ckpt_path=psp_path) File "/teamspace/studios/this_studio/EXE-GAN/test.py", line 46, in __init__ self.psp_embedding = Psp_Embedding(psp_ckpt_path, psp_start_latent, num_psp_latent).to(device) File "/teamspace/studios/this_studio/EXE-GAN/Loss/psp_embedding.py", line 38, in __init__ self.psp_encoder = self.get_psp_encoder(psp_encoder_path=psp_encoder_path).eval().cuda() File "/teamspace/studios/this_studio/EXE-GAN/Loss/psp_embedding.py", line 111, in get_psp_encoder ckpt = torch.load(psp_encoder_path, map_location='cpu') File "/home/zeus/miniconda3/envs/cloudspace/lib/python3.10/site-packages/torch/serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "/home/zeus/miniconda3/envs/cloudspace/lib/python3.10/site-packages/torch/serialization.py", line 1051, in _legac y_load typed_storage._untyped_storage._set_from_file( RuntimeError: unexpected EOF, expected 820379 more bytes. The file might be corrupted.

I used Python 3.10 and followed most of the dependencies. My PyTorch versions are: torch==2.0.0 torchaudio==2.0.1 torchvision==0.15.1 and my virtual environment is conda.

Do you know what I might have done wrong? Can't figure out after a bit of search. Thank you!

LonglongaaaGo commented 1 week ago

Hi @jiangzl2016 , Thanks for your attention. The problem is coming from the checkpoint file. It sounds like you have not fully downloaded the whole file. What I mean is that the ckpt file is corrupted because of some reason. Can you download the ckpt of pSp again to see if it can work? By the way, check your disk space. Thanks!