[Perf][MiniCPM-o] Stage 0 streaming audio/vision encoder CUDA graphs and candidate sampling (#8430)

Signed-off-by: BeatSeat <wendavid552@gmail.com>
Co-authored-by: amy-why-3459 <wuhaiyan17@huawei.com>
This commit is contained in:
BeatSeatandamy-why-3459 authored and GitHub committed 2026-10-06 07:53:03 -07:00
1 parent 65699fe94c
commit 182b77da4c
15 files changed
+2998 -198

No files matched your search

+6 -2
View File
@@ -415,7 +415,8 @@ def test_minicpmo_non_duplex_sample_skips_duplex_row_scan():
)
assert runner._sample(torch.zeros((1, 4)), spec_decode_metadata=None) == "model-sampler"
assert calls == []
# The empty row set is still published: the model then skips its per-row prompt scan.
assert calls == ["prepare"]
def test_minicpmo_duplex_sample_clears_stale_rows_once_without_scanning():
@@ -442,7 +443,7 @@ def test_minicpmo_duplex_sample_clears_stale_rows_once_without_scanning():
assert runner._sample(torch.zeros((1, 4)), spec_decode_metadata=None) == "model-sampler"
assert runner._sample(torch.zeros((1, 4)), spec_decode_metadata=None) == "model-sampler"
assert calls == [()]
assert calls == [(), ()]
def test_generic_ar_runner_has_no_minicpmo_sampler_state_or_typeerror_probe():
@@ -2890,6 +2891,7 @@ def test_minicpmo_stage0_native_sampler_forced_listen_yields_floor():
)
sampled = model.sample(logits, sampling_metadata)
model._commit_minicpmo45_duplex_pending_samples() # the runner commits before the next step
assert sampled is not None
assert sampled.sampled_token_ids.tolist() == [[151705]]
@@ -3155,6 +3157,7 @@ def test_minicpmo_stage0_turn_eos_is_forwarded_not_pending():
logits[0, 151717] = 30.0
sampled = model.sample(logits, _native_duplex_sampling_metadata([151706, 200, 201]))
model._commit_minicpmo45_duplex_pending_samples() # the runner commits before the next step
assert sampled.sampled_token_ids.tolist() == [[151717]]
assert state.pending_terminator_token is None
@@ -3166,6 +3169,7 @@ def test_minicpmo_stage0_turn_eos_is_forwarded_not_pending():
logits = torch.full((1, 151723), -100.0)
logits[0, 151718] = 30.0
sampled = model.sample(logits, _native_duplex_sampling_metadata([151706, 200, 201, 151717]))
model._commit_minicpmo45_duplex_pending_samples()
assert sampled.sampled_token_ids.tolist() == [[151718]]
assert state.pending_terminator_token == 151718