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
be71bb5e
Commit
be71bb5e
authored
Nov 27, 2023
by
comfyanonymous
Browse files
Tweak memory inference calculations a bit.
parent
96c2deee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
comfy/model_base.py
comfy/model_base.py
+3
-2
No files found.
comfy/model_base.py
View file @
be71bb5e
...
...
@@ -164,12 +164,13 @@ class BaseModel(torch.nn.Module):
self
.
inpaint_model
=
True
def
memory_required
(
self
,
input_shape
):
area
=
input_shape
[
0
]
*
input_shape
[
2
]
*
input_shape
[
3
]
if
comfy
.
model_management
.
xformers_enabled
()
or
comfy
.
model_management
.
pytorch_attention_flash_attention
():
#TODO: this needs to be tweaked
return
(
area
/
(
comfy
.
model_management
.
dtype_size
(
self
.
get_dtype
())
*
10
))
*
(
1024
*
1024
)
area
=
max
(
input_shape
[
0
],
3
)
*
input_shape
[
2
]
*
input_shape
[
3
]
return
(
area
*
comfy
.
model_management
.
dtype_size
(
self
.
get_dtype
())
/
60
)
*
(
1024
*
1024
)
else
:
#TODO: this formula might be too aggressive since I tweaked the sub-quad and split algorithms to use less memory.
area
=
input_shape
[
0
]
*
input_shape
[
2
]
*
input_shape
[
3
]
return
(((
area
*
0.6
)
/
0.9
)
+
1024
)
*
(
1024
*
1024
)
...
...
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