[Misc] Use apply_rotary_emb from vllm_flash_attn for Qwen2-VL vision RoPE (#17726)
Signed-off-by: Isotr0py <2037008807@qq.com>
This commit is contained in:
@@ -297,13 +297,8 @@ class Qwen2_5_VisionAttention(nn.Module):
|
||||
q, k, v = (rearrange(x, "s b ... -> b s ...").contiguous()
|
||||
for x in (q, k, v))
|
||||
if rotary_pos_emb is not None:
|
||||
use_flash_attn = self.attn_backend == _Backend.FLASH_ATTN
|
||||
q = apply_rotary_pos_emb_vision(q,
|
||||
rotary_pos_emb,
|
||||
use_flash_attn=use_flash_attn)
|
||||
k = apply_rotary_pos_emb_vision(k,
|
||||
rotary_pos_emb,
|
||||
use_flash_attn=use_flash_attn)
|
||||
q = apply_rotary_pos_emb_vision(q, rotary_pos_emb)
|
||||
k = apply_rotary_pos_emb_vision(k, rotary_pos_emb)
|
||||
|
||||
if self.attn_backend == _Backend.FLASH_ATTN:
|
||||
# from vllm_flash_attn.flash_attn_interface import (
|
||||
|
||||
Reference in New Issue
Block a user