Using distributed or parallel set-up in script?: no
Who can help
Information
Model I am using (Bert, XLNet ...): GPT-NeoX
The problem arises when using:
[ ] the official example scripts: (give details below)
[x] my own modified scripts: (give details below)
The tasks I am working on is:
[ ] an official GLUE/SQUaD task: (give the name)
[x] my own task or dataset: (give details below)
To reproduce
from transformers import AutoConfig
config = AutoConfig.from_pretrained(PRIVATE_GPT_NEOX_MODEL_PATH)
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-6-7344d2d8cc3c> in <module>
1 from transformers import AutoConfig
----> 2 config = AutoConfig.from_pretrained(GPT_NEOX_1B_MODEL)
/opt/anaconda3/lib/python3.8/site-packages/transformers/models/auto/configuration_auto.py in from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
527 config_dict, _ = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
528 if "model_type" in config_dict:
--> 529 config_class = CONFIG_MAPPING[config_dict["model_type"]]
530 return config_class.from_dict(config_dict, **kwargs)
531 else:
/opt/anaconda3/lib/python3.8/site-packages/transformers/models/auto/configuration_auto.py in __getitem__(self, key)
276 def __getitem__(self, key):
277 if key not in self._mapping:
--> 278 raise KeyError(key)
279 value = self._mapping[key]
280 module_name = model_type_to_module_name(key)
KeyError: 'gpt-neox'
Expected behavior
The reason why I need to load gpt-neox from Auto is because my code will be capable to load multiple kinds of models. To achieve it, I use AutoConfig.from_pretrained(model_path) to identify model_type before loading the model.
My expectation would be supporting gpt-neox in AutoConfig or providing other nicer ways.
Thank you in advance!
@patil-suraj I found the problem in my code. Because I defined the gpt-neox model by my own custom class, of course, transformers couldn't recognize it! My apologies! I will close this issue.
@patil-suraj
Environment info
transformers
version: v4.11.3Who can help
Information
Model I am using (Bert, XLNet ...): GPT-NeoX
The problem arises when using:
The tasks I am working on is:
To reproduce
Expected behavior
The reason why I need to load gpt-neox from Auto is because my code will be capable to load multiple kinds of models. To achieve it, I use
AutoConfig.from_pretrained(model_path)
to identifymodel_type
before loading the model. My expectation would be supportinggpt-neox
inAutoConfig
or providing other nicer ways. Thank you in advance!