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
24553206
"tests/models/vitmatte/__init__.py" did not exist on "dd4df80f0b77c8f8e07e502298df0121cada9ce8"
Unverified
Commit
24553206
authored
Sep 20, 2023
by
fxmarty
Committed by
GitHub
Sep 20, 2023
Browse files
fix deepspeed available detection (#26252)
parent
f29fe745
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
src/transformers/integrations/deepspeed.py
src/transformers/integrations/deepspeed.py
+11
-1
No files found.
src/transformers/integrations/deepspeed.py
View file @
24553206
...
...
@@ -15,6 +15,7 @@
Integration with Deepspeed
"""
import
importlib.metadata
as
importlib_metadata
import
importlib.util
import
weakref
from
functools
import
partialmethod
...
...
@@ -32,7 +33,16 @@ logger = logging.get_logger(__name__)
def
is_deepspeed_available
():
return
importlib
.
util
.
find_spec
(
"deepspeed"
)
is
not
None
package_exists
=
importlib
.
util
.
find_spec
(
"deepspeed"
)
is
not
None
# Check we're not importing a "deepspeed" directory somewhere but the actual library by trying to grab the version
# AND checking it has an author field in the metadata that is HuggingFace.
if
package_exists
:
try
:
_
=
importlib_metadata
.
metadata
(
"deepspeed"
)
return
True
except
importlib_metadata
.
PackageNotFoundError
:
return
False
if
is_accelerate_available
()
and
is_deepspeed_available
():
...
...
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