Key error when loading the model using AutoTokenizer.from_pretrained

#2
by arjan-hada - opened

model_ckpt = "OATML-Markslab/Tranception_Large"
tokenizer_tranc = AutoTokenizer.from_pretrained(model_ckpt)

I get:

KeyError Traceback (most recent call last)
Cell In[36], line 2
1 model_ckpt_tranc = "OATML-Markslab/Tranception_Large"
----> 2 tokenizer_tranc = AutoTokenizer.from_pretrained(model_ckpt_tranc)

File ~/micromamba/envs/data-science/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py:701, in AutoTokenizer.from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs)
699 if config_tokenizer_class is None:
700 if not isinstance(config, PretrainedConfig):
--> 701 config = AutoConfig.from_pretrained(
702 pretrained_model_name_or_path, trust_remote_code=trust_remote_code, **kwargs
703 )
704 config_tokenizer_class = config.tokenizer_class
705 if hasattr(config, "auto_map") and "AutoTokenizer" in config.auto_map:

File ~/micromamba/envs/data-science/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py:1039, in AutoConfig.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
1037 return config_class.from_pretrained(pretrained_model_name_or_path, **kwargs)
1038 elif "model_type" in config_dict:
-> 1039 config_class = CONFIG_MAPPING[config_dict["model_type"]]
1040 return config_class.from_dict(config_dict, **unused_kwargs)
1041 else:
1042 # Fallback: use pattern matching on the string.
1043 # We go from longer names to shorter names to catch roberta before bert (for instance)

File ~/micromamba/envs/data-science/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py:734, in _LazyConfigMapping.getitem(self, key)
732 return self._extra_content[key]
733 if key not in self._mapping:
--> 734 raise KeyError(key)
735 value = self._mapping[key]
736 module_name = model_type_to_module_name(key)

KeyError: 'tranception'

Sign up or log in to comment