Fix position_embeddings unpack (3-tuple of cos/sin/-sin)
This commit is contained in:
parent
a19f051800
commit
e4d9a6f8ff
1 changed files with 5 additions and 1 deletions
|
|
@ -273,7 +273,11 @@ class _VisionAttention(nn.Module):
|
|||
)
|
||||
# RoPE in fp32 to avoid bf16 precision loss, then cast back.
|
||||
orig_dtype = query_states.dtype
|
||||
query_states, key_states = _apply_rope_vision(query_states.float(), key_states.float(), position_embeddings.float())
|
||||
cos, sin, neg_sin = position_embeddings
|
||||
query_states, key_states = _apply_rope_vision(
|
||||
query_states.float(), key_states.float(),
|
||||
(cos.float(), sin.float(), neg_sin.float()),
|
||||
)
|
||||
query_states, key_states = query_states.to(orig_dtype), key_states.to(orig_dtype)
|
||||
lengths = (cu_seqlens[1:] - cu_seqlens[:-1]).tolist()
|
||||
attn_outputs = []
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue