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
30eb92c3
Commit
30eb92c3
authored
Aug 24, 2023
by
comfyanonymous
Browse files
Code cleanups.
parent
51dde87e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
comfy/model_management.py
comfy/model_management.py
+6
-7
No files found.
comfy/model_management.py
View file @
30eb92c3
...
...
@@ -302,16 +302,15 @@ def unload_model_clones(model):
def
free_memory
(
memory_required
,
device
,
keep_loaded
=
[]):
unloaded_model
=
False
for
i
in
range
(
len
(
current_loaded_models
)
-
1
,
-
1
,
-
1
):
if
DISABLE_SMART_MEMORY
:
current_free_mem
=
0
else
:
current_free_mem
=
get_free_memory
(
device
)
if
current_free_mem
>
memory_required
:
break
if
not
DISABLE_SMART_MEMORY
:
if
get_free_memory
(
device
)
>
memory_required
:
break
shift_model
=
current_loaded_models
[
i
]
if
shift_model
.
device
==
device
:
if
shift_model
not
in
keep_loaded
:
current_loaded_models
.
pop
(
i
).
model_unload
()
m
=
current_loaded_models
.
pop
(
i
)
m
.
model_unload
()
del
m
unloaded_model
=
True
if
unloaded_model
:
...
...
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