[Voxtral] Raise BadRequest for ref_audio (#7012)
Signed-off-by: Clodagh Walsh <clodaghwalsh17@gmail.com>
This commit is contained in:
1 parent
45a3e77351
commit
a1a234a0b4
7 files changed
+68
-4
No files matched your search
@@ -12,11 +12,14 @@ import os
|
||||
os.environ.setdefault("VLLM_WORKER_MULTIPROC_METHOD", "spawn")
|
||||
|
||||
import pytest
|
||||
from openai import BadRequestError as OpenAIBadRequestError
|
||||
|
||||
from tests.helpers.mark import hardware_test
|
||||
from tests.helpers.media import generate_synthetic_audio
|
||||
from tests.helpers.runtime import OmniServerParams
|
||||
from tests.helpers.stage_config import get_deploy_config_path
|
||||
|
||||
# Note this model is the public checkpoint without the encoder weights required for voice cloning
|
||||
MODEL = "mistralai/Voxtral-4B-TTS-2603"
|
||||
STAGE_CONFIG = get_deploy_config_path("voxtral_tts.yaml")
|
||||
EXTRA_ARGS = ["--trust-remote-code", "--enforce-eager", "--disable-log-stats"]
|
||||
@@ -173,3 +176,21 @@ def test_speech_batches(omni_server, online_client) -> None:
|
||||
"timeout": 120.0,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
def test_speech_ref_audio(omni_server, online_client) -> None:
|
||||
"""Test ref_audio failure is handled as a BadRequest instead of a RuntimeError"""
|
||||
audio_data = f"data:audio/wav;base64,{generate_synthetic_audio(5, 1)['base64']}"
|
||||
with pytest.raises(OpenAIBadRequestError) as exc_info:
|
||||
online_client.send_audio_speech_request(
|
||||
{
|
||||
"model": omni_server.model,
|
||||
"input": "how are you",
|
||||
"ref_audio": audio_data,
|
||||
"language": "English",
|
||||
"response_format": "wav",
|
||||
}
|
||||
)
|
||||
|
||||
assert exc_info.value.status_code == 400
|
||||
@@ -5133,6 +5133,7 @@ class TestTTSAsyncOffloading:
|
||||
|
||||
def test_prepare_speech_generation_awaits_voxtral_async(self, voxtral_server, mocker: MockerFixture):
|
||||
"""Voxtral path in _prepare_speech_generation should call the async wrapper."""
|
||||
voxtral_server._adapter._encoder_loaded = mocker.AsyncMock(return_value=False)
|
||||
voxtral_server._adapter._build_prompt_async = mocker.AsyncMock(
|
||||
return_value={
|
||||
"prompt_token_ids": [1, 2, 3],
|
||||
@@ -5288,6 +5289,7 @@ class TestTTSAsyncOffloading:
|
||||
"""FINAL_ONLY streaming for async_chunk=False is scoped to qwen3_tts only."""
|
||||
voxtral_server.engine_client.model_config.async_chunk = False
|
||||
mocker.patch.object(voxtral_server._get_tts_adapter(), "validate", return_value=None)
|
||||
voxtral_server._adapter._encoder_loaded = mocker.AsyncMock(return_value=False)
|
||||
voxtral_server._adapter._build_prompt_async = mocker.AsyncMock(
|
||||
return_value={
|
||||
"prompt_token_ids": [1, 2, 3],
|
||||
|
||||
Reference in new issue
Block a user