Skip to content

[VibeVoice] Avoid GPU syncs when removing audio padding - #50417

Merged
hmellor merged 3 commits into
huggingface:mainfrom
hmellor:vibevoice-asr-audio-features-sync
Nov 6, 2026
Merged

hmellor merged 3 commits into
huggingface:mainfrom
hmellor:vibevoice-asr-audio-features-sync

Conversation

@hmellor

@hmellor hmellor commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Removes the avoidable GPU syncs from get_audio_features in VibeVoice-ASR and VibeVoice, which vLLM calls on its main execution thread (vllm-project/vllm#65735, which replaces vllm-project/vllm#62398).

  • torch.arange uses the feature length rather than num_audio_tokens.max(), which read a value back from the GPU. Both are the same length, since the mask already had to match the features.
  • The mask stays on padding_mask's device and is moved to the CPU to index. A caller holding the mask on the CPU then has no sync. A mask on the GPU behaves as before, as boolean indexing already had to read it back.

With vLLM's VLLM_GPU_SYNC_CHECK=error and padding_mask kept on the CPU, 32 VibeVoice-ASR LibriSpeech requests fail without this PR and pass with it (WER 2.54%). VibeVoice has the same change but was not run through vLLM.

Tests: tests/models/vibevoice and tests/models/vibevoice_asr with RUN_SLOW=1 on a B200, 344 passed, 276 skipped.

AI assistance (Claude Code) was used for this PR.

@eustlb @ebezzam

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@hmellor hmellor changed the title [VibeVoice-ASR] Avoid GPU syncs when removing audio padding [VibeVoice] Avoid GPU syncs when removing audio padding Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: vibevoice, vibevoice_asr

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@hmellor
hmellor requested review from ebezzam and eustlb November 5, 2026 19:18
@ebezzam

ebezzam commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

run-slow: vibevoice, vibevoice_asr

@ebezzam ebezzam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@hmellor looks good!

# adjust padding mask according to tokenizer compression
num_audio_tokens = torch.ceil(padding_mask.sum(dim=-1) / self.config.audio_config.hop_length).to(torch.int64)
padding_mask = torch.arange(num_audio_tokens.max(), device=num_audio_tokens.device) < num_audio_tokens[:, None]
positions = torch.arange(acoustic_features.shape[1], device=num_audio_tokens.device)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice that you use acoustic_features.shape[1] instead of num_audio_tokens.max(). This is actually more robust, in case padding is longer than longest samples (but not expected with default padding)

padding_mask = torch.arange(num_audio_tokens.max(), device=combined_features.device) < num_audio_tokens[
:, None
].to(combined_features.device)
positions = torch.arange(combined_features.shape[1], device=num_audio_tokens.device)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same 👍

@hmellor
hmellor added this pull request to the merge queue Nov 6, 2026
Merged via the queue into huggingface:main with commit 9fa6024 Nov 6, 2026
43 of 45 checks passed
@hmellor
hmellor deleted the vibevoice-asr-audio-features-sync branch November 6, 2026 09:48
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

CI (Nvidia + AMD)

Nvidia · ✅ No new failures 🎉👏 · ⚙️ Workflow · 📊 Dashboard

AMD · ✅ No new failures 🎉👏 · ⚙️ Workflow · 📊 Dashboard

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants