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
92254659
Commit
92254659
authored
Aug 19, 2023
by
Simon Lui
Committed by
comfyanonymous
Aug 20, 2023
Browse files
Further tuning and fix mem_free_total.
parent
2c096e42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
comfy/model_management.py
comfy/model_management.py
+2
-3
No files found.
comfy/model_management.py
View file @
92254659
...
@@ -271,8 +271,7 @@ class LoadedModel:
...
@@ -271,8 +271,7 @@ class LoadedModel:
self
.
model_accelerated
=
True
self
.
model_accelerated
=
True
if
xpu_available
and
not
args
.
disable_ipex_optimize
:
if
xpu_available
and
not
args
.
disable_ipex_optimize
:
self
.
real_model
.
training
=
False
self
.
real_model
=
torch
.
xpu
.
optimize
(
self
.
real_model
.
eval
(),
inplace
=
True
,
auto_kernel_selection
=
True
,
graph_mode
=
True
)
self
.
real_model
=
torch
.
xpu
.
optimize
(
self
.
real_model
,
inplace
=
True
)
return
self
.
real_model
return
self
.
real_model
...
@@ -515,7 +514,7 @@ def get_free_memory(dev=None, torch_free_too=False):
...
@@ -515,7 +514,7 @@ def get_free_memory(dev=None, torch_free_too=False):
mem_allocated
=
stats
[
'allocated_bytes.all.current'
]
mem_allocated
=
stats
[
'allocated_bytes.all.current'
]
mem_reserved
=
stats
[
'reserved_bytes.all.current'
]
mem_reserved
=
stats
[
'reserved_bytes.all.current'
]
mem_free_torch
=
mem_reserved
-
mem_active
mem_free_torch
=
mem_reserved
-
mem_active
mem_free_total
=
torch
.
xpu
.
get_device_properties
(
dev
).
total_memory
-
mem_allocated
+
mem_free_torch
mem_free_total
=
torch
.
xpu
.
get_device_properties
(
dev
).
total_memory
-
mem_allocated
else
:
else
:
stats
=
torch
.
cuda
.
memory_stats
(
dev
)
stats
=
torch
.
cuda
.
memory_stats
(
dev
)
mem_active
=
stats
[
'active_bytes.all.current'
]
mem_active
=
stats
[
'active_bytes.all.current'
]
...
...
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