-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
[TPU] make ptxla not imported when using tpu_commons #23081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TPU] make ptxla not imported when using tpu_commons #23081
Conversation
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the codebase to conditionally import torch_xla and its related modules only when the tpu_commons library is not in use. This is achieved by introducing a USE_TPU_COMMONS flag, which is a good approach for managing optional dependencies. The changes are applied across several TPU-related files, making the imports lazy and conditional. My main feedback concerns an inconsistency in vllm/v1/attention/backends/pallas.py, where the check for tpu_commons differs from other files, potentially leading to robustness issues.
1fd8cc3 to
638f680
Compare
Signed-off-by: Chengji Yao <chengjiyao@gmail.com> Signed-off-by: Chengji Yao <chengjiyao@google.com>
638f680 to
44753cf
Compare
|
Could you summarize the problem that this PR tries to address? |
@vanbasten23 by cleaning up the import logic, it prevents tpu_commons from failing due to ptxla |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stamp
Purpose
make ptxla not imported when using tpu_commons
Test Plan
All the current CI tests
Test Result
Passed
(Optional) Documentation Update
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.