Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion vllm_ascend/distributed/mooncake_layerwise_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ def save_kv_layer(self, layer_name: str, kv_layer: Tuple[torch.Tensor,
connector_metadata: MooncakeLayerwiseConnectorMetadata,
**kwargs) -> None:
"""MooncakeLayerwiseConnector does not save explicitly."""
if self.kv_role == 'kv_producer':
if self.kv_role == 'kv_producer' and connector_metadata.request.keys():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

There's a typo in the attribute name. The MooncakeLayerwiseConnectorMetadata object has an attribute requests (plural), not request. This will raise an AttributeError at runtime.

Additionally, to check if the dictionary is not empty, you can use the dictionary directly in a boolean context, which is more Pythonic.

Suggested change
if self.kv_role == 'kv_producer' and connector_metadata.request.keys():
if self.kv_role == 'kv_producer' and connector_metadata.requests:

if self.pd_head_ratio != 1:
if self.current_layer != 0:
self.completion_event.wait()
Expand Down
8 changes: 4 additions & 4 deletions vllm_ascend/worker/model_runner_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2370,6 +2370,10 @@ def _dummy_run(
tp_size = self.vllm_config.parallel_config.tensor_parallel_size
num_tokens = math.ceil(num_tokens / tp_size) * tp_size

# Force dummy run on prefill stage when this node is deemed as kv producer.
if self.is_kv_producer and not self.is_kv_consumer:
with_prefill = True

# Padding for DP
(num_tokens, num_tokens_across_dp, with_prefill,
_) = self._sync_metadata_across_dp(num_tokens, with_prefill, False)
Expand Down Expand Up @@ -2417,10 +2421,6 @@ def _dummy_run(
num_scheduled_tokens = np.array(num_scheduled_tokens_list,
dtype=np.int32)

# Force dummy run on prefill stage when this node is deemed as kv producer.
if self.is_kv_producer and not self.is_kv_consumer:
with_prefill = True

if not self.in_profile_run and self.dynamic_eplb:
self.eplb_updator.forward_before()

Expand Down