Wav2Vec2-XLSR-53

I tried to run notebook facebook/wav2vec2-large-xlsr-53 · Hugging Face
But when I run

model = Wav2Vec2ForCTC.from_pretrained(
    "facebook/wav2vec2-base-960h", 
    attention_dropout=0.1,
    hidden_dropout=0.1,
    feat_proj_dropout=0.0,
    mask_time_prob=0.05,
    layerdrop=0.1,
    gradient_checkpointing=True, 
    ctc_loss_reduction="mean", 
    pad_token_id=processor.tokenizer.pad_token_id,
    vocab_size=len(processor.tokenizer)
)

I get this error

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. (init at ../caffe2/serialize/inline_container.cc:132)
frame #0: c10::Error::Error(c10::SourceLocation, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 135 (0x14e2f6787 in libc10.dylib)
frame #1: caffe2::serialize::PyTorchStreamReader::init() + 2350 (0x13795414e in libtorch.dylib)
frame #2: caffe2::serialize::PyTorchStreamReader::PyTorchStreamReader(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 143 (0x13795379f in libtorch.dylib)
frame #3: void pybind11::cpp_function::initialize<void pybind11::detail::initimpl::constructor<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::execute<pybind11::class_<caffe2::serialize::PyTorchStreamReader>, 0>(pybind11::class_<caffe2::serialize::PyTorchStreamReader>&)::'lambda'(pybind11::detail::value_and_holder&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >), void, pybind11::detail::value_and_holder&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::detail::is_new_style_constructor>(pybind11::class_<caffe2::serialize::PyTorchStreamReader>&&,  (*)(0...), void pybind11::detail::initimpl::constructor<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::execute<pybind11::class_<caffe2::serialize::PyTorchStreamReader>, 0>(pybind11::class_<caffe2::serialize::PyTorchStreamReader>&)::'lambda'(pybind11::detail::value_and_holder&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) const&...)::'lambda'(pybind11::detail::function_call&)::operator()(pybind11::detail::function_call&) const + 147 (0x1346277c3 in libtorch_python.dylib)
frame #4: pybind11::cpp_function::dispatcher(_object*, _object*, _object*) + 3382 (0x13401fe66 in libtorch_python.dylib)
<omitting python frames>


During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
<ipython-input-108-5337759b7278> in <module>
      1 from transformers import Wav2Vec2ForCTC
      2 
----> 3 model = Wav2Vec2ForCTC.from_pretrained(
      4     #"facebook/wav2vec2-base-960h",
      5     "facebook/wav2vec2-large-xlsr-53",

/opt/anaconda3/lib/python3.8/site-packages/transformers/modeling_utils.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
   1062                 state_dict = torch.load(resolved_archive_file, map_location="cpu")
   1063             except Exception:
-> 1064                 raise OSError(
   1065                     f"Unable to load weights from pytorch checkpoint file for '{pretrained_model_name_or_path}' "
   1066                     f"at '{resolved_archive_file}'"

OSError: Unable to load weights from pytorch checkpoint file for 'facebook/wav2vec2-large-xlsr-53' at '/Users/elizavetatrusova/.cache/huggingface/transformers/5d2a20b45a1689a376ec4a6282b9d9be42f931cdf8daf07c3668ba1070a059d9.db2a69eb44bf7b1efcfff155d4cc22155230bd8c0941701b064e9c17429a623d'If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True. 

I run it in Jupyter, what can I do with it?

Perhaps it’s a permissions error?

Hmm, the code works for me and there shouldn’t be a permission error - could you try again?