e4s icon indicating copy to clipboard operation
e4s copied to clipboard

Error: pretrained model

Open Hepecho opened this issue 1 year ago • 7 comments

Hi, when I tried swap face operation:

python scripts/face_swap.py --source=example/input/faceswap/source.jpg --target=example/input/faceswap/target.jpg

the following error is reported:

Traceback (most recent call last):
  File "scripts/face_swap.py", line 345, in <module>
    generator, kp_detector, he_estimator, estimate_jacobian = init_facevid2vid_pretrained_model(face_vid2vid_cfg, face_vid2vid_ckpt)
  File "/root/project/e4s-main/./src/pretrained/face_vid2vid/driven_demo.py", line 216, in init_facevid2vid_pretrained_model
    generator, kp_detector, he_estimator = load_checkpoints(config_path=cfg_path, checkpoint_path=ckpt_path, gen="spade", cpu=False)
  File "/root/project/e4s-main/./src/pretrained/face_vid2vid/driven_demo.py", line 49, in load_checkpoints
    checkpoint = torch.load(checkpoint_path)
  File "/root/miniconda3/envs/e4s/lib/python3.8/site-packages/torch/serialization.py", line 712, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "/root/miniconda3/envs/e4s/lib/python3.8/site-packages/torch/serialization.py", line 1049, in _load
    result = unpickler.load()
  File "/root/miniconda3/envs/e4s/lib/python3.8/site-packages/torch/serialization.py", line 1019, in persistent_load
    load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
  File "/root/miniconda3/envs/e4s/lib/python3.8/site-packages/torch/serialization.py", line 997, in load_tensor
    storage = zip_file.get_storage_from_record(name, numel, torch._UntypedStorage).storage()._untyped()
RuntimeError: PytorchStreamReader failed reading file data/94709563812016: invalid header or archive is corrupted

It seems to be related to the pre-trained model 00000189-checkpoint.pth.tar, but I downloaded it from the given link. Can someone with a similar problem help me out? Thanks.

Hepecho avatar May 20 '23 16:05 Hepecho

bro how did you install this? can you send me a message on telegram? https://t.me/keronikateka or @keronikateka

ketakachono avatar May 20 '23 21:05 ketakachono

What's the file size? ls pretrained_ckpts/facevid2vid/00000189-checkpoint.pth.tar -l tells me 2112619148. Please try to re-download the file.

e4s2022 avatar May 21 '23 05:05 e4s2022

What's the file size? ls pretrained_ckpts/facevid2vid/00000189-checkpoint.pth.tar -l tells me 2112619148. Please try to re-download the file.

ls pretrained_ckpts/facevid2vid/00000189-checkpoint.pth.tar -l

Here is the result:

-rwxr-xr-x 1 root root 2112619148 May 20 23:28 pretrained_ckpts/facevid2vid/00000189-checkpoint.pth.tar

I also tried to re-download the file and checked its MD5 before and after re-downloading and it was all 0dbdf37f02a3e7ed2115ddee8789b33a.

Hepecho avatar May 21 '23 06:05 Hepecho

bro how did you install this? can you send me a message on telegram? https://t.me/keronikateka or @keronikateka

Sorry, but I haven't managed to configure the environment yet either :(

Hepecho avatar May 21 '23 06:05 Hepecho

bro how did you install this? can you send me a message on telegram? https://t.me/keronikateka or @keronikateka

Sorry, but I haven't managed to configure the environment yet either :(

Hopefully he makes a dockerfile for it, I hope he doesnt ignore these messages cause seems like nobody has managed to make it work so far but him

ketakachono avatar May 21 '23 07:05 ketakachono

@Hepecho, I tested a new env in a clean machine just now and followed the installation guide step by step. It works well for me. I think re-download the file works would solve the problem.

e4s2022 avatar May 22 '23 07:05 e4s2022

hi, @Hepecho , the weight link of 00000189-checkpoint.pth.tar in the facevid2vid paper is gone,can you send me a copy one? thank you very much! my email is [email protected]

zsf882299 avatar Jul 31 '24 03:07 zsf882299