Revert "Fix HybridAttnBackend forward for linear attention" (#19356)

This commit is contained in:
Kangyan-Zhou
2026-02-25 11:49:50 -08:00
committed by GitHub
parent a0f3361023
commit 306c552639

View File

@@ -145,31 +145,3 @@ class HybridAttnBackend(AttentionBackend):
) -> Optional[BaseIndexerMetadata]:
backend = self._select_backend(forward_batch.forward_mode)
return backend.get_indexer_metadata(layer_id, forward_batch)
def forward(
self,
q: Optional[torch.Tensor] = None, # For full attention
k: Optional[torch.Tensor] = None, # For full attention
v: Optional[torch.Tensor] = None, # For full attention
layer: RadixAttention = None,
forward_batch: ForwardBatch = None,
save_kv_cache: bool = True,
mixed_qkv: Optional[torch.Tensor] = None, # For linear attention
a: Optional[torch.Tensor] = None, # For linear attention
b: Optional[torch.Tensor] = None, # For linear attention
**kwargs,
):
"""Forward method that supports both regular attention (q, k, v) and linear attention (mixed_qkv, a, b)."""
backend = self._select_backend(forward_batch.forward_mode)
return backend.forward(
q=q,
k=k,
v=v,
layer=layer,
forward_batch=forward_batch,
save_kv_cache=save_kv_cache,
mixed_qkv=mixed_qkv,
a=a,
b=b,
**kwargs,
)