Fix vllm_plugin import crash when vLLM's AudioMediaIO location changes - #442
Open
Ammar Hashmi (ammar-iitm) wants to merge 1 commit into
Open
Ammar Hashmi (ammar-iitm) wants to merge 1 commit into
Ammar Hashmi (ammar-iitm) wants to merge 1 commit into
Conversation
vllm_plugin/model.py locates vLLM's AudioMediaIO under one of two module
paths depending on vLLM version, falling back on ImportError. But when the
fallback module exists yet no longer defines AudioMediaIO (vLLM moved/
renamed it in some releases), accessing the attribute raises AttributeError
instead, which isn't caught -- crashing the entire plugin at import time:
File "vllm_plugin/model.py", line 76, in <module>
_OriginalAudioMediaIO = _vllm_audio_module.AudioMediaIO
AttributeError: module 'vllm.multimodal.audio' has no attribute 'AudioMediaIO'
Reported in microsoft#222 with this exact traceback, blocking any vLLM deployment
on the affected version.
Catch AttributeError alongside ImportError at both fallback levels, and if
AudioMediaIO can't be found in either known location, skip the optional
FFmpeg-decoding override with a warning instead of crashing -- vLLM's
built-in audio decoding still works, so the plugin can still load.
Verified with a standalone reproduction (fake vllm module tree, no real
vLLM needed): the exact issue microsoft#222 scenario and a fully-incompatible-vLLM
scenario now degrade gracefully instead of crashing, while the two
currently-working scenarios (new-location and old-location vLLM) apply the
patch identically to before (same subclass, same module attribute
replacement, same load_bytes/load_base64/load_file behavior).
Fixes microsoft#222
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016fM2LafALmBK16KnFWjsp7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VibeVoice-ASRvia vLLM crashes at plugin import time on some vLLM versions with:vllm_plugin/model.pylocates vLLM'sAudioMediaIOunder one of two module paths depending on vLLM version (it moved between releases), falling back to the old path onImportError. But in the reporter's environment, the old-path module (vllm.multimodal.audio) still exists — it just no longer definesAudioMediaIO— so the attribute access raisesAttributeError, notImportError, which theexcept ImportError:clause doesn't catch. This crashes the whole plugin at import time, blocking any deployment on that vLLM build.(ImportError, AttributeError)for the same class of problem — this PR brings the first fallback in line with that established pattern, and additionally degrades gracefully (skip the optional FFmpeg-decoding override, log a warning) rather than crashing outright ifAudioMediaIOcan't be found in either known location.Change
vllm_plugin/model.py: catch(ImportError, AttributeError)when resolvingAudioMediaIO's original location. If it can't be found anywhere, print a[VibeVoice] WARN:message and skip the FFmpeg-decoding patch instead of crashing — vLLM's built-in audio decoding still works, so the plugin still loads.AudioMediaIOis found (new or old location) — same subclass, same module patching as before.Test plan
python3 -m py_compile vllm_plugin/model.pyvllmmodule tree (no real vLLM install needed), covering 4 scenarios:AudioMediaIO) — previously crashed, now degrades gracefully with a warning.AudioMediaIO) — same graceful degradation._PatchedAudioMediaIOis a subclass of the realAudioMediaIO, the module attribute is replaced, andload_bytes/load_base64/load_filebehave as before.vllm serverun against the specific vLLM build from the report (would need that exact vLLM version installed) — would appreciate confirmation from the reporter or a maintainer.🤖 Generated with Claude Code
https://claude.ai/code/session_016fM2LafALmBK16KnFWjsp7