-
Notifications
You must be signed in to change notification settings - Fork 452
[Bugfix] ngram spec decode attention error and repeat add sampled token ids error #2972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1440,6 +1440,8 @@ def _build_attn_state(self, num_reqs, num_scheduled_tokens, | |
if self.drafter and (self.drafter.name == SpecDcodeType.EAGLE | ||
or self.drafter.name == SpecDcodeType.EAGLE3): | ||
attn_state = AscendAttentionState.ChunkedPrefill | ||
elif self.drafter and self.drafter.name == SpecDcodeType.NGRAM: | ||
attn_state = AscendAttentionState.DecodeOnly | ||
else: | ||
attn_state = AscendAttentionState.SpecDecoding | ||
Comment on lines
+1443
to
1444
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For N-gram speculative decoding, falling back to elif self.drafter and self.drafter.name == SpecDcodeType.NGRAM:
attn_state = AscendAttentionState.DecodeOnly
else:
attn_state = AscendAttentionState.SpecDecoding |
||
# splitfuse | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code block redundantly adds
sampled_ids
totoken_ids_cpu
, a task already performed inNPUModelRunner._execute_model
. This redundancy is also buggy:num_tokens_no_spec
is already updated, causing incorrect indexing and data corruption in the input toself.propose
. This is a critical issue that leads to incorrect behavior in speculative decoding.