main
py 27 lines 841 Bytes
Raw
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4 import torch
5
6 from vllm.model_executor.models.qwen3_asr import (
7 Qwen3ASRForConditionalGeneration,
8 )
9 from vllm.multimodal.inputs import MultiModalFeatureSpec, PlaceholderRange
10
11
12 def test_mrope_positions_with_stripped_audio_data() -> None:
13 input_tokens = list(range(7))
14 feature = MultiModalFeatureSpec(
15 data=None,
16 modality="audio",
17 identifier="audio",
18 mm_position=PlaceholderRange(offset=2, length=3),
19 )
20
21 positions, delta = Qwen3ASRForConditionalGeneration.get_mrope_input_positions(
22 None, input_tokens, [feature]
23 )
24
25 expected = torch.arange(len(input_tokens), dtype=torch.long).expand(3, -1)
26 torch.testing.assert_close(positions, expected)
27 assert delta == 0