Reworked fast_pos_embed_interpolate() using torch (#10959)

This commit is contained in:
Vitaly Tuzov
2025-12-30 14:45:34 +08:00
committed by GitHub
parent 8a84b1e7e0
commit 1048803c1f
6 changed files with 143 additions and 91 deletions
+2 -3
View File
@@ -626,7 +626,7 @@ class VisionAttention(nn.Module):
prefix=add_prefix("proj", prefix),
)
self.aux_stream = aux_stream
self.ln_events = [torch.cuda.Event(), torch.cuda.Event()]
self.ln_events = [torch.cuda.Event(), torch.cuda.Event()] if aux_stream else []
def _determine_attention_backend(self, passed_backend: Optional[str]) -> str:
"""Decide the multimodal attention backend string.
@@ -693,8 +693,7 @@ class VisionAttention(nn.Module):
q, k = maybe_execute_in_parallel(
q_l2norm,
k_l2norm,
self.ln_events[0],
self.ln_events[1],
self.ln_events,
self.aux_stream,
)
return q, k