Skip to content

[Bugfix][Frontend] support webm with audioread fallback #18477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cpwan
Copy link

@cpwan cpwan commented May 21, 2025

FIX #18385

@mergify mergify bot added the frontend label May 21, 2025
@cpwan cpwan force-pushed the add-webm branch 2 times, most recently from c667ae0 to 8529fe5 Compare May 21, 2025 10:31
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@cpwan
Copy link
Author

cpwan commented May 21, 2025

Btw, i tried to make minimal change to the code, yet the code in the main branch falls short of the pre-commit check, such as the import sorting...

@mergify mergify bot added the ci/build label May 21, 2025
@DarkLight1337
Copy link
Member

@NickLucche does this look good to you?

@cpwan
Copy link
Author

cpwan commented May 21, 2025

Let me tidy up a bit the git history

Copy link
Contributor

@NickLucche NickLucche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking action on the issue.
To be frank I am not familiar with audioread, but I see librosa already uses it as a fallback so maybe this doesn't even go into the requirements lists.

librosa uses soundfile and audioread for reading audio. As of v0.7, librosa uses soundfile by default, and falls back on audioread only when dealing with codecs unsupported by soundfile. For a list of codecs supported by soundfile, see the libsndfile documentation.

https://github.com/librosa/librosa/blob/e403272fc984bc4aeb316e5f15899042224bb9fe/docs/ioformats.rst#read-specific-formats

Also I am totally uneducated on potential security concerns in opening up to a matrioska format like webm (cc @russellb ).
Can we at least test for the sake of completeness sending some video/image in webm?

try:
with io.BytesIO(audio_data) as bytes_:
out = librosa.load(bytes_, sr=None)
except Exception:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this exception is way too generic

with io.BytesIO(audio_data) as bytes_:
out = librosa.load(bytes_, sr=None)
except Exception:
with tempfile.NamedTemporaryFile() as temp:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should write to a bytesio in memory buffer not a temp file. This may, among other things, trigger permissions issues on deployments.

out = librosa.load(bytes_, sr=None)
except Exception:
with tempfile.NamedTemporaryFile() as temp:
temp.write(audio_data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably log debug/warning this path

@NickLucche
Copy link
Contributor

Also worth to look into why librosa isn't falling back to audioread as reported in the docs, is it an optional dep or..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Audio transcription does not support webm
3 participants