[Model] Support Qwen3-TTS model series (#895)

Signed-off-by: Gaohan123 <hgaoaf@connect.ust.hk>
This commit is contained in:
Gao Han authored and GitHub committed 2026-01-22 16:57:37 +08:00
1 parent 0df8e80574
commit a54c323952
35 files changed
+9642 -42

No files matched your search

@@ -0,0 +1,59 @@
from vllm_omni.inputs.preprocess import OmniInputPreprocessor
def _make_preprocessor(monkeypatch):
preprocessor = object.__new__(OmniInputPreprocessor)
monkeypatch.setattr(preprocessor, "_truncate_inputs", lambda tokens, tokenization_kwargs=None: tokens)
monkeypatch.setattr(
preprocessor,
"_process_multimodal",
lambda *args, **kwargs: {"prompt_token_ids": [1, 2, 3]},
)
monkeypatch.setattr(preprocessor, "_tokenize_prompt", lambda prompt_text, tokenization_kwargs=None: [9, 8, 7])
return preprocessor
def test_process_tokens_keeps_additional_information(monkeypatch):
preprocessor = _make_preprocessor(monkeypatch)
parsed = {
"prompt_token_ids": [1, 2, 3],
"prompt_embeds": "embeds",
"additional_information": {"task": ["tts"], "lang": ["auto"]},
}
inputs = OmniInputPreprocessor._process_tokens(preprocessor, parsed)
assert inputs["prompt_token_ids"] == [1, 2, 3]
assert inputs["prompt_embeds"] == "embeds"
assert inputs["additional_information"] == {"task": ["tts"], "lang": ["auto"]}
def test_process_text_keeps_additional_information(monkeypatch):
preprocessor = _make_preprocessor(monkeypatch)
parsed = {
"prompt": "hello",
"prompt_embeds": "embeds",
"additional_information": {"speaker": ["alice"]},
}
inputs = OmniInputPreprocessor._process_text(preprocessor, parsed)
assert inputs["prompt_token_ids"] == [9, 8, 7]
assert inputs["prompt_embeds"] == "embeds"
assert inputs["additional_information"] == {"speaker": ["alice"]}
def test_process_text_multimodal_skips_empty_payloads(monkeypatch):
preprocessor = _make_preprocessor(monkeypatch)
parsed = {
"prompt": "hello",
"multi_modal_data": {"image": "fake"},
"prompt_embeds": None,
"additional_information": None,
}
inputs = OmniInputPreprocessor._process_text(preprocessor, parsed)
assert inputs["prompt_token_ids"] == [1, 2, 3]
assert "prompt_embeds" not in inputs
assert "additional_information" not in inputs
@@ -0,0 +1,49 @@
from types import SimpleNamespace
import torch
from vllm_omni.core.sched.output import OmniNewRequestData
def test_omni_new_request_data_copies_payloads():
prompt_embeds = torch.randn(2, 3)
additional_information = {
"speaker": ["test"],
"codes": torch.tensor([1, 2], dtype=torch.int64),
}
request = SimpleNamespace(
request_id="req-1",
prompt_token_ids=[101, 102],
mm_features=None,
sampling_params=None,
pooling_params=None,
num_computed_tokens=0,
lora_request=None,
prompt_embeds=prompt_embeds,
additional_information=additional_information,
)
data = OmniNewRequestData.from_request(request, ([0, 1],), prefill_token_ids=[101, 102])
assert data.prompt_embeds is prompt_embeds
assert data.additional_information is additional_information
assert data.prefill_token_ids == [101, 102]
def test_omni_new_request_data_allows_missing_payloads():
request = SimpleNamespace(
request_id="req-2",
prompt_token_ids=[201, 202],
mm_features=None,
sampling_params=None,
pooling_params=None,
num_computed_tokens=0,
lora_request=None,
prompt_embeds=None,
additional_information=None,
)
data = OmniNewRequestData.from_request(request, ([0],), prefill_token_ids=None)
assert data.prompt_embeds is None
assert data.additional_information is None