Support Voxtral audio generation in the Transformers backend - #49958
Support Voxtral audio generation in the Transformers backend#49958harshaljanjani wants to merge 2 commits into
Conversation
Signed-off-by: Harshal Janjani <harshaljanjani@gmail.com>
|
Keeping this as a draft for now until the Transformers-side PR is merged; looking forward to the reviews! |
| ): | ||
| raise ValueError("cumem allocator is not supported on current platform.") | ||
|
|
||
| # The Transformers backend needs the HF config, not Mistral's params.json |
There was a problem hiding this comment.
Does it? Transformers supports mistral-common
There was a problem hiding this comment.
It does and the tokenizer loads fine either way, but this due to the model config. As in if we keep config_format=auto it resolves to mistral for Voxtral (ships params.json), and adapt_config_dict gives the backend a generic PreTrainedConfig. AutoModel.from_config resolves by config class not model type, so even with model_type=voxtral and architectures=['VoxtralForConditionalGeneration'] present (left the instrumentation in the screenshot, in_model_mapping=False) we hit the ValueError. Definitely could've been clearer with the comments though, made edits!
There was a problem hiding this comment.
Ok so would I be right in saying that:
- This forces vLLM to use the HF config
- Then HF may load the Mistral config inside a HF class
There was a problem hiding this comment.
So yes this forces vLLM to use the HF config, and tmk no there isn't a scenario where it can fall back to the Mistral here, the reason being that Voxtral ships both an HF config.json and a Mistral params.json and the PR just swaps which one we read (auto reads params.json and gives PreTrainedConfig; HF reads config.json and gives VoxtralConfig). The forced path only ever fetches config.json and Transformers only reads params.json in its offline convert scripts, not at load time.
There was a problem hiding this comment.
For the config sure, but for the tokenizers/processors Transformers will wrap the classes in mistral-common if it is installed.
There was a problem hiding this comment.
In that case yup it's AutoProcessor gives VoxtralProcessor with a MistralCommonBackend tokenizer and we leave that untouched here, we only pin the config/weights to HF and the processor stays on mistral-common. If the comment reads more broadly than intended (the config) I'm happy to reword it :)
Signed-off-by: Harshal Janjani <harshaljanjani@gmail.com>
What does this PR do?
→ Blocked by the companion Transformers PR making
VoxtralProcessor.__call__audio-capable.→ Enables Voxtral audio generation through the Transformers backend (
--model-impl transformers) currently XFAILed. Stops forwardingtokenizertoMistralCommonBackend(rejects the kwarg), and forces the HF config and weights (not Mistral'sparams.json/ consolidated) when the backend is explicitly requested.→ Verified no regressions on the vLLM-side with
tests/models/multimodal/processing/test_transformers_audio.py(Voxtral un-XFAILed) andtests/models/multimodal/generation/test_transformers_audio.py(Voxtral added, matches HF viacheck_logprobs_close); full audio suite green.→ I've tried to explain why each non-trivial change was made in a one-line comment given much of this involved unwrapping failure modes layer by layer and uncovering deeper issues in the call chain :)
cc: @hmellor
Before (vLLM Voxtral Generation)
After (vLLM Voxtral Generation)
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.