Skip to content

Allow untokenized output from apply_transcription_request - #49944

Merged
eustlb merged 2 commits into
huggingface:mainfrom
hmellor:transcription-request-tokenize
Oct 30, 2026
Merged

eustlb merged 2 commits into
huggingface:mainfrom
hmellor:transcription-request-tokenize

Conversation

@hmellor

@hmellor hmellor commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

🤗 Transformers CI

What does this PR do?

Lets inference engines that run the processor themselves (e.g. vLLM's Transformers backend) use apply_transcription_request to build ASR prompts. This is a step towards serving /v1/audio/transcriptions through vLLM's Transformers backend instead of per-model native implementations such as vllm-project/vllm#62398 (VibeVoice-ASR).

  • tokenize argument: added to apply_transcription_request in AudioFlamingo3, Canary, FunASR-Nano, GLM-ASR, MOSS-Transcribe-Diarize, Qwen3-ASR and VibeVoice-ASR. Defaults to True (unchanged). With False, the formatted prompts are returned as list[str] with unexpanded audio placeholders, to be processed later together with the audio. Voxtral already supports this.
  • Truncated VibeVoice-ASR output: extract_speaker_dict raised JSONDecodeError when generation stopped mid-segment (e.g. at max_new_tokens). It now keeps the complete segments and logs a warning, in line with its "returning original text on failure" contract.

This overlaps with #49869 on the same signatures; whichever lands second needs a trivial rebase.

Tests: new VibeVoice-ASR processor tests check that processor(text=prompts, audio=audio) on the untokenized prompts matches the tokenized output, and that truncated output keeps its complete segments. Also checked against the microsoft/VibeVoice-ASR-HF processor: identical input_ids. The processor suites of all 7 models have the same results as main.

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

@eustlb @ebezzam

Add a `tokenize` argument to the chat-template-based ASR processors so
that inference engines, which run the processor themselves, can get the
formatted prompts. Also make VibeVoice-ASR's `extract_speaker_dict` keep
the complete segments of truncated output instead of raising.

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

hmellor commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

With tokenize=False this returns list[str] rather than a BatchFeature, to match Voxtral's apply_transcription_request (and apply_chat_template, which ignores return_dict when not tokenizing). Happy to switch to a BatchFeature (e.g. {"text": ..., "audio": ...}, which would also keep audio loaded from URLs/paths) if you prefer.

@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.

@github-actions

Copy link
Copy Markdown
Contributor

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

run-slow: audioflamingo3, canary, fun_asr_nano, glmasr, moss_transcribe_diarize, qwen3_asr, vibevoice_asr

@eustlb
eustlb force-pushed the transcription-request-tokenize branch from ddea27f to e20017b Compare October 30, 2026 14:10

@eustlb eustlb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks a lot! 🤗

@eustlb
eustlb enabled auto-merge October 30, 2026 14:11
@eustlb
eustlb added this pull request to the merge queue Oct 30, 2026
Merged via the queue into huggingface:main with commit cc414c4 Oct 30, 2026
34 checks passed
@hmellor
hmellor deleted the transcription-request-tokenize branch October 30, 2026 17:05
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