[BugFix][Higgs-Audio-V3] Fix transcript and concurrent sampling tests (#6422)

Signed-off-by: akshatvishu <akshatnayak197@gmail.com>
This commit is contained in:
akshatvishu authored and GitHub committed 2026-08-30 08:52:15 +00:00
1 parent a6b559cf54
commit c41925689d
10 files changed
+330 -34

No files matched your search

+2 -2
View File
@@ -665,7 +665,7 @@ def _speech_assertion_needs_audio_transcript(request_config: dict[str, Any], run
return False
if request_config.get("response_format") == "pcm":
return False
return bool(request_config.get("input"))
return bool(request_config.get("transcript_expected_text", request_config.get("input")))
def _resolve_audio_transcript(
@@ -880,7 +880,7 @@ def assert_audio_speech_response(response: Any, request_config: dict[str, Any],
transcript = _resolve_audio_transcript(response, request_config, run_level, speech_api=True)
if transcript is not None:
expected_text = request_config.get("input")
expected_text = request_config.get("transcript_expected_text", request_config.get("input"))
if expected_text:
print(f"audio content is: {transcript}")
print(f"input text is: {expected_text}")
+1
View File
@@ -1432,6 +1432,7 @@ class OnlineOmniClient:
- response_format: audio format such as "wav" or "pcm" (optional)
- 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``
- timeout: request timeout in seconds (float, optional, default 120.0)
- stream: whether to use streaming API (bool, optional, default False)
+40 -2
View File
@@ -1,12 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
from types import SimpleNamespace
import pytest
from tests.helpers import assertions
from tests.helpers.assertions import _assert_transcript_matches, _resolve_audio_transcript
from tests.helpers.assertions import (
_assert_transcript_matches,
_resolve_audio_transcript,
assert_audio_speech_response,
)
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
@@ -71,6 +75,40 @@ def test_resolve_transcript_leaves_language_unset_by_default(monkeypatch):
assert captured["model_size"] == "small"
@pytest.mark.parametrize(
("request_config", "expected_text"),
[
({"input": "spoken words"}, "spoken words"),
(
{
"input": "<|style:whispering|>spoken words",
"transcript_expected_text": "spoken words",
},
"spoken words",
),
],
)
def test_speech_transcript_expected_text(monkeypatch, request_config, expected_text):
captured: dict = {}
monkeypatch.setattr(assertions, "convert_audio_bytes_to_text", lambda *_args, **_kwargs: "spoken words")
def capture_match(_transcript, _audio_bytes, expected_text, **_kwargs):
captured["expected_text"] = expected_text
monkeypatch.setattr(assertions, "_assert_transcript_matches", capture_match)
response = SimpleNamespace(success=True, audio_bytes=b"fake-wav", audio_format="audio/wav")
request_config["response_format"] = "wav"
assert_audio_speech_response(
response,
request_config,
"advanced_model",
)
assert captured["expected_text"] == expected_text
def test_escalated_transcript_keeps_declared_language(monkeypatch):
# The escalated pass must honour the same language, otherwise a request that
# pins one silently falls back to auto-detection on retry.