Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
b1a7dfe0
"vscode:/vscode.git/clone" did not exist on "89136ff7f8037fe064b5525e28a54f70f6f770e6"
Commit
b1a7dfe0
authored
Apr 06, 2022
by
Sylvain Gugger
Browse files
Allow the same config in the auto mapping
parent
2aef4cfe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
src/transformers/models/auto/configuration_auto.py
src/transformers/models/auto/configuration_auto.py
+7
-1
No files found.
src/transformers/models/auto/configuration_auto.py
View file @
b1a7dfe0
...
...
@@ -389,8 +389,14 @@ class _LazyConfigMapping(OrderedDict):
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
)
def
keys
(
self
):
return
list
(
self
.
_mapping
.
keys
())
+
list
(
self
.
_extra_content
.
keys
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment