[Wan2.2] Fix "uninitialized nn.Module of type RotaryEmbeddingWan" graph-break (#4053)
Signed-off-by: Kristoffer Torp <kristoffer.torp@amd.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
1 parent
64a5bb92de
commit
890803ca06
1 file changed
+2
-1
@@ -406,6 +406,8 @@ class WanSelfAttention(nn.Module):
|
|||||||
)
|
)
|
||||||
self.dropout = nn.Dropout(dropout)
|
self.dropout = nn.Dropout(dropout)
|
||||||
|
|
||||||
|
self.rotary_embedding = RotaryEmbeddingWan(is_neox_style=False, half_head_dim=True)
|
||||||
|
|
||||||
# Unified attention layer
|
# Unified attention layer
|
||||||
self.attn = Attention(
|
self.attn = Attention(
|
||||||
num_heads=self.num_heads,
|
num_heads=self.num_heads,
|
||||||
@@ -441,7 +443,6 @@ class WanSelfAttention(nn.Module):
|
|||||||
|
|
||||||
# Apply rotary embeddings
|
# Apply rotary embeddings
|
||||||
if rotary_emb is not None:
|
if rotary_emb is not None:
|
||||||
self.rotary_embedding = RotaryEmbeddingWan(is_neox_style=False, half_head_dim=True)
|
|
||||||
freqs_cos, freqs_sin = rotary_emb
|
freqs_cos, freqs_sin = rotary_emb
|
||||||
query = self.rotary_embedding(query, freqs_cos, freqs_sin)
|
query = self.rotary_embedding(query, freqs_cos, freqs_sin)
|
||||||
key = self.rotary_embedding(key, freqs_cos, freqs_sin)
|
key = self.rotary_embedding(key, freqs_cos, freqs_sin)
|
||||||
|
|||||||
Reference in new issue
Block a user