I want to use a model pre-trained by a friend. However, when I load it:
checkpoint_path = "../Models/ckpt_camembert.ckpt"
py_dict = torch.load(checkpoint_path)
model.load_state_dict(py_dict)
I get:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-19-be1591e802b7> in <module>
1 # If you already finetuned a model you can load it by the following rows
2 checkpoint_path = "../Models/ckpt_camembert.ckpt"
----> 3 py_dict = torch.load(checkpoint_path)
4 model.load_state_dict(py_dict)
c:\Programs\Anaconda\lib\site-packages\torch\serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
703 # reset back to the original position.
704 orig_position = opened_file.tell()
--> 705 with _open_zipfile_reader(opened_file) as opened_zipfile:
706 if _is_torchscript_zip(opened_zipfile):
707 warnings.warn("'torch.load' received a zip file that looks like a TorchScript archive"
c:\Programs\Anaconda\lib\site-packages\torch\serialization.py in __init__(self, name_or_buffer)
240 class _open_zipfile_reader(_opener):
241 def __init__(self, name_or_buffer) -> None:
--> 242 super(_open_zipfile_reader, self).__init__(torch._C.PyTorchFileReader(name_or_buffer))
243
244
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory
Is it because my .ckpt file hasn't been properly downloaded/corrupted?