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
OpenDAS
diffusers
Commits
6f6eef74
Unverified
Commit
6f6eef74
authored
Oct 21, 2022
by
Krishna Penukonda
Committed by
GitHub
Oct 20, 2022
Browse files
Fix Compatibility with Nvidia NGC Containers (#919)
Check if MPS backend is registered before calling is_available()
parent
8be48507
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
src/diffusers/utils/testing_utils.py
src/diffusers/utils/testing_utils.py
+3
-1
No files found.
src/diffusers/utils/testing_utils.py
View file @
6f6eef74
...
@@ -29,7 +29,9 @@ if is_torch_available():
...
@@ -29,7 +29,9 @@ if is_torch_available():
)
)
if
is_torch_higher_equal_than_1_12
:
if
is_torch_higher_equal_than_1_12
:
torch_device
=
"mps"
if
torch
.
backends
.
mps
.
is_available
()
else
torch_device
# Some builds of torch 1.12 don't have the mps backend registered. See #892 for more details
mps_backend_registered
=
hasattr
(
torch
.
backends
,
"mps"
)
torch_device
=
"mps"
if
(
mps_backend_registered
and
torch
.
backends
.
mps
.
is_available
())
else
torch_device
def
get_tests_dir
(
append_path
=
None
):
def
get_tests_dir
(
append_path
=
None
):
...
...
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