# Failed to get mT5 model

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffailed-to-get-mt5-model%2F5551%3E%5C
**Category:** Models\
**Created:** [April 16, 2021, 11:19am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffailed-to-get-mt5-model%2F5551 "2021-04-16T11:19:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![notooth](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@notooth](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnotooth)%5C
**Post date:** [April 16, 2021, 11:19am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffailed-to-get-mt5-model%2F5551%2F1 "2021-04-16T11:19:15Z")

</div>

I got this error when getting mT5 model. Can anyone help?

```
(base) notooth@Debian:~$ python
Python 3.8.8 (default, Apr 13 2021, 19:58:26) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from transformers import MT5Model, T5Tokenizer
>>> model = MT5Model.from_pretrained("google/mt5-small")
Traceback (most recent call last):
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers-4.4.2-py3.8.egg/transformers/modeling_utils.py", line 1062, in from_pretrained
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/torch/serialization.py", line 527, in load
    with _open_zipfile_reader(f) as opened_zipfile:
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/torch/serialization.py", line 224, in __init__
    super(_open_zipfile_reader, self). __init__ (torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: version_ <= kMaxSupportedFileFormatVersion INTERNAL ASSERT FAILED at /tmp/pip-req-build-66hwoyb6/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 /tmp/pip-req-build-66hwoyb6/caffe2/serialize/inline_container.cc:132)
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 0x6d (0x7f82bc66e2ad in /home/notooth/anaconda3/lib/python3.8/site-packages/torch/lib/libc10.so)
frame #1: caffe2::serialize::PyTorchStreamReader::init() + 0x25db (0x7f82b8a9f2bb in /home/notooth/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #2: caffe2::serialize::PyTorchStreamReader::PyTorchStreamReader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 0x7b (0x7f82b8aa07cb in /home/notooth/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #3: <unknown function> + 0x65d00e (0x7f82bbe1600e in /home/notooth/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch_python.so)
frame #4: <unknown function> + 0x1375f9 (0x7f82bb8f05f9 in /home/notooth/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch_python.so)
<omitting python frames>
frame #32: __libc_start_main + 0xea (0x7f82ccc1dd0a in /lib/x86_64-linux-gnu/libc.so.6)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/notooth/anaconda3/lib/python3.8/site-packages/transformers-4.4.2-py3.8.egg/transformers/modeling_utils.py", line 1064, in from_pretrained
OSError: Unable to load weights from pytorch checkpoint file for 'google/mt5-small' at '/home/notooth/.cache/huggingface/transformers/8e7b2a80ddcb5611b27d8c89e1e8e33a947e105415051402a22b9c8d7d1caeb0.e22331f3a065b885b30ae3dd1ff11ccaf7fbc444485f6eb07ef5e0138bca8b70'If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
```

---

<div class="post-metadata">

**Author:** ![nmd2000](https://avatars.discourse-cdn.com/v4/letter/n/8baadc/32.png) [@nmd2000](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnmd2000)%5C
**Post date:** [October 26, 2021, 12:16pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffailed-to-get-mt5-model%2F5551%2F2 "2021-10-26T12:16:56Z")

</div>

I have the same problem

---

<div class="post-metadata">

**Author:** ![bwilde3](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@bwilde3](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbwilde3)%5C
**Post date:** [March 8, 2022, 3:09am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffailed-to-get-mt5-model%2F5551%2F3 "2022-03-08T03:09:46Z")

</div>

Coming at this late, but I just wanted to point out that this error message includes two suggestions:

_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._

and

_If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from\_tf=True._

The second doesn’t seem applicable, but I’d be curious to know if just updating PyTorch fixes the issue.

---

<div class="post-metadata">

**Author:** ![aarohig2](https://avatars.discourse-cdn.com/v4/letter/a/b5ac83/32.png) [@aarohig2](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Faarohig2)%5C
**Post date:** [June 8, 2023, 4:40am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffailed-to-get-mt5-model%2F5551%2F4 "2023-06-08T04:40:17Z")

</div>

I updated my torch but unfortunately that does not fix the issue.
