AliaksandrSiarohin / first-order-model

This repository contains the source code for the paper First Order Motion Model for Image Animation
https://aliaksandrsiarohin.github.io/first-order-model-website/
MIT License
14.48k stars 3.21k forks source link

IO error when loading torch checkpoint in colab #355

Open Akodiat opened 3 years ago

Akodiat commented 3 years ago

I am no longer able to run the Colab demo as it gives an error on torch.load. The drive should be mounted correctly.

This is the error:

OSError Traceback (most recent call last)

in () 1 from demo import load_checkpoints 2 generator, kp_detector = load_checkpoints(config_path='config/vox-256.yaml', ----> 3 checkpoint_path='/content/gdrive/My Drive/first-order-motion-model/vox-cpk.pth.tar') 2 frames /content/first-order-model/demo.py in load_checkpoints(config_path, checkpoint_path, cpu) 40 checkpoint = torch.load(checkpoint_path, map_location=torch.device('cpu')) 41 else: ---> 42 checkpoint = torch.load(checkpoint_path) 43 44 generator.load_state_dict(checkpoint['generator']) /usr/local/lib/python3.6/dist-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args) 580 581 with _open_file_like(f, 'rb') as opened_file: --> 582 if _is_zipfile(opened_file): 583 # The zipfile reader is going to advance the current file position. 584 # If we want to actually tail call to torch.jit.load, we need to /usr/local/lib/python3.6/dist-packages/torch/serialization.py in _is_zipfile(f) 55 start = f.tell() 56 ---> 57 byte = f.read(1) 58 while byte != "": 59 read_bytes.append(byte) OSError: [Errno 5] Input/output error

Is it possible the notebook uses a newer torch version than the checkpoint was created in? Or am I doing something wrong?

AliaksandrSiarohin commented 3 years ago

Check if you can see the checkpoint in the files section. Also check that your copy of checkpoint has the same size as original one.