Skip to content

Fix vllm_plugin import crash when vLLM's AudioMediaIO location changes - #442

Open
Ammar Hashmi (ammar-iitm) wants to merge 1 commit into
microsoft:mainfrom
ammar-iitm:fix/vllm-plugin-audiomediaio-attributeerror
Open

Ammar Hashmi (ammar-iitm) wants to merge 1 commit into
microsoft:mainfrom
ammar-iitm:fix/vllm-plugin-audiomediaio-attributeerror

Conversation

@ammar-iitm

Copy link
Copy Markdown

Summary

  • Fixes vllm asr problem #222: deploying VibeVoice-ASR via vLLM crashes at plugin import time on some vLLM versions with:
    File "/app/vllm_plugin/model.py", line 76, in <module>
        _OriginalAudioMediaIO = _vllm_audio_module.AudioMediaIO
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: module 'vllm.multimodal.audio' has no attribute 'AudioMediaIO'
    
  • Root cause: vllm_plugin/model.py locates vLLM's AudioMediaIO under one of two module paths depending on vLLM version (it moved between releases), falling back to the old path on ImportError. But in the reporter's environment, the old-path module (vllm.multimodal.audio) still exists — it just no longer defines AudioMediaIO — so the attribute access raises AttributeError, not ImportError, which the except ImportError: clause doesn't catch. This crashes the whole plugin at import time, blocking any deployment on that vLLM build.
  • Elsewhere in this exact same file (a few lines down, the "utils module" patch), the code already correctly catches (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 if AudioMediaIO can't be found in either known location.

Change

  • vllm_plugin/model.py: catch (ImportError, AttributeError) when resolving AudioMediaIO'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.
  • No change to behavior when AudioMediaIO is found (new or old location) — same subclass, same module patching as before.

Test plan

  • python3 -m py_compile vllm_plugin/model.py
  • Standalone reproduction using a fake vllm module tree (no real vLLM install needed), covering 4 scenarios:
    • The exact issue vllm asr problem #222 scenario (new location missing, old location module present but lacking AudioMediaIO) — previously crashed, now degrades gracefully with a warning.
    • A fully-incompatible future vLLM (neither location has AudioMediaIO) — same graceful degradation.
    • New-location vLLM (modern) — patch still applies: confirmed _PatchedAudioMediaIO is a subclass of the real AudioMediaIO, the module attribute is replaced, and load_bytes/load_base64/load_file behave as before.
    • Old-location vLLM (legacy) — same confirmation.
  • Not verified: an actual vllm serve run 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

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

vllm asr problem

1 participant