[multimodal][feat] add torchaudio backend to AudioResampler (#52598)

Signed-off-by: JaredforReal <w13431838023@gmail.com>
Signed-off-by: Isotr0py <Isotr0py@outlook.com>
Co-authored-by: Isotr0py <Isotr0py@outlook.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Jared Wen
2026-09-10 06:42:38 +00:00
committed by GitHub
co-authored by Isotr0py mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 7e91760650
commit 912d2e79fe
3 changed files with 159 additions and 6 deletions
+6 -1
View File
@@ -547,6 +547,9 @@ class MultiModalDataParser:
Args:
target_sr (float, optional): Enables automatic resampling of audio
items to the model's expected sampling rate.
audio_resample_method (str): Backend used for the resampling above.
Defaults to torchaudio; models with specific needs may override
(e.g. phi4mm uses scipy).
target_channels (int, optional): Target number of audio channels.
If provided, normalizes audio to this many channels (e.g., 1 for mono).
If None, audio channels are passed through unchanged.
@@ -602,7 +605,9 @@ class MultiModalDataParser:
*,
target_sr: float | None = None,
target_channels: int | None = None,
audio_resample_method: Literal["pyav", "scipy", "soxr"] = "pyav",
audio_resample_method: Literal["pyav", "scipy", "soxr", "torchaudio"] = (
"torchaudio"
),
video_needs_metadata: bool = False,
expected_hidden_size: int | None = None,
allow_missing_mm_embeddings: bool = False,