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

SurajSubramanian: <p>I tried to install the <code>retinaface-pytorch</code> module and execute the sample code provided there. But I run into the following error :</p>
<pre><code class="lang-auto">&gt;&gt;&gt; model = get_model("resnet50_2020-07-20", max_size=2048)
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/Users/suraj/anaconda3/lib/python3.7/site-packages/retinaface/pre_trained_models.py", line 20, in get_model
    state_dict = model_zoo.load_url(models[model_name].url, progress=True, map_location="cpu")
  File "/Users/suraj/anaconda3/lib/python3.7/site-packages/torch/hub.py", line 506, in load_state_dict_from_url
    return torch.load(cached_file, map_location=map_location)
  File "/Users/suraj/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 527, in load
    with _open_zipfile_reader(f) as opened_zipfile:
  File "/Users/suraj/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 224, in __init__
    super(_open_zipfile_reader, self).__init__(torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: version_ &lt;= 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. (init at ../caffe2/serialize/inline_container.cc:132)
frame #0: c10::Error::Error(c10::SourceLocation, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;) + 135 (0x1273a3787 in libc10.dylib)
frame #1: caffe2::serialize::PyTorchStreamReader::init() + 2350 (0x11b78214e in libtorch.dylib)
frame #2: caffe2::serialize::PyTorchStreamReader::PyTorchStreamReader(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;) + 143 (0x11b78179f in libtorch.dylib)
frame #3: void pybind11::cpp_function::initialize&lt;void pybind11::detail::initimpl::constructor&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt;::execute&lt;pybind11::class_&lt;caffe2::serialize::PyTorchStreamReader&gt;, 0&gt;(pybind11::class_&lt;caffe2::serialize::PyTorchStreamReader&gt;&amp;)::'lambda'(pybind11::detail::value_and_holder&amp;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;), void, pybind11::detail::value_and_holder&amp;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::detail::is_new_style_constructor&gt;(pybind11::class_&lt;caffe2::serialize::PyTorchStreamReader&gt;&amp;&amp;, void (*)(pybind11::detail::value_and_holder&amp;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;), pybind11::name const&amp;, pybind11::is_method const&amp;, pybind11::sibling const&amp;, pybind11::detail::is_new_style_constructor const&amp;)::'lambda'(pybind11::detail::function_call&amp;)::operator()(pybind11::detail::function_call&amp;) const + 147 (0x11968fc13 in libtorch_python.dylib)
frame #4: pybind11::cpp_function::dispatcher(_object*, _object*, _object*) + 3372 (0x1190899fc in libtorch_python.dylib)
&lt;omitting python frames&gt;
frame #39: start + 1 (0x7fff707287fd in libdyld.dylib)
frame #40: 0x0 + 1 (0x1 in ???)
</code></pre>
<p>I do not understand this message. Any suggestions as to what I could do now, would be really appreciated.</p>

albanD: <p>Hi,</p>
<p>From the error message it seems to indicate that your current version of pytorch is too old to load this file. Which was saved with a newer version of pytorch I guess?</p>

tigerccx: <p>I am having the same issue here. I both saved and loaded the model using PyTorch 1.4.0 cu100. Has anyone solved the issue?</p>