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
ComfyUI
Commits
aeaeca10
Commit
aeaeca10
authored
Feb 15, 2024
by
comfyanonymous
Browse files
Small refactor of is_device_* functions.
parent
7f89cb48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
comfy/model_management.py
comfy/model_management.py
+9
-6
No files found.
comfy/model_management.py
View file @
aeaeca10
...
@@ -684,17 +684,20 @@ def mps_mode():
...
@@ -684,17 +684,20 @@ def mps_mode():
global
cpu_state
global
cpu_state
return
cpu_state
==
CPUState
.
MPS
return
cpu_state
==
CPUState
.
MPS
def
is_device_
cpu
(
device
):
def
is_device_
type
(
device
,
type
):
if
hasattr
(
device
,
'type'
):
if
hasattr
(
device
,
'type'
):
if
(
device
.
type
==
'cpu'
):
if
(
device
.
type
==
type
):
return
True
return
True
return
False
return
False
def
is_device_cpu
(
device
):
return
is_device_type
(
device
,
'cpu'
)
def
is_device_mps
(
device
):
def
is_device_mps
(
device
):
if
hasattr
(
device
,
'
type
'
)
:
return
is_device_type
(
device
,
'
mps
'
)
if
(
device
.
type
==
'mps'
):
return
True
def
is_device_cuda
(
device
):
return
False
return
is_device_type
(
device
,
'cuda'
)
def
should_use_fp16
(
device
=
None
,
model_params
=
0
,
prioritize_performance
=
True
,
manual_cast
=
False
):
def
should_use_fp16
(
device
=
None
,
model_params
=
0
,
prioritize_performance
=
True
,
manual_cast
=
False
):
global
directml_enabled
global
directml_enabled
...
...
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