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
9906e3ef
Commit
9906e3ef
authored
Oct 21, 2023
by
comfyanonymous
Browse files
Make xformers work with hypertile.
parent
1443caf3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
comfy/ldm/modules/attention.py
comfy/ldm/modules/attention.py
+7
-5
No files found.
comfy/ldm/modules/attention.py
View file @
9906e3ef
...
...
@@ -253,12 +253,14 @@ def attention_split(q, k, v, heads, mask=None):
return
r2
def
attention_xformers
(
q
,
k
,
v
,
heads
,
mask
=
None
):
b
,
_
,
_
=
q
.
shape
b
,
_
,
dim_head
=
q
.
shape
dim_head
//=
heads
q
,
k
,
v
=
map
(
lambda
t
:
t
.
unsqueeze
(
3
)
.
reshape
(
b
,
t
.
shape
[
1
]
,
heads
,
-
1
)
.
reshape
(
b
,
-
1
,
heads
,
dim_head
)
.
permute
(
0
,
2
,
1
,
3
)
.
reshape
(
b
*
heads
,
t
.
shape
[
1
],
-
1
)
.
reshape
(
b
*
heads
,
-
1
,
dim_head
)
.
contiguous
(),
(
q
,
k
,
v
),
)
...
...
@@ -270,9 +272,9 @@ def attention_xformers(q, k, v, heads, mask=None):
raise
NotImplementedError
out
=
(
out
.
unsqueeze
(
0
)
.
reshape
(
b
,
heads
,
out
.
shape
[
1
],
-
1
)
.
reshape
(
b
,
heads
,
-
1
,
dim_head
)
.
permute
(
0
,
2
,
1
,
3
)
.
reshape
(
b
,
out
.
shape
[
1
],
-
1
)
.
reshape
(
b
,
-
1
,
heads
*
dim_head
)
)
return
out
...
...
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