[Spec Decode] Update extract_hidden_states to use deferred kv_connector clear (#37013)
This commit is contained in:
@@ -4328,23 +4328,12 @@ class GPUModelRunner(
|
||||
)
|
||||
target_hidden_states = [h[:num_scheduled_tokens] for h in aux_hidden_states]
|
||||
|
||||
draft_token_ids, drafter_kv_connector_output = self.drafter.propose(
|
||||
draft_token_ids = self.drafter.propose(
|
||||
sampled_token_ids=sampled_token_ids,
|
||||
target_hidden_states=target_hidden_states,
|
||||
common_attn_metadata=common_attn_metadata,
|
||||
scheduler_output=scheduler_output,
|
||||
slot_mappings=slot_mappings,
|
||||
)
|
||||
# Combine KVConnectorOutputs or select the non-empty one
|
||||
if self.kv_connector_output and drafter_kv_connector_output:
|
||||
self.kv_connector_output = KVConnectorOutput.merge(
|
||||
self.kv_connector_output, drafter_kv_connector_output
|
||||
)
|
||||
else:
|
||||
self.kv_connector_output = (
|
||||
self.kv_connector_output or drafter_kv_connector_output
|
||||
)
|
||||
|
||||
next_token_ids, valid_sampled_tokens_count = (
|
||||
self.drafter.prepare_next_token_ids_padded(
|
||||
common_attn_metadata,
|
||||
|
||||
Reference in New Issue
Block a user