Loading model raises KeyError

#4
by xiajinxiong - opened

When I run the following code to load the OPT model, it always raises a KeyError:
`
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("facebook/opt-66b", torch_dtype=torch.float16)
`

Error:

KeyError Traceback (most recent call last)

in
2 from transformers import AutoModelForCausalLM, AutoTokenizer, AutoModel
3
----> 4 model = AutoModelForCausalLM.from_pretrained("facebook/opt-66b", torch_dtype=torch.float16)
5 # model = AutoModelForCausalLM.from_pretrained("facebook/opt-350m", torch_dtype=torch.float16)
6 #

~/workspace/anaconda3/lib/python3.8/site-packages/transformers/models/auto/auto_factory.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
421 kwargs["_from_auto"] = True
422 if not isinstance(config, PretrainedConfig):
--> 423 config, kwargs = AutoConfig.from_pretrained(
424 pretrained_model_name_or_path, return_unused_kwargs=True, trust_remote_code=trust_remote_code, **kwargs
425 )

~/workspace/anaconda3/lib/python3.8/site-packages/transformers/models/auto/configuration_auto.py in from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
670
671 Examples:
--> 672
673 ```python
674 >>> from transformers import AutoConfig

~/workspace/anaconda3/lib/python3.8/site-packages/transformers/models/auto/configuration_auto.py in getitem(self, key)
385 ("xlsr_wav2vec2", "XLSR-Wav2Vec2"),
386 ("yolos", "YOLOS"),
--> 387 ("yoso", "YOSO"),
388 ]
389 )

KeyError: 'opt'

xiajinxiong changed discussion status to closed

Sign up or log in to comment