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
04777561
Commit
04777561
authored
Feb 08, 2023
by
comfyanonymous
Browse files
Lower the chances of an OOM.
parent
853e96ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
comfy/ldm/modules/sub_quadratic_attention.py
comfy/ldm/modules/sub_quadratic_attention.py
+2
-1
No files found.
comfy/ldm/modules/sub_quadratic_attention.py
View file @
04777561
...
@@ -76,7 +76,8 @@ def _summarize_chunk(
...
@@ -76,7 +76,8 @@ def _summarize_chunk(
)
)
max_score
,
_
=
torch
.
max
(
attn_weights
,
-
1
,
keepdim
=
True
)
max_score
,
_
=
torch
.
max
(
attn_weights
,
-
1
,
keepdim
=
True
)
max_score
=
max_score
.
detach
()
max_score
=
max_score
.
detach
()
exp_weights
=
torch
.
exp
(
attn_weights
-
max_score
)
torch
.
exp
(
attn_weights
-
max_score
,
out
=
attn_weights
)
exp_weights
=
attn_weights
exp_values
=
torch
.
bmm
(
exp_weights
,
value
)
exp_values
=
torch
.
bmm
(
exp_weights
,
value
)
max_score
=
max_score
.
squeeze
(
-
1
)
max_score
=
max_score
.
squeeze
(
-
1
)
return
AttnChunk
(
exp_values
,
exp_weights
.
sum
(
dim
=-
1
),
max_score
)
return
AttnChunk
(
exp_values
,
exp_weights
.
sum
(
dim
=-
1
),
max_score
)
...
...
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