Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError during get_model #21

Open
kelvinAI opened this issue Aug 31, 2020 · 1 comment
Open

RuntimeError during get_model #21

kelvinAI opened this issue Aug 31, 2020 · 1 comment

Comments

@kelvinAI
Copy link

I'm facing a runtime error when loading the model, with the following parameters:

model = get_model("resnet50_2020-07-20", max_size=2048)
model.eval()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-42-993dc68920c7> in <module>
----> 1 model = get_model("resnet50_2020-07-20", max_size=2048)
      2 model.eval()

/workspace/.local/lib/python3.6/site-packages/retinaface/pre_trained_models.py in get_model(model_name, max_size, device)
     18 def get_model(model_name: str, max_size: int, device: str = "cpu") -> nn.Module:
     19     model = models[model_name].model(max_size=max_size, device=device)
---> 20     state_dict = model_zoo.load_url(models[model_name].url, progress=True, map_location="cpu")
     21 
     22     model.load_state_dict(state_dict)

/opt/conda/lib/python3.6/site-packages/torch/hub.py in load_state_dict_from_url(url, model_dir, map_location, progress, check_hash)
    507             cached_file = os.path.join(model_dir, extraced_name)
    508 
--> 509     return torch.load(cached_file, map_location=map_location)

/opt/conda/lib/python3.6/site-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
    583     with _open_file_like(f, 'rb') as opened_file:
    584         if _is_zipfile(opened_file):
--> 585             with _open_zipfile_reader(f) as opened_zipfile:
    586                 if _is_torchscript_zip(opened_zipfile):
    587                     warnings.warn("'torch.load' received a zip file that looks like a TorchScript archive"

/opt/conda/lib/python3.6/site-packages/torch/serialization.py in __init__(self, name_or_buffer)
    243 class _open_zipfile_reader(_opener):
    244     def __init__(self, name_or_buffer):
--> 245         super(_open_zipfile_reader, self).__init__(torch._C.PyTorchFileReader(name_or_buffer))
    246 
    247 

RuntimeError: version_ <= kMaxSupportedFileFormatVersion INTERNAL ASSERT FAILED at ../caffe2/serialize/inline_container.cc:132, please report a bug to PyTorch. Attempted to read a PyTorch file with version 3, but the maximum supported version for reading is 2. Your PyTorch installation may be too old.

I've tried upgrading torch and torchvision with !pip install --upgrade torch torchvision , as recommended by pytorch/vision#1943 but it wasn't resolved.

Current installed versions:

torch - 1.5.0a0+8f84ded
torchvision - 0.6.0a0 

Any recommendations?

@NeighborhoodCoding
Copy link

NeighborhoodCoding commented Sep 11, 2020

How about try PyTorch 1.4 and torchvision 0.5.0? seems to work in similar problem but I'm not perfectly sure yet, and maybe there is more good version to safe.
!pip install torch=1.4 (torch vision also) and restart your colab or J.notebook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants