[Bugfix][MiniCPM-o] Allow ragged audio_feature_lens across a batch (#7071)

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Co-authored-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Co-authored-by: amy-why-3459 <wuhaiyan17@huawei.com>
This commit is contained in:
authored and GitHub committed 2026-09-07 23:51:13 +08:00
1 parent 7be014bce6
commit cf36f5e474
2 files changed
+52 -1

No files matched your search

@@ -3796,11 +3796,17 @@ class MiniCPMOAudioFeatureInputs(TensorSchema):
audio_feature_lens: Annotated[
torch.Tensor | list[torch.Tensor],
TensorShape("bn", "s"),
TensorShape("bn", "s", dynamic_dims={"s"}),
]
"""
This should be feature length of each audio slice,
which equals to `audio_features.shape[-1]`
Each audio in the batch may be split into a different number of slices
(e.g. audio >30s splits into multiple slices while shorter audio doesn't),
so `s` must be dynamic: batching audios with different slice counts is a
normal, valid input and is already handled below via `hstack` + per-audio
iteration, not a schema violation.
"""