[Refactor] Remove resampy dependency#39524
Conversation
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
There was a problem hiding this comment.
Code Review
This pull request removes the resampy dependency across the project, updating requirement files, setup.py, and audio processing modules. The default resampling method is transitioned to pyav. Feedback indicates that hardcoding resample_audio_pyav in load_audio_soundfile may cause runtime errors if the av package is missing, suggesting the use of AudioResampler or a fallback to scipy instead.
|
|
||
| if sr is not None and sr != native_sr: | ||
| y = resampy.resample(y, sr_orig=native_sr, sr_new=sr) | ||
| y = resample_audio_pyav(y, orig_sr=native_sr, target_sr=sr) |
There was a problem hiding this comment.
In load_audio_soundfile, the resampling logic now hardcodes resample_audio_pyav. If the av package is not installed (e.g., if the user didn't install vllm[audio]), this will raise an error from the PlaceholderModule when resampling is required. It might be safer to use the AudioResampler class or provide a fallback to scipy if av is unavailable, especially since load_audio is a general utility.
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
|
Hi @Isotr0py, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Purpose
Actually,
pyavperforms audio resample much better thanresampy, so there is not necessary to align withlibrosa's original implementation:https://github.com/librosa/librosa/blob/e403272fc984bc4aeb316e5f15899042224bb9fe/librosa/core/audio.py#L637-L678
Performance Benchmark
pyavresampyQuality Metrics (vs soxr reference)
pyavresampyTest Plan
Test Result
Correctness tests still pass after using pyav resampler.
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.