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
50db297c
Commit
50db297c
authored
Jan 29, 2023
by
comfyanonymous
Browse files
Try to fix OOM issues with cards that have less vram than mine.
parent
36ec5690
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
comfy/ldm/modules/attention.py
comfy/ldm/modules/attention.py
+8
-1
No files found.
comfy/ldm/modules/attention.py
View file @
50db297c
...
...
@@ -194,7 +194,14 @@ class CrossAttentionBirchSan(nn.Module):
kv_chunk_size_min
=
None
query_chunk_size_x
=
1024
*
4
#not sure at all about the math here
#TODO: tweak this
if
mem_free_total
>
8192
*
1024
*
1024
*
1.3
:
query_chunk_size_x
=
1024
*
4
elif
mem_free_total
>
4096
*
1024
*
1024
*
1.3
:
query_chunk_size_x
=
1024
*
2
else
:
query_chunk_size_x
=
1024
kv_chunk_size_min_x
=
None
kv_chunk_size_x
=
(
int
((
chunk_threshold_bytes
//
(
batch_x_heads
*
bytes_per_token
*
query_chunk_size_x
))
*
2.0
)
//
1024
)
*
1024
if
kv_chunk_size_x
<
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