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
19300655
Commit
19300655
authored
May 17, 2024
by
comfyanonymous
Browse files
Don't automatically switch to lowvram mode on GPUs with low memory.
parent
46daf0a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
7 deletions
+1
-7
comfy/model_management.py
comfy/model_management.py
+1
-7
No files found.
comfy/model_management.py
View file @
19300655
...
@@ -119,10 +119,6 @@ def get_total_memory(dev=None, torch_total_too=False):
...
@@ -119,10 +119,6 @@ def get_total_memory(dev=None, torch_total_too=False):
total_vram
=
get_total_memory
(
get_torch_device
())
/
(
1024
*
1024
)
total_vram
=
get_total_memory
(
get_torch_device
())
/
(
1024
*
1024
)
total_ram
=
psutil
.
virtual_memory
().
total
/
(
1024
*
1024
)
total_ram
=
psutil
.
virtual_memory
().
total
/
(
1024
*
1024
)
logging
.
info
(
"Total VRAM {:0.0f} MB, total RAM {:0.0f} MB"
.
format
(
total_vram
,
total_ram
))
logging
.
info
(
"Total VRAM {:0.0f} MB, total RAM {:0.0f} MB"
.
format
(
total_vram
,
total_ram
))
if
not
args
.
normalvram
and
not
args
.
cpu
:
if
lowvram_available
and
total_vram
<=
4096
:
logging
.
warning
(
"Trying to enable lowvram mode because your GPU seems to have 4GB or less. If you don't want this use: --normalvram"
)
set_vram_to
=
VRAMState
.
LOW_VRAM
try
:
try
:
OOM_EXCEPTION
=
torch
.
cuda
.
OutOfMemoryError
OOM_EXCEPTION
=
torch
.
cuda
.
OutOfMemoryError
...
@@ -451,9 +447,7 @@ def load_models_gpu(models, memory_required=0, force_patch_weights=False):
...
@@ -451,9 +447,7 @@ def load_models_gpu(models, memory_required=0, force_patch_weights=False):
model_size
=
loaded_model
.
model_memory_required
(
torch_dev
)
model_size
=
loaded_model
.
model_memory_required
(
torch_dev
)
current_free_mem
=
get_free_memory
(
torch_dev
)
current_free_mem
=
get_free_memory
(
torch_dev
)
lowvram_model_memory
=
int
(
max
(
64
*
(
1024
*
1024
),
(
current_free_mem
-
1024
*
(
1024
*
1024
))
/
1.3
))
lowvram_model_memory
=
int
(
max
(
64
*
(
1024
*
1024
),
(
current_free_mem
-
1024
*
(
1024
*
1024
))
/
1.3
))
if
model_size
>
(
current_free_mem
-
inference_memory
):
#only switch to lowvram if really necessary
if
model_size
<=
(
current_free_mem
-
inference_memory
):
#only switch to lowvram if really necessary
vram_set_state
=
VRAMState
.
LOW_VRAM
else
:
lowvram_model_memory
=
0
lowvram_model_memory
=
0
if
vram_set_state
==
VRAMState
.
NO_VRAM
:
if
vram_set_state
==
VRAMState
.
NO_VRAM
:
...
...
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