[Model] Accelerate Breeze-TTS-2 non-streaming inference (#7752)
This commit is contained in:
1 parent
d2aa07159c
commit
3f473a358b
84 files changed
+8191
-5622
No files matched your search
@@ -780,7 +780,11 @@ def _resolve_audio_transcript(
|
||||
audio_bytes = getattr(response, "audio_bytes", None)
|
||||
if not audio_bytes:
|
||||
return None
|
||||
return convert_audio_bytes_to_text(audio_bytes, language=request_config.get("transcript_language"))
|
||||
return convert_audio_bytes_to_text(
|
||||
audio_bytes,
|
||||
model_size=request_config.get("transcript_model", "small"),
|
||||
language=request_config.get("transcript_language"),
|
||||
)
|
||||
|
||||
|
||||
def assert_omni_response(response: Any, request_config: dict[str, Any], run_level):
|
||||
|
||||
@@ -1444,6 +1444,7 @@ class OnlineOmniClient:
|
||||
- task_type, ref_text, ref_audio: TTS-specific extras (optional, passed via extra_body)
|
||||
- min_audio_bytes: optional minimum ``len(audio_bytes)`` checked in ``assert_audio_speech_response``
|
||||
- transcript_expected_text: local expected spoken text; defaults to ``input``
|
||||
- transcript_model: primary Whisper model for content checks; defaults to ``small``
|
||||
- timeout: request timeout in seconds (float, optional, default 120.0)
|
||||
- stream: whether to use streaming API (bool, optional, default False)
|
||||
|
||||
@@ -1467,6 +1468,7 @@ class OnlineOmniClient:
|
||||
"task_type",
|
||||
"ref_text",
|
||||
"ref_audio",
|
||||
"extra_params",
|
||||
"language",
|
||||
"max_new_tokens",
|
||||
"seed",
|
||||
|
||||
@@ -11,6 +11,7 @@ from tests.helpers.assertions import (
|
||||
_resolve_audio_transcript,
|
||||
assert_audio_speech_response,
|
||||
)
|
||||
from tests.helpers.client import OmniResponse
|
||||
|
||||
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
|
||||
|
||||
@@ -75,6 +76,26 @@ def test_resolve_transcript_leaves_language_unset_by_default(monkeypatch):
|
||||
assert captured["model_size"] == "small"
|
||||
|
||||
|
||||
def test_resolve_transcript_uses_configured_primary_model(monkeypatch):
|
||||
captured = _capture_transcribe(monkeypatch)
|
||||
response = OmniResponse(audio_content=None, audio_bytes=b"fake-wav")
|
||||
|
||||
_resolve_audio_transcript(
|
||||
response,
|
||||
{
|
||||
"input": "你好",
|
||||
"response_format": "wav",
|
||||
"transcript_language": "zh",
|
||||
"transcript_model": "large-v3",
|
||||
},
|
||||
"advanced_model",
|
||||
speech_api=True,
|
||||
)
|
||||
|
||||
assert captured["model_size"] == "large-v3"
|
||||
assert captured["language"] == "zh"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("request_config", "expected_text"),
|
||||
[
|
||||
|
||||
Reference in new issue
Block a user