diff --git a/tests/e2e/singlecard/spec_decode_v1/test_v1_spec_decode.py b/tests/e2e/singlecard/spec_decode_v1/test_v1_spec_decode.py index 0902fe6d..5d74b5d4 100644 --- a/tests/e2e/singlecard/spec_decode_v1/test_v1_spec_decode.py +++ b/tests/e2e/singlecard/spec_decode_v1/test_v1_spec_decode.py @@ -110,7 +110,7 @@ def test_eagle_correctness( Compare the outputs of a original LLM and a speculative LLM should be the same when using eagle speculative decoding. ''' - pytest.skip("exist OOM error") + pytest.skip("To be aligned with GPU") ref_llm = LLM(model=model_name, max_model_len=2048, enforce_eager=False) ref_outputs = ref_llm.chat(test_prompts, sampling_config) del ref_llm diff --git a/vllm_ascend/spec_decode/eagle_proposer.py b/vllm_ascend/spec_decode/eagle_proposer.py index 6b47e6bf..af7d3689 100644 --- a/vllm_ascend/spec_decode/eagle_proposer.py +++ b/vllm_ascend/spec_decode/eagle_proposer.py @@ -79,7 +79,7 @@ class EagleProposer(Proposer): dtype=torch.int32) attn_mask_len = self.vllm_config.model_config.max_model_len self.attn_mask_builder = AttentionMaskBuilder( - attn_mask_len, self.vllm_config.model_config.dtype) + attn_mask_len, self.vllm_config.model_config.dtype, device=device) def load_model(self, model: nn.Module) -> None: target_attn_layer_names = set( @@ -430,9 +430,7 @@ class EagleProposer(Proposer): query_lens = cu_num_tokens[1:] - cu_num_tokens[:-1] max_query_len = query_lens.max().item() - attn_mask = self.attn_mask_builder.get_splitfuse_attn_mask( - seq_lens, target_positions, self.vllm_config.model_config.dtype, - self.device) + attn_mask = self.runner.attn_mask common_attn_metadata = AscendCommonAttentionMetadata( query_start_loc=cu_num_tokens.to(device), @@ -507,9 +505,15 @@ class EagleProposer(Proposer): attn_metadata.num_actual_tokens = batch_size attn_metadata.max_query_len = 1 attn_metadata.query_start_loc = self.arange[:batch_size + 1] + attn_metadata.query_start_loc_list = attn_metadata.query_start_loc[ + 1:].tolist() + attn_metadata.num_decodes, attn_metadata.num_prefills, attn_metadata.num_decode_tokens, attn_metadata.num_prefill_tokens = 0, batch_size, 0, batch_size + attn_metadata.num_actual_tokens_pcp_padded = attn_metadata.num_decode_tokens + attn_metadata.num_prefill_tokens query_lens.fill_(1) attn_metadata.query_lens = query_lens + attn_metadata.actual_seq_lengths_q = [1 + i for i in range(batch_size)] + attn_metadata.seq_lens_list = seq_lens.tolist() attn_metadata.attn_state = AscendAttentionState.ChunkedPrefill for now_speculative in range( self.vllm_config.speculative_config.num_speculative_tokens - @@ -536,6 +540,9 @@ class EagleProposer(Proposer): # TODO: Increment the sequence lengths. attn_metadata.seq_lens += 1 + attn_metadata.seq_lens_list = [ + _ + 1 for _ in attn_metadata.seq_lens_list + ] # TODO: Consider max model length. # attn_metadata.max_seq_len = min(attn_metadata.max_seq_len, # self.max_model_len)