Model fails to run
The demo in the web page failse with error:
The model_type 'longt5' is not recognized. It could be a bleeding edge model, or incorrect
And the code:
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
model = AutoModelForSeq2SeqLM.from_pretrained("google/long-t5-local-base")
Fails with the error:
```
RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.7/site-packages/transformers/modeling_utils.py in load_state_dict(checkpoint_file)
460 try:
--> 461 return torch.load(checkpoint_file, map_location="cpu")
462 except Exception as e:
/usr/local/lib/python3.7/site-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
526 if _is_zipfile(opened_file):
--> 527 with _open_zipfile_reader(f) as opened_zipfile:
528 return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
/usr/local/lib/python3.7/site-packages/torch/serialization.py in init(self, name_or_buffer)
223 def init(self, name_or_buffer):
--> 224 super(_open_zipfile_reader, self).init(torch._C.PyTorchFileReader(name_or_buffer))
225
RuntimeError: version_ <= kMaxSupportedFileFormatVersion INTERNAL ASSERT FAILED at /opt/conda/conda-bld/pytorch_1579022060824/work/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 /opt/conda/conda-bld/pytorch_1579022060824/work/caffe2/serialize/inline_container.cc:132)
frame #0: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x47 (0x7f293a4ad627 in /usr/local/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #1: caffe2::serialize::PyTorchStreamReader::init() + 0x1f5b (0x7f2943fdb9ab in /usr/local/lib/python3.7/site-packages/torch/lib/libtorch.so)
frame #2: caffe2::serialize::PyTorchStreamReader::PyTorchStreamReader(std::string const&) + 0x64 (0x7f2943fdcbc4 in /usr/local/lib/python3.7/site-packages/torch/lib/libtorch.so)
frame #3: + 0x6d2146 (0x7f2971b9c146 in /usr/local/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #4: + 0x28ba06 (0x7f2971755a06 in /usr/local/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #5: _PyMethodDef_RawFastCallDict + 0x264 (0x564316c5c3f4 in /usr/local/bin/python)
frame #6: _PyObject_FastCallDict + 0x6e (0x564316c2d2ee in /usr/local/bin/python)
frame #7: + 0x12f141 (0x564316c42141 in /usr/local/bin/python)
frame #8: PyObject_Call + 0xb4 (0x564316c2db94 in /usr/local/bin/python)
frame #9: + 0xbdf94 (0x564316bd0f94 in /usr/local/bin/python)
frame #10: _PyObject_FastCallKeywords + 0x3ec (0x564316c923fc in /usr/local/bin/python)
frame #11: + 0x17fbd1 (0x564316c92bd1 in /usr/local/bin/python)
frame #12: _PyEval_EvalFrameDefault + 0x4762 (0x564316cda702 in /usr/local/bin/python)
frame #13: _PyEval_EvalCodeWithName + 0x7cd (0x564316c2c3fd in /usr/local/bin/python)
frame #14: _PyObject_FastCallDict + 0x312 (0x564316c2d592 in /usr/local/bin/python)
frame #15: + 0x1860ff (0x564316c990ff in /usr/local/bin/python)
frame #16: _PyObject_FastCallKeywords + 0x3ec (0x564316c923fc in /usr/local/bin/python)
frame #17: _PyEval_EvalFrameDefault + 0x4715 (0x564316cda6b5 in /usr/local/bin/python)
frame #18: _PyEval_EvalCodeWithName + 0x255 (0x564316c2be85 in /usr/local/bin/python)
frame #19: _PyFunction_FastCallKeywords + 0x583 (0x564316c4bcd3 in /usr/local/bin/python)
frame #20: + 0x17f9c5 (0x564316c929c5 in /usr/local/bin/python)
frame #21: _PyEval_EvalFrameDefault + 0x1401 (0x564316cd73a1 in /usr/local/bin/python)
frame #22: _PyFunction_FastCallKeywords + 0x187 (0x564316c4b8d7 in /usr/local/bin/python)
frame #23: _PyEval_EvalFrameDefault + 0x3f5 (0x564316cd6395 in /usr/local/bin/python)
frame #24: _PyEval_EvalCodeWithName + 0x255 (0x564316c2be85 in /usr/local/bin/python)
frame #25: _PyObject_FastCallDict + 0x5be (0x564316c2d83e in /usr/local/bin/python)
frame #26: + 0x12f141 (0x564316c42141 in /usr/local/bin/python)
frame #27: PyObject_Call + 0xb4 (0x564316c2db94 in /usr/local/bin/python)
frame #28: _PyEval_EvalFrameDefault + 0x1cb8 (0x564316cd7c58 in /usr/local/bin/python)
frame #29: _PyEval_EvalCodeWithName + 0x255 (0x564316c2be85 in /usr/local/bin/python)
frame #30: _PyFunction_FastCallKeywords + 0x583 (0x564316c4bcd3 in /usr/local/bin/python)
frame #31: + 0x17f9c5 (0x564316c929c5 in /usr/local/bin/python)
frame #32: _PyEval_EvalFrameDefault + 0x4762 (0x564316cda702 in /usr/local/bin/python)
frame #33: _PyEval_EvalCodeWithName + 0x255 (0x564316c2be85 in /usr/local/bin/python)
frame #34: + 0x1d7d8e (0x564316cead8e in /usr/local/bin/python)
frame #35: _PyMethodDef_RawFastCallKeywords + 0xe9 (0x564316c5c639 in /usr/local/bin/python)
frame #36: _PyEval_EvalFrameDefault + 0x4428 (0x564316cda3c8 in /usr/local/bin/python)
frame #37: + 0x17e9b4 (0x564316c919b4 in /usr/local/bin/python)
frame #38: _PyEval_EvalFrameDefault + 0x1998 (0x564316cd7938 in /usr/local/bin/python)
frame #39: + 0x17e9b4 (0x564316c919b4 in /usr/local/bin/python)
frame #40: _PyEval_EvalFrameDefault + 0x1998 (0x564316cd7938 in /usr/local/bin/python)
frame #41: + 0x17e9b4 (0x564316c919b4 in /usr/local/bin/python)
frame #42: _PyMethodDescr_FastCallKeywords + 0xdb (0x564316c91d4b in /usr/local/bin/python)
frame #43: + 0x17faae (0x564316c92aae in /usr/local/bin/python)
frame #44: _PyEval_EvalFrameDefault + 0x661 (0x564316cd6601 in /usr/local/bin/python)
frame #45: _PyFunction_FastCallKeywords + 0x187 (0x564316c4b8d7 in /usr/local/bin/python)
frame #46: _PyEval_EvalFrameDefault + 0x3f5 (0x564316cd6395 in /usr/local/bin/python)
frame #47: _PyFunction_FastCallKeywords + 0x187 (0x564316c4b8d7 in /usr/local/bin/python)
frame #48: + 0x17f9c5 (0x564316c929c5 in /usr/local/bin/python)
frame #49: _PyEval_EvalFrameDefault + 0x661 (0x564316cd6601 in /usr/local/bin/python)
frame #50: _PyEval_EvalCodeWithName + 0x255 (0x564316c2be85 in /usr/local/bin/python)
frame #51: _PyFunction_FastCallKeywords + 0x583 (0x564316c4bcd3 in /usr/local/bin/python)
frame #52: + 0x17f9c5 (0x564316c929c5 in /usr/local/bin/python)
frame #53: _PyEval_EvalFrameDefault + 0x1401 (0x564316cd73a1 in /usr/local/bin/python)
frame #54: _PyEval_EvalCodeWithName + 0x255 (0x564316c2be85 in /usr/local/bin/python)
frame #55: _PyFunction_FastCallKeywords + 0x521 (0x564316c4bc71 in /usr/local/bin/python)
frame #56: + 0x17f9c5 (0x564316c929c5 in /usr/local/bin/python)
frame #57: _PyEval_EvalFrameDefault + 0x661 (0x564316cd6601 in /usr/local/bin/python)
frame #58: _PyEval_EvalCodeWithName + 0x255 (0x564316c2be85 in /usr/local/bin/python)
frame #59: _PyFunction_FastCallKeywords + 0x521 (0x564316c4bc71 in /usr/local/bin/python)
frame #60: + 0x17f9c5 (0x564316c929c5 in /usr/local/bin/python)
frame #61: _PyEval_EvalFrameDefault + 0x661 (0x564316cd6601 in /usr/local/bin/python)
frame #62: _PyFunction_FastCallKeywords + 0x187 (0x564316c4b8d7 in /usr/local/bin/python)
frame #63: + 0x17f9c5 (0x564316c929c5 in /usr/local/bin/python)
During handling of the above exception, another exception occurred:
UnicodeDecodeError Traceback (most recent call last)
/usr/local/lib/python3.7/site-packages/transformers/modeling_utils.py in load_state_dict(checkpoint_file)
464 with open(checkpoint_file) as f:
--> 465 if f.read().startswith("version"):
466 raise OSError(
/usr/local/lib/python3.7/codecs.py in decode(self, input, final)
321 data = self.buffer + input
--> 322 (result, consumed) = self._buffer_decode(data, self.errors, final)
323 # keep undecoded input until the next call
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 64: invalid start byte
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
in
3 tokenizer = AutoTokenizer.from_pretrained("google/long-t5-local-base")
4
----> 5 model = AutoModelForSeq2SeqLM.from_pretrained("google/long-t5-local-base")
/usr/local/lib/python3.7/site-packages/transformers/models/auto/auto_factory.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
444 elif type(config) in cls._model_mapping.keys():
445 model_class = _get_model_class(config, cls._model_mapping)
--> 446 return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
447 raise ValueError(
448 f"Unrecognized configuration class {config.class} for this kind of AutoModel: {cls.name}.\n"
/usr/local/lib/python3.7/site-packages/transformers/modeling_utils.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
2130 if not is_sharded and state_dict is None:
2131 # Time to load the checkpoint
-> 2132 state_dict = load_state_dict(resolved_archive_file)
2133
2134 # set dtype to instantiate the model under:
/usr/local/lib/python3.7/site-packages/transformers/modeling_utils.py in load_state_dict(checkpoint_file)
476 except (UnicodeDecodeError, ValueError):
477 raise OSError(
--> 478 f"Unable to load weights from pytorch checkpoint file for '{checkpoint_file}' "
479 f"at '{checkpoint_file}'. "
480 "If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True."
OSError: Unable to load weights from pytorch checkpoint file for '/root/.cache/huggingface/transformers/05fe519c85783b0e52c8ed98fc1c86e8d4dddfa5ea8ec367eff8808f92aac202.c643626750356473eb791cf6f8fe83d84c54c6db3f0d055cd2b76701669c841b' at '/root/.cache/huggingface/transformers/05fe519c85783b0e52c8ed98fc1c86e8d4dddfa5ea8ec367eff8808f92aac202.c643626750356473eb791cf6f8fe83d84c54c6db3f0d055cd2b76701669c841b'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
```
pip install torch