[torch.compile] support all attention backends (#10558)
Signed-off-by: youkaichao <youkaichao@gmail.com>
This commit is contained in:
@@ -173,7 +173,8 @@ def unified_v1_flash_attention(
|
||||
alibi_slopes: Optional[torch.Tensor] = None,
|
||||
logits_soft_cap: Optional[float] = None,
|
||||
) -> None:
|
||||
current_metadata = get_forward_context()
|
||||
context = get_forward_context()
|
||||
current_metadata = context.dynamic_forward_context
|
||||
if current_metadata is None:
|
||||
# Profiling run.
|
||||
return
|
||||
|
||||
@@ -447,7 +447,7 @@ class GPUModelRunner:
|
||||
|
||||
# Run the decoder.
|
||||
# Use persistent buffers for CUDA graphs.
|
||||
with set_forward_context(attn_metadata):
|
||||
with set_forward_context(attn_metadata, self.vllm_config):
|
||||
hidden_states = self.model(
|
||||
input_ids=None,
|
||||
positions=self.positions[:num_input_tokens],
|
||||
@@ -523,7 +523,7 @@ class GPUModelRunner:
|
||||
num_tokens: int,
|
||||
kv_caches: List[torch.Tensor],
|
||||
) -> torch.Tensor:
|
||||
with set_forward_context(None):
|
||||
with set_forward_context(None, self.vllm_config):
|
||||
hidden_states = model(
|
||||
input_ids=None,
|
||||
positions=self.positions[:num_tokens],
|
||||
|
||||
Reference in New Issue
Block a user