TFMarianModel from_pretrained can't load weights
See original GitHub issueEnvironment info
transformers
version: 4.3.2- Platform: Windows-7-6.1.7601-SP1
- Python version: 3.6.6
- PyTorch version (GPU?): 1.5.1+cpu (False)
- Tensorflow version (GPU?): 2.3.0 (False)
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No
Who can help
Information
Model I am using (Bert, XLNet …): TFMarianMT
The problem arises when using:
- [+] the official example scripts: (give details below)
To reproduce
from transformers import MarianTokenizer, TFMarianModel
model = TFMarianModel.from_pretrained('Helsinki-NLP/opus-mt-en-de')
Steps to reproduce the behavior:
- Run the above code
- Get an error:
Exception has occurred: OSError (note: full exception trace is shown but execution is paused at: _run_module_as_main) Can’t load weights for ‘Helsinki-NLP/opus-mt-en-de’. Make sure that:
‘Helsinki-NLP/opus-mt-en-de’ is a correct model identifier listed on ‘https://huggingface.co/models’
or ‘Helsinki-NLP/opus-mt-en-de’ is the correct path to a directory containing a file named one of tf_model.h5, pytorch_model.bin.
File “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\site-packages\transformers\modeling_tf_utils.py”, line 1219, in from_pretrained raise EnvironmentError(msg) File “C:\Users\FA.PROJECTOR-MSK\Google Диск\Colab Notebooks\PoetryTransformer\Unsupervised\translation\paraphrases_translation.py”, line 14, in <module> model = TFMarianModel.from_pretrained(‘Helsinki-NLP/opus-mt-en-de’) File “C:\Users\FA.PROJECTOR-MSK\Google Диск\Colab Notebooks\PoetryTransformer\Unsupervised\translation\run_locally.py”, line 1, in <module> from paraphrases_translation import run File “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\runpy.py”, line 85, in _run_code exec(code, run_globals) File “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\runpy.py”, line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\runpy.py”, line 263, in run_path pkg_name=pkg_name, script_name=fname) File “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\runpy.py”, line 85, in _run_code exec(code, run_globals) File “C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\runpy.py”, line 193, in _run_module_as_main (Current frame) “main”, mod_spec)
Expected behavior
No error
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
There are quite a lot of other models to upload, so this will take some time. I’ll start writing a script to automate this process…
Until then you can make use of this easy fix:
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.