Skip to content

[Model] Extend Ultravox to accept audio longer than 30s #13631

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

Merged
merged 30 commits into from
Mar 12, 2025

Conversation

farzadab
Copy link
Contributor

@farzadab farzadab commented Feb 20, 2025

Currently the Ultravox model input is capped to 30 seconds and extra audio is truncated (AFAIK). Also each sample is fed to Whisper individually (without being batched).

This PR allows using longer audio by chunking them first, using Whisper encoder in batch mode, and then concatenates them.

TODO:

  • processors on HF still need to be updated in tandem with this PR.
  • run evaluations with the updated model to verify the changes.

@farzadab farzadab marked this pull request as draft February 20, 2025 21:29
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.

🚀

@mgoin
Copy link
Member

mgoin commented Feb 21, 2025

FYI @NickLucche for the usage of whisper

@NickLucche
Copy link
Contributor

Thanks for the contrib!
What is the chunking logic for tiling the audio? Feel free to link the hf processor PR.

@farzadab
Copy link
Contributor Author

farzadab commented Feb 21, 2025

re @NickLucche: Here's the processor link: https://huggingface.co/fixie-ai/ultravox-v0_3-llama-3_2-1b/blob/main/ultravox_processing.py#L209

The logic: for each audio, split to 30 second chunks (but do not pad the last item to 30s, which is the same as before).
Then we flatten and batch everything up and run Whisper as if they were separate audios. We use audio_lens to compute an attention_mask for the last chunk per audio. The final embeddings are then concatenated.

There are other ways we could've done this, but it matches what we do on the Ultravox side for both some fine-tuning that we do and evals. If we end up updating those I'll update VLLM as well.

Also, note that since we don't pad the last chunk, and since in most cases we have smaller than 30s audio, the number of frames do not match across samples. I didn't see a collator anywhere that I could update. I'm suspecting that I'll have to update _process_audio_input further to handle that. Updated _process_audio_input.

Signed-off-by: Farzad Abdolhosseini <[email protected]>
@NickLucche
Copy link
Contributor

Ok I see then that's a naive chunking where you don't account for splitting mid-word nor you have any overlap and/or prompt from previous chunk.

This case seems much easier to handle vllm-side, given changes are already in hf. Let's just make sure the batched whisper forward is accounted for by the initial profiler run to avoid oom.

Signed-off-by: Farzad Abdolhosseini <[email protected]>
Signed-off-by: Farzad Abdolhosseini <[email protected]>
Signed-off-by: Farzad Abdolhosseini <[email protected]>
Signed-off-by: Farzad Abdolhosseini <[email protected]>
Signed-off-by: Farzad Abdolhosseini <[email protected]>
Signed-off-by: Farzad Abdolhosseini <[email protected]>
Signed-off-by: Farzad Abdolhosseini <[email protected]>
Signed-off-by: Farzad Abdolhosseini <[email protected]>
@farzadab farzadab marked this pull request as ready for review February 26, 2025 00:53
@DarkLight1337 DarkLight1337 added the ready ONLY add when PR is ready to merge/full CI is needed label Mar 1, 2025
Copy link
Member

@ywang96 ywang96 left a comment

Choose a reason for hiding this comment

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

Hello! @farzadab I left a few comments regarding the CI failure. Thanks for your contribution!

@mergify mergify bot added the multi-modality Related to multi-modality (#4194) label Mar 7, 2025
Signed-off-by: Farzad Abdolhosseini <[email protected]>
Signed-off-by: Farzad Abdolhosseini <[email protected]>
Signed-off-by: Farzad Abdolhosseini <[email protected]>
@farzadab
Copy link
Contributor Author

The tests are finally passing, yay!
The PR is ready to merge.

@DarkLight1337
Copy link
Member

Nice, let's merge this then.

@DarkLight1337 DarkLight1337 merged commit 80e78d0 into vllm-project:main Mar 12, 2025
32 checks passed
@farzadab farzadab deleted the farzad-long-audio branch March 12, 2025 03:05
@varun-sundar-rabindranath
Copy link
Contributor

Hey guys, looks like this PR broke the Ultravox LoRA tests. Both V0 and V1 tests/lora/test_ultravox.py "were" failing.
I can't seem to repro the V0 test failure locally.
I can repro the V1 test failure - The test hits the assert

assert len(dummy_encoder_outputs) == max_num_mm_items, (
. If I remove the assert the test works fine. @ywang96 @DarkLight1337 can you please take a look when you get a chance. Thanks!
cc @jeejeelee @robertgshaw2-redhat

richardsliu pushed a commit to richardsliu/vllm that referenced this pull request Mar 14, 2025
lulmer pushed a commit to lulmer/vllm that referenced this pull request Apr 7, 2025
shreyankg pushed a commit to shreyankg/vllm that referenced this pull request May 3, 2025
RichardoMrMu pushed a commit to RichardoMrMu/vllm that referenced this pull request May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multi-modality Related to multi-modality (#4194) ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants