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
ec15da24
"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "865d4d595eefc8cc9cee58fec9179bd182be0e2e"
Unverified
Commit
ec15da24
authored
Feb 14, 2022
by
Toni Kukurin
Committed by
GitHub
Feb 14, 2022
Browse files
Report only the failed imports in `requires_backends` (#15636)
parent
2b8599b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
src/transformers/file_utils.py
src/transformers/file_utils.py
+4
-2
No files found.
src/transformers/file_utils.py
View file @
ec15da24
...
@@ -827,8 +827,10 @@ def requires_backends(obj, backends):
...
@@ -827,8 +827,10 @@ def requires_backends(obj, backends):
backends
=
[
backends
]
backends
=
[
backends
]
name
=
obj
.
__name__
if
hasattr
(
obj
,
"__name__"
)
else
obj
.
__class__
.
__name__
name
=
obj
.
__name__
if
hasattr
(
obj
,
"__name__"
)
else
obj
.
__class__
.
__name__
if
not
all
(
BACKENDS_MAPPING
[
backend
][
0
]()
for
backend
in
backends
):
checks
=
(
BACKENDS_MAPPING
[
backend
]
for
backend
in
backends
)
raise
ImportError
(
""
.
join
([
BACKENDS_MAPPING
[
backend
][
1
].
format
(
name
)
for
backend
in
backends
]))
failed
=
[
msg
.
format
(
name
)
for
available
,
msg
in
checks
if
not
available
()]
if
failed
:
raise
ImportError
(
""
.
join
(
failed
))
class
DummyObject
(
type
):
class
DummyObject
(
type
):
...
...
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