Skip to content

Commit

Permalink
Revert "Allow the same config in the auto mapping"
Browse files Browse the repository at this point in the history
This reverts commit b1a7dfe.
  • Loading branch information
sgugger committed Apr 6, 2022
1 parent b1a7dfe commit b9bf91a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/transformers/models/auto/configuration_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,7 @@ def __getitem__(self, key):
module_name = model_type_to_module_name(key)
if module_name not in self._modules:
self._modules[module_name] = importlib.import_module(f".{module_name}", "transformers.models")
if hasattr(self._modules[module_name], value):
return getattr(self._modules[module_name], value)

# Some of the mappings have entries model_type -> config of another model type. In that case we try to grab the
# object at the top level.
transformers_module = importlib.import_module("transformers")
return getattr(transformers_module, value)
return getattr(self._modules[module_name], value)

def keys(self):
return list(self._mapping.keys()) + list(self._extra_content.keys())
Expand Down

0 comments on commit b9bf91a

Please sign in to comment.