[Bugfix] Fix Qwen3-TTS Base ICL garbled output when ref_audio is a local path (#2984)
Signed-off-by: Dnoob <dxpouo@gmail.com>
This commit is contained in:
1 parent
4c2bea782e
commit
08cf5a6083
2 files changed
+141
-3
No files matched your search
@@ -83,12 +83,29 @@ def _estimate_prompt_len(
|
||||
if not isinstance(audio_path, str) or not audio_path.strip():
|
||||
return None
|
||||
try:
|
||||
from vllm.multimodal.media import MediaConnector
|
||||
from urllib.parse import urlparse
|
||||
|
||||
connector = MediaConnector(allowed_local_media_path="/")
|
||||
audio, sr = connector.fetch_audio(audio_path)
|
||||
import numpy as np
|
||||
|
||||
def _is_url(path: str) -> bool:
|
||||
try:
|
||||
parsed = urlparse(path)
|
||||
if parsed.scheme in ("http", "https"):
|
||||
return bool(parsed.netloc)
|
||||
return parsed.scheme in ("file", "data")
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
if _is_url(audio_path):
|
||||
from vllm.multimodal.media import MediaConnector
|
||||
|
||||
connector = MediaConnector(allowed_local_media_path="/")
|
||||
audio, sr = connector.fetch_audio(audio_path)
|
||||
else:
|
||||
from vllm.multimodal.media.audio import load_audio
|
||||
|
||||
audio, sr = load_audio(audio_path, sr=None, mono=True)
|
||||
|
||||
wav_np = np.asarray(audio, dtype=np.float32)
|
||||
|
||||
if speech_tok is not None:
|
||||
|
||||
Reference in new issue
Block a user