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
renzhc
diffusers_dcu
Commits
930c8fdc
Unverified
Commit
930c8fdc
authored
Jul 20, 2023
by
Allen Zhang
Committed by
GitHub
Jul 20, 2023
Browse files
fix incorrect attention head dimension in AttnProcessor2_0 (#4154)
fix inner_dim
parent
6b1abba1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/diffusers/models/attention_processor.py
src/diffusers/models/attention_processor.py
+1
-1
No files found.
src/diffusers/models/attention_processor.py
View file @
930c8fdc
...
...
@@ -1096,7 +1096,6 @@ class AttnProcessor2_0:
batch_size
,
sequence_length
,
_
=
(
hidden_states
.
shape
if
encoder_hidden_states
is
None
else
encoder_hidden_states
.
shape
)
inner_dim
=
hidden_states
.
shape
[
-
1
]
if
attention_mask
is
not
None
:
attention_mask
=
attn
.
prepare_attention_mask
(
attention_mask
,
sequence_length
,
batch_size
)
...
...
@@ -1117,6 +1116,7 @@ class AttnProcessor2_0:
key
=
attn
.
to_k
(
encoder_hidden_states
)
value
=
attn
.
to_v
(
encoder_hidden_states
)
inner_dim
=
key
.
shape
[
-
1
]
head_dim
=
inner_dim
//
attn
.
heads
query
=
query
.
view
(
batch_size
,
-
1
,
attn
.
heads
,
head_dim
).
transpose
(
1
,
2
)
...
...
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