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
86721d51
Commit
86721d51
authored
Feb 27, 2023
by
comfyanonymous
Browse files
Enable highvram automatically when vram >> ram
parent
49d2e5bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
comfy/model_management.py
comfy/model_management.py
+10
-3
notebooks/comfyui_colab.ipynb
notebooks/comfyui_colab.ipynb
+1
-1
No files found.
comfy/model_management.py
View file @
86721d51
...
@@ -12,15 +12,22 @@ total_vram = 0
...
@@ -12,15 +12,22 @@ total_vram = 0
total_vram_available_mb
=
-
1
total_vram_available_mb
=
-
1
import
sys
import
sys
import
psutil
set_vram_to
=
NORMAL_VRAM
set_vram_to
=
NORMAL_VRAM
try
:
try
:
import
torch
import
torch
total_vram
=
torch
.
cuda
.
mem_get_info
(
torch
.
cuda
.
current_device
())[
1
]
/
(
1024
*
1024
)
total_vram
=
torch
.
cuda
.
mem_get_info
(
torch
.
cuda
.
current_device
())[
1
]
/
(
1024
*
1024
)
if
total_vram
<=
4096
and
not
"--normalvram"
in
sys
.
argv
:
total_ram
=
psutil
.
virtual_memory
().
total
/
(
1024
*
1024
)
print
(
"Trying to enable lowvram mode because your GPU seems to have 4GB or less. If you don't want this use: --normalvram"
)
forced_normal_vram
=
"--normalvram"
in
sys
.
argv
set_vram_to
=
LOW_VRAM
if
not
forced_normal_vram
:
if
total_vram
<=
4096
:
print
(
"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
=
LOW_VRAM
elif
total_vram
>
total_ram
*
1.2
and
total_vram
>
14336
:
print
(
"Enabling highvram mode because your GPU has more vram than your computer has ram. If you don't want this use: --normalvram"
)
vram_state
=
HIGH_VRAM
except
:
except
:
pass
pass
...
...
notebooks/comfyui_colab.ipynb
View file @
86721d51
...
@@ -170,7 +170,7 @@
...
@@ -170,7 +170,7 @@
"\n",
"\n",
"threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n",
"threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n",
"\n",
"\n",
"!python main.py
--highvram
--dont-print-server"
"!python main.py --dont-print-server"
],
],
"metadata": {
"metadata": {
"id": "hhhhhhhhhh"
"id": "hhhhhhhhhh"
...
...
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