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
dc9d1f31
"vscode:/vscode.git/clone" did not exist on "ffe7b93b60e037b2b1ec056b88cba7c14fc3f9e3"
Commit
dc9d1f31
authored
Jul 03, 2023
by
comfyanonymous
Browse files
Improvements for OSX.
parent
103c487a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
comfy/model_management.py
comfy/model_management.py
+4
-4
No files found.
comfy/model_management.py
View file @
dc9d1f31
...
@@ -334,19 +334,19 @@ def unload_if_low_vram(model):
...
@@ -334,19 +334,19 @@ def unload_if_low_vram(model):
return
model
return
model
def
unet_offload_device
():
def
unet_offload_device
():
if
vram_state
==
VRAMState
.
HIGH_VRAM
or
vram_state
==
VRAMState
.
SHARED
:
if
vram_state
==
VRAMState
.
HIGH_VRAM
:
return
get_torch_device
()
return
get_torch_device
()
else
:
else
:
return
torch
.
device
(
"cpu"
)
return
torch
.
device
(
"cpu"
)
def
text_encoder_offload_device
():
def
text_encoder_offload_device
():
if
args
.
gpu_only
or
vram_state
==
VRAMState
.
SHARED
:
if
args
.
gpu_only
:
return
get_torch_device
()
return
get_torch_device
()
else
:
else
:
return
torch
.
device
(
"cpu"
)
return
torch
.
device
(
"cpu"
)
def
text_encoder_device
():
def
text_encoder_device
():
if
args
.
gpu_only
or
vram_state
==
VRAMState
.
SHARED
:
if
args
.
gpu_only
:
return
get_torch_device
()
return
get_torch_device
()
elif
vram_state
==
VRAMState
.
HIGH_VRAM
or
vram_state
==
VRAMState
.
NORMAL_VRAM
:
elif
vram_state
==
VRAMState
.
HIGH_VRAM
or
vram_state
==
VRAMState
.
NORMAL_VRAM
:
if
torch
.
get_num_threads
()
<
8
:
#leaving the text encoder on the CPU is faster than shifting it if the CPU is fast enough.
if
torch
.
get_num_threads
()
<
8
:
#leaving the text encoder on the CPU is faster than shifting it if the CPU is fast enough.
...
@@ -360,7 +360,7 @@ def vae_device():
...
@@ -360,7 +360,7 @@ def vae_device():
return
get_torch_device
()
return
get_torch_device
()
def
vae_offload_device
():
def
vae_offload_device
():
if
args
.
gpu_only
or
vram_state
==
VRAMState
.
SHARED
:
if
args
.
gpu_only
:
return
get_torch_device
()
return
get_torch_device
()
else
:
else
:
return
torch
.
device
(
"cpu"
)
return
torch
.
device
(
"cpu"
)
...
...
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