Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aphrodite/platforms/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ def get_attn_backend_cls(
logger.info_once(
"Using FlexAttention backend for %s.",
", ".join(f"{k}={v}" for k, v in use_flex_attention_reason.items()),
scope="global",
)
return FLEX_ATTENTION_V1

Expand Down
4 changes: 1 addition & 3 deletions aphrodite/platforms/xpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ def get_attn_backend_cls(
logger.info_once("Using Flash Attention backend.", scope="global")
return FLASH_ATTN
elif selected_backend:
raise ValueError(
f"Invalid attention backend for {cls.device_name}, with use_v1: {use_v1} use_mla: {use_mla}"
)
raise ValueError(f"Invalid attention backend for {cls.device_name}, with use_mla: {use_mla}")

logger.info_once("Using Flash Attention backend.", scope="global")
return "aphrodite.v1.attention.backends.flash_attn.FlashAttentionBackend"
Expand Down
9 changes: 6 additions & 3 deletions aphrodite/v1/spec_decode/eagle.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def __init__(
(sorted(self.aphrodite_config.compilation_config.cudagraph_capture_sizes)) if self.use_cuda_graph else []
)

self.use_cuda_graph = self.use_cuda_graph and bool(self.cudagraph_batch_sizes)
# persistent buffers for cuda graph
self.input_ids = torch.zeros(self.max_num_tokens, dtype=torch.int32, device=device)
self.uses_mrope = self.aphrodite_config.model_config.uses_mrope
Expand Down Expand Up @@ -824,7 +825,7 @@ def load_model(self, target_model: nn.Module) -> None:
)
indexer_layers = get_layers_from_aphrodite_config(self.aphrodite_config, DeepseekV32IndexerCache)
draft_indexer_layer_names = indexer_layers.keys() - target_indexer_layer_names
self.attn_layer_names = list(draft_attn_layer_names)
self.attn_layer_names = list(draft_attn_layer_names - draft_indexer_layer_names)
self.indexer_layer_names = list(draft_indexer_layer_names)

if self.indexer_layer_names:
Expand Down Expand Up @@ -907,14 +908,16 @@ def dummy_run(
num_tokens: int,
use_cudagraphs=True,
) -> None:
if use_cudagraphs and num_tokens <= self.cudagraph_batch_sizes[-1]:
# Determine if CUDA graphs should be used for this run.
cudagraphs_enabled = use_cudagraphs and self.use_cuda_graph
if cudagraphs_enabled and num_tokens <= self.cudagraph_batch_sizes[-1]:
num_tokens = self.aphrodite_config.pad_for_cudagraph(num_tokens)

with set_forward_context(
None,
self.aphrodite_config,
num_tokens=num_tokens,
cudagraph_runtime_mode=CUDAGraphMode.PIECEWISE if use_cudagraphs else CUDAGraphMode.NONE,
cudagraph_runtime_mode=(CUDAGraphMode.PIECEWISE if cudagraphs_enabled else CUDAGraphMode.NONE),
):
if self.supports_mm_inputs:
input_ids = None
Expand Down