[Feat] support SP for FLUX.2-klein (#1250)

Signed-off-by: Lancer <maruixiang6688@gmail.com>
This commit is contained in:
Lancer authored and GitHub committed 2026-03-15 12:18:12 +08:00
1 parent af012babf8
commit 2472c360aa
5 files changed
+280 -53

No files matched your search

@@ -49,7 +49,7 @@ from vllm_omni.diffusion.forward_context import (
get_forward_context,
is_forward_context_available,
)
from vllm_omni.diffusion.layers.rope import RotaryEmbedding
from vllm_omni.diffusion.layers.rope import RotaryEmbedding, apply_rope_to_qk
ADALN_EMBED_DIM = 256
SEQ_MULTI_OF = 32
@@ -329,10 +329,7 @@ class ZImageAttention(nn.Module):
query = self.norm_q(query)
key = self.norm_k(key)
cos = cos.to(query.dtype)
sin = sin.to(query.dtype)
query = self.rope(query, cos, sin)
key = self.rope(key, cos, sin)
query, key = apply_rope_to_qk(self.rope, query, key, (cos, sin))
# Cast to correct dtype
dtype = query.dtype
query, key = query.to(dtype), key.to(dtype)