SYSTEM
OS: Pop!_os 19.10
Transformers: 3.0.2
I have the following code:
from transformers import GPT2LMHeadModel
model = GPT2LMHeadModel.from_pretrained('gpt2')
After running it, I get this error:
Traceback (most recent call last):
File "/path/to/anaconda3/lib/python3.7/site-packages/transformers/modeling_utils.py", line 658, in from_pretrained
raise EnvironmentError
OSError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/path/to/project/text_gen_w_transformers/finetune_gpt2.py", line 8, in <module>
model = GPT2LMHeadModel.from_pretrained('gpt2')
File "/path/to/anaconda3/lib/python3.7/site-packages/transformers/modeling_utils.py", line 665, in from_pretrained
raise EnvironmentError(msg)
OSError: Can't load weights for 'gpt2'. Make sure that:
- 'gpt2' is a correct model identifier listed on 'https://huggingface.co/models'
- or 'gpt2' is the correct path to a directory containing a file named one of pytorch_model.bin, tf_model.h5, model.ckpt.
I checked the website and, indeed, gpt2
is one of the models listed. Any thoughts? Thanks in advance!