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
10c15d2d
"docs/source/vscode:/vscode.git/clone" did not exist on "1c31b7aa3bb4e7ef24c77596d2a76f45a770159f"
Unverified
Commit
10c15d2d
authored
Apr 06, 2022
by
Sylvain Gugger
Committed by
GitHub
Apr 06, 2022
Browse files
Allow the same config in the auto mapping (#16631)
parent
8ac9b827
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 @
10c15d2d
...
@@ -389,8 +389,14 @@ class _LazyConfigMapping(OrderedDict):
...
@@ -389,8 +389,14 @@ class _LazyConfigMapping(OrderedDict):
module_name
=
model_type_to_module_name
(
key
)
module_name
=
model_type_to_module_name
(
key
)
if
module_name
not
in
self
.
_modules
:
if
module_name
not
in
self
.
_modules
:
self
.
_modules
[
module_name
]
=
importlib
.
import_module
(
f
".
{
module_name
}
"
,
"transformers.models"
)
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
)
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
):
def
keys
(
self
):
return
list
(
self
.
_mapping
.
keys
())
+
list
(
self
.
_extra_content
.
keys
())
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