Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
diffusers
Commits
c5933c9c
Unverified
Commit
c5933c9c
authored
Apr 25, 2023
by
Patrick von Platen
Committed by
GitHub
Apr 25, 2023
Browse files
[Bug fix] Fix batch size attention head size mismatch (#3214)
parent
91a2a80e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
src/diffusers/models/attention.py
src/diffusers/models/attention.py
+4
-2
No files found.
src/diffusers/models/attention.py
View file @
c5933c9c
...
@@ -86,8 +86,10 @@ class AttentionBlock(nn.Module):
...
@@ -86,8 +86,10 @@ class AttentionBlock(nn.Module):
head_size
=
self
.
num_heads
head_size
=
self
.
num_heads
if
unmerge_head_and_batch
:
if
unmerge_head_and_batch
:
batch_size
,
seq_len
,
dim
=
tensor
.
shape
batch_head_size
,
seq_len
,
dim
=
tensor
.
shape
tensor
=
tensor
.
reshape
(
batch_size
//
head_size
,
head_size
,
seq_len
,
dim
)
batch_size
=
batch_head_size
//
head_size
tensor
=
tensor
.
reshape
(
batch_size
,
head_size
,
seq_len
,
dim
)
else
:
else
:
batch_size
,
_
,
seq_len
,
dim
=
tensor
.
shape
batch_size
,
_
,
seq_len
,
dim
=
tensor
.
shape
...
...
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