KwaiVGI / LivePortrait

Bring portraits to life!
https://liveportrait.github.io
Other
11.46k stars 1.17k forks source link

Failure in loading motion_extractor model #56

Closed yossibiton closed 2 months ago

yossibiton commented 2 months ago

I followed the setup stages in the README (pip installations and downloading models from the Drive folder), and then tried to run inference.py but got this error message :

[07:53:17] Load appearance_feature_extractor done.
live_portrait_wrapper.py:29
Traceback (most recent call last):
  File "/efs/user_folders/yossib/Dev/LivePortrait/inference.py", line 33, in <module>
    main()
  File "/efs/user_folders/yossib/Dev/LivePortrait/inference.py", line 23, in main
    live_portrait_pipeline = LivePortraitPipeline(
  File "/efs/user_folders/yossib/Dev/LivePortrait/src/live_portrait_pipeline.py", line 38, in __init__
    self.live_portrait_wrapper: LivePortraitWrapper = LivePortraitWrapper(cfg=inference_cfg)
  File "/efs/user_folders/yossib/Dev/LivePortrait/src/live_portrait_wrapper.py", line 31, in __init__
    self.motion_extractor = load_model(cfg.checkpoint_M, model_config, cfg.device_id, 'motion_extractor')
  File "/efs/user_folders/yossib/Dev/LivePortrait/src/utils/helper.py", line 132, in load_model
    model.load_state_dict(torch.load(ckpt_path, map_location=lambda storage, loc: storage))
  File "/opt/conda/envs/LivePortrait/lib/python3.9/site-packages/torch/serialization.py", line 1004, in load
    with _open_zipfile_reader(opened_file) as opened_zipfile:
  File "/opt/conda/envs/LivePortrait/lib/python3.9/site-packages/torch/serialization.py", line 456, in __init__
    super().__init__(torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

This is how my models folder looks like :

(LivePortrait) ~/Dev/LivePortrait$ find pretrained_weights/
pretrained_weights/
pretrained_weights/insightface
pretrained_weights/insightface/models
pretrained_weights/insightface/models/buffalo_l
pretrained_weights/insightface/models/buffalo_l/det_10g.onnx
pretrained_weights/insightface/models/buffalo_l/2d106det.onnx
pretrained_weights/liveportrait
pretrained_weights/liveportrait/base_models
pretrained_weights/liveportrait/base_models/appearance_feature_extractor.pth
pretrained_weights/liveportrait/base_models/spade_generator.pth
pretrained_weights/liveportrait/base_models/motion_extractor.pth
pretrained_weights/liveportrait/base_models/warping_module.pth
pretrained_weights/liveportrait/landmark.onnx
pretrained_weights/liveportrait/retargeting_models
pretrained_weights/liveportrait/retargeting_models/stitching_retargeting_module.pth
pretrained_weights/.gitkeep
zzzweakman commented 2 months ago

It may be caused by file corruption. Is the size of your motion_extractor.pth 108 MB? @yossibiton

yossibiton commented 2 months ago

Sorry, it's my mistake. The file was corrupted.