Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
diffusers
Commits
0866e85e
Unverified
Commit
0866e85e
authored
Feb 18, 2023
by
daquexian
Committed by
GitHub
Feb 17, 2023
Browse files
apply_forward_hook simply returns if no accelerate (#2387)
Signed-off-by:
daquexian
<
daquexian566@gmail.com
>
parent
d2e2c611
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
src/diffusers/utils/accelerate_utils.py
src/diffusers/utils/accelerate_utils.py
+2
-0
No files found.
src/diffusers/utils/accelerate_utils.py
View file @
0866e85e
...
@@ -34,6 +34,8 @@ def apply_forward_hook(method):
...
@@ -34,6 +34,8 @@ def apply_forward_hook(method):
:param method: The method to decorate. This method should be a method of a PyTorch module.
:param method: The method to decorate. This method should be a method of a PyTorch module.
"""
"""
if
not
is_accelerate_available
():
return
method
accelerate_version
=
version
.
parse
(
accelerate
.
__version__
).
base_version
accelerate_version
=
version
.
parse
(
accelerate
.
__version__
).
base_version
if
version
.
parse
(
accelerate_version
)
<
version
.
parse
(
"0.17.0"
):
if
version
.
parse
(
accelerate_version
)
<
version
.
parse
(
"0.17.0"
):
return
method
return
method
...
...
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