Fix misleading error for audio duration limit rejection (#45113)
Signed-off-by: jperezde <jperezde@redhat.com>
This commit is contained in:
@@ -172,6 +172,8 @@ class OpenAISpeechToText(OpenAIServing):
|
|||||||
sr=self.asr_config.sample_rate,
|
sr=self.asr_config.sample_rate,
|
||||||
max_duration_s=self.max_audio_decode_duration_s,
|
max_duration_s=self.max_audio_decode_duration_s,
|
||||||
)
|
)
|
||||||
|
except ValueError:
|
||||||
|
raise
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
raise ValueError("Invalid or unsupported audio file.") from exc
|
raise ValueError("Invalid or unsupported audio file.") from exc
|
||||||
|
|
||||||
|
|||||||
@@ -92,8 +92,9 @@ def load_audio_pyav(
|
|||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Audio exceeds maximum allowed duration of "
|
f"Audio exceeds maximum allowed duration of "
|
||||||
f"{max_duration_s}s (metadata reports "
|
f"{max_duration_s}s (metadata reports "
|
||||||
f"{metadata_duration_s:.1f}s). This limit "
|
f"{metadata_duration_s:.1f}s). Set "
|
||||||
f"prevents decompression-bomb attacks."
|
f"VLLM_MAX_AUDIO_DECODE_DURATION_S to "
|
||||||
|
f"increase this limit."
|
||||||
)
|
)
|
||||||
|
|
||||||
max_samples = (
|
max_samples = (
|
||||||
@@ -129,8 +130,9 @@ def load_audio_pyav(
|
|||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Audio exceeds maximum allowed duration of "
|
f"Audio exceeds maximum allowed duration of "
|
||||||
f"{max_duration_s}s (decoded {total_samples} "
|
f"{max_duration_s}s (decoded {total_samples} "
|
||||||
f"samples at {sr}Hz). This limit prevents "
|
f"samples at {sr}Hz). Set "
|
||||||
f"decompression-bomb attacks."
|
f"VLLM_MAX_AUDIO_DECODE_DURATION_S to "
|
||||||
|
f"increase this limit."
|
||||||
)
|
)
|
||||||
except (ValueError, ImportError):
|
except (ValueError, ImportError):
|
||||||
raise
|
raise
|
||||||
@@ -166,8 +168,9 @@ def load_audio_soundfile(
|
|||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Audio exceeds maximum allowed duration of "
|
f"Audio exceeds maximum allowed duration of "
|
||||||
f"{max_duration_s}s (file contains "
|
f"{max_duration_s}s (file contains "
|
||||||
f"{file_duration_s:.1f}s at {native_sr}Hz). "
|
f"{file_duration_s:.1f}s at {native_sr}Hz). Set "
|
||||||
f"This limit prevents decompression-bomb attacks."
|
f"VLLM_MAX_AUDIO_DECODE_DURATION_S to "
|
||||||
|
f"increase this limit."
|
||||||
)
|
)
|
||||||
y = f.read(dtype="float32", always_2d=False).T
|
y = f.read(dtype="float32", always_2d=False).T
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user