Skip to content

fix: adapt the import path change for ToT vLLM#7749

Closed
richardhuo-nv wants to merge 1 commit intomainfrom
rihuo/fix_nightly_vllm
Closed

fix: adapt the import path change for ToT vLLM#7749
richardhuo-nv wants to merge 1 commit intomainfrom
rihuo/fix_nightly_vllm

Conversation

@richardhuo-nv
Copy link
Copy Markdown
Contributor

@richardhuo-nv richardhuo-nv commented Apr 1, 2026

Overview:

Adapt the import path change for ToT vLLM, with a fallback to the old import path for older vLLM versions.

Details:

This vLLM PR (vllm-project/vllm#35182) changed the inputs path in vLLM. Update the import path on our end to ensure we stay compatible with these changes during the vLLM version upgrade, while still falling back to the old import path for older versions.

Where should the reviewer start?

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • closes GitHub issue: #xxx

Summary by CodeRabbit

  • Refactor

    • Updated vLLM library compatibility across the codebase to support multiple versions through enhanced import resolution logic.
  • Chores

    • Improved dependency handling to gracefully support both current and legacy versions of the vLLM library.

@richardhuo-nv richardhuo-nv requested a review from a team as a code owner April 1, 2026 03:16
@richardhuo-nv richardhuo-nv requested a review from a team April 1, 2026 03:16
@github-actions github-actions bot added fix backend::vllm Relates to the vllm backend frontend `python -m dynamo.frontend` and `dynamo-run in=http|text|grpc` multimodal labels Apr 1, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Walkthrough

The PR updates import statements across nine modules to support multiple vLLM versions. Direct imports of TokensPrompt and MultiModalUUIDDict are replaced with try/except compatibility blocks that first attempt imports from new vLLM paths, falling back to legacy paths on failure. No functional logic or control flow changes are made.

Changes

Cohort / File(s) Summary
Components vLLM Frontend & Handlers
components/src/dynamo/frontend/vllm_processor.py, components/src/dynamo/vllm/multimodal_handlers/multimodal_pd_worker_handler.py, components/src/dynamo/vllm/multimodal_handlers/worker_handler.py
Updated TokensPrompt import handling with try/except compatibility layer: first attempts import from vllm.inputs.llm, falls back to vllm.inputs.data.
Components vLLM Utils
components/src/dynamo/vllm/multimodal_utils/chat_processor.py, components/src/dynamo/vllm/multimodal_utils/protocol.py
Added compatibility imports for TokensPrompt and MultiModalUUIDDict with try/except fallback mechanism across new (vllm.inputs.llm, vllm.multimodal.inputs) and legacy import paths.
Components vLLM Tests
components/src/dynamo/vllm/tests/test_vllm_renderer_api.py
Updated module-level TokensPrompt assignment using try/except compatibility import strategy.
Example Modules
examples/multimodal/components/worker.py, examples/multimodal/utils/chat_processor.py, examples/multimodal/utils/protocol.py
Applied consistent try/except compatibility imports for TokensPrompt and MultiModalUUIDDict across example implementations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adapting import paths for vLLM compatibility with a fallback mechanism.
Description check ✅ Passed The description provides overview, details about the vLLM PR change, and explains the fallback strategy, but omits the 'Where should the reviewer start?' section content.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch rihuo/fix_nightly_vllm

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

fix

fix mm
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/src/dynamo/vllm/multimodal_utils/protocol.py`:
- Around line 32-38: The vLLM compatibility try/except import for
MultiModalUUIDDict and TokensPrompt is currently below first-party imports and
violates isort/ruff ordering; move the entire try/except block (the imports of
MultiModalUUIDDict and TokensPrompt) so it appears before any first-party
dynamo.* imports in protocol.py, ensuring third-party vllm imports come before
first-party imports and preserve the fallback ImportError behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7ec0b77d-b993-44b9-9e11-d3a830a7791e

📥 Commits

Reviewing files that changed from the base of the PR and between 21ba0c4 and 9a8eac2.

📒 Files selected for processing (9)
  • components/src/dynamo/frontend/vllm_processor.py
  • components/src/dynamo/vllm/multimodal_handlers/multimodal_pd_worker_handler.py
  • components/src/dynamo/vllm/multimodal_handlers/worker_handler.py
  • components/src/dynamo/vllm/multimodal_utils/chat_processor.py
  • components/src/dynamo/vllm/multimodal_utils/protocol.py
  • components/src/dynamo/vllm/tests/test_vllm_renderer_api.py
  • examples/multimodal/components/worker.py
  • examples/multimodal/utils/chat_processor.py
  • examples/multimodal/utils/protocol.py

@grahamking
Copy link
Copy Markdown
Contributor

I don't think we should do this. That try statement will get very big very fast! :)

Dynamo targets a specific vllm release, to avoid having so many different code paths. We also test with only the version we target, because again that would be very complex.

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

Labels

backend::vllm Relates to the vllm backend fix frontend `python -m dynamo.frontend` and `dynamo-run in=http|text|grpc` multimodal size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants