[Model] Support Qwen3.8-Flash-Next (#53896)
Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com> Signed-off-by: andyluo7 <andy.luo@amd.com> Signed-off-by: lishunyang12 <lishunyang03@gmail.com> Signed-off-by: Harry Huang <huanghaoyan.hhy@alibaba-inc.com> Signed-off-by: Thien Tran <gau.nernst@yahoo.com.sg> Signed-off-by: Isotr0py <Isotr0py@outlook.com> Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Signed-off-by: Yifan Qiao <yifanqiao@inferact.ai> Signed-off-by: zjy0516 <riverclouds.zhu@qq.com> Co-authored-by: zjy0516 <riverclouds.zhu@qq.com> Co-authored-by: KungYork <firelikest@163.com> Co-authored-by: Thien Tran <gau.nernst@yahoo.com.sg> Co-authored-by: Yifan Qiao <yifanqiao@inferact.ai> Co-authored-by: andyluo7 <43718156+andyluo7@users.noreply.github.com> Co-authored-by: Isotr0py <mozf@inferact.ai> Co-authored-by: andyluo7 <andy.luo@amd.com> Co-authored-by: OpenAI Codex <noreply@openai.com> Co-authored-by: lishunyang12 <lishunyang03@gmail.com> Co-authored-by: Vadim Gimpelson <156319763+vadiklyutiy@users.noreply.github.com> Co-authored-by: Isotr0py <Isotr0py@outlook.com> Co-authored-by: Lucas Wilkinson <lwilkins@redhat.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
co-authored by
zjy0516
KungYork
Thien Tran
Yifan Qiao
andyluo7
Isotr0py
andyluo7
OpenAI Codex
lishunyang12
Vadim Gimpelson
Isotr0py
Lucas Wilkinson
Claude Opus 5
OpenAI Codex
parent
687db59744
commit
e126687a9a
@@ -1761,6 +1761,52 @@ def test_spec_decode_padding_skipped_for_diffusion():
|
||||
assert r2.request_id not in out.scheduled_spec_decode_tokens
|
||||
|
||||
|
||||
@pytest.mark.parametrize("aligned_tokens", [1, 2, 3])
|
||||
def test_spec_decode_padding_dropped_when_recurrent_alignment_clips(
|
||||
aligned_tokens: int,
|
||||
):
|
||||
"""A clipped padded request must drop its padding, not shorten it.
|
||||
|
||||
The sampler derives a request's row window from its draft count, so a
|
||||
padded request that keeps fewer than 1 + num_spec query rows would select
|
||||
the preceding request's hidden states.
|
||||
"""
|
||||
num_spec = 3
|
||||
scheduler = create_scheduler(
|
||||
num_speculative_tokens=num_spec,
|
||||
enable_prefix_caching=True,
|
||||
block_size=16,
|
||||
)
|
||||
r1, r2 = create_requests(
|
||||
num_requests=2, num_tokens=33, same_prompt=True, max_tokens=16
|
||||
)
|
||||
|
||||
scheduler.add_request(r1)
|
||||
out = scheduler.schedule()
|
||||
assert out.num_scheduled_tokens[r1.request_id] == 33
|
||||
_model_output(scheduler, out, [[100]])
|
||||
scheduler.update_draft_token_ids(DraftTokenIds([r1.request_id], [[1, 2, 3]]))
|
||||
|
||||
# Model the recurrent align split that clips a padded 1+3 prompt tail at
|
||||
# the next cache boundary. The real QSA block size produces all three cases
|
||||
# depending on prompt length modulo four.
|
||||
scheduler.need_mamba_block_aligned_split = True
|
||||
original_split = scheduler._mamba_block_aligned_split
|
||||
|
||||
def align_prompt_tail(request, num_new_tokens, *args):
|
||||
if request is r2:
|
||||
return aligned_tokens
|
||||
return original_split(request, num_new_tokens, *args)
|
||||
|
||||
scheduler._mamba_block_aligned_split = align_prompt_tail
|
||||
scheduler.add_request(r2)
|
||||
out = scheduler.schedule()
|
||||
|
||||
assert out.scheduled_spec_decode_tokens[r1.request_id] == [1, 2, 3]
|
||||
assert out.num_scheduled_tokens[r2.request_id] == 1
|
||||
assert r2.request_id not in out.scheduled_spec_decode_tokens
|
||||
|
||||
|
||||
def test_spec_decode_padding_skipped_with_prefill_in_batch():
|
||||
"""Padding is skipped when the batch contains a prefill chunk: the batch is
|
||||
already mixed/non-uniform, so padding a new decode request buys nothing.
|
||||
|
||||
Reference in New Issue
Block a user