[Lint]Style: Convert test/ to ruff format(Batch #1)#6738
[Lint]Style: Convert test/ to ruff format(Batch #1)#6738wangxiyuan merged 2 commits intovllm-project:mainfrom
test/ to ruff format(Batch #1)#6738Conversation
|
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. |
Summary of ChangesHello @MrZ20, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request initiates the conversion of the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request applies ruff formatting to a batch of test files, which is a good step towards code consistency. The changes are mostly stylistic, such as updating type hints to modern syntax and reformatting code blocks. However, I've identified a critical issue in tests/e2e/conftest.py where a necessary import was removed from a function that runs in a subprocess. This will likely lead to a runtime error. Please address this issue.
| # We can try to clean up memory in this subprocess, though it mostly affects this process. | ||
| # But if there are any lingering contexts in this process (unlikely for a fresh spawn), it helps. | ||
| gc.collect() | ||
| torch.npu.empty_cache() |
There was a problem hiding this comment.
The _check_npu_memory_worker function is executed in a separate process via multiprocessing.get_context("spawn"). A spawned process does not inherit the parent's imported modules. Therefore, torch_npu must be imported within this worker function to register the NPU backend with PyTorch.
The removal of import torch_npu will cause torch.npu to be unavailable in the subprocess, leading to an AttributeError at runtime when torch.npu.empty_cache() or torch.npu.mem_get_info() is called. This is a critical bug.
Please add the import back.
| # We can try to clean up memory in this subprocess, though it mostly affects this process. | |
| # But if there are any lingering contexts in this process (unlikely for a fresh spawn), it helps. | |
| gc.collect() | |
| torch.npu.empty_cache() | |
| import torch_npu # type: ignore | |
| # We can try to clean up memory in this subprocess, though it mostly affects this process. | |
| # But if there are any lingering contexts in this process (unlikely for a fresh spawn), it helps. | |
| gc.collect() | |
| torch.npu.empty_cache() |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
…lm-project#6738) ### What this PR does / why we need it? **Scope of Changes**: | File Path | | :--- | | `tests/e2e/310p/multicard/test_vl_model_multicard.py` | | `tests/e2e/310p/singlecard/test_vl_model_singlecard.py` | | `tests/e2e/310p/test_utils.py` | | `tests/e2e/conftest.py` | | `tests/e2e/model_utils.py` | | `tests/e2e/models/conftest.py` | | `tests/e2e/models/test_lm_eval_correctness.py` | | `tests/e2e/multicard/2-cards/spec_decode/test_spec_decode.py` | | `tests/e2e/multicard/2-cards/test_aclgraph_capture_replay.py` | | `tests/e2e/multicard/2-cards/test_data_parallel.py` | | `tests/e2e/multicard/2-cards/test_disaggregated_encoder.py` | | `tests/e2e/multicard/2-cards/test_expert_parallel.py` | | `tests/e2e/multicard/2-cards/test_external_launcher.py` | | `tests/e2e/multicard/2-cards/test_full_graph_mode.py` | | `tests/e2e/multicard/2-cards/test_ilama_lora_tp2.py` | | `tests/e2e/multicard/2-cards/test_offline_inference_distributed.py` | | `tests/e2e/multicard/2-cards/test_offline_weight_load.py` | | `tests/e2e/multicard/2-cards/test_pipeline_parallel.py` | | `tests/e2e/multicard/2-cards/test_prefix_caching.py` | | `tests/e2e/multicard/2-cards/test_quantization.py` | | `tests/e2e/multicard/2-cards/test_qwen3_moe.py` | | `tests/e2e/multicard/2-cards/test_qwen3_moe_routing_replay.py` | | `tests/e2e/multicard/2-cards/test_qwen3_performance.py` | | `tests/e2e/multicard/2-cards/test_shared_expert_dp.py` | | `tests/e2e/multicard/2-cards/test_single_request_aclgraph.py` | | `tests/e2e/multicard/2-cards/test_sp_pass.py` | ### Does this PR introduce _any_ user-facing change? ### How was this patch tested? - vLLM version: v0.15.0 - vLLM main: vllm-project/vllm@9562912 Signed-off-by: MrZ20 <2609716663@qq.com> Co-authored-by: wangxiyuan <wangxiyuan1007@gmail.com>
What this PR does / why we need it?
Scope of Changes:
tests/e2e/310p/multicard/test_vl_model_multicard.pytests/e2e/310p/singlecard/test_vl_model_singlecard.pytests/e2e/310p/test_utils.pytests/e2e/conftest.pytests/e2e/model_utils.pytests/e2e/models/conftest.pytests/e2e/models/test_lm_eval_correctness.pytests/e2e/multicard/2-cards/spec_decode/test_spec_decode.pytests/e2e/multicard/2-cards/test_aclgraph_capture_replay.pytests/e2e/multicard/2-cards/test_data_parallel.pytests/e2e/multicard/2-cards/test_disaggregated_encoder.pytests/e2e/multicard/2-cards/test_expert_parallel.pytests/e2e/multicard/2-cards/test_external_launcher.pytests/e2e/multicard/2-cards/test_full_graph_mode.pytests/e2e/multicard/2-cards/test_ilama_lora_tp2.pytests/e2e/multicard/2-cards/test_offline_inference_distributed.pytests/e2e/multicard/2-cards/test_offline_weight_load.pytests/e2e/multicard/2-cards/test_pipeline_parallel.pytests/e2e/multicard/2-cards/test_prefix_caching.pytests/e2e/multicard/2-cards/test_quantization.pytests/e2e/multicard/2-cards/test_qwen3_moe.pytests/e2e/multicard/2-cards/test_qwen3_moe_routing_replay.pytests/e2e/multicard/2-cards/test_qwen3_performance.pytests/e2e/multicard/2-cards/test_shared_expert_dp.pytests/e2e/multicard/2-cards/test_single_request_aclgraph.pytests/e2e/multicard/2-cards/test_sp_pass.pyDoes this PR introduce any user-facing change?
How was this patch tested?