[Test][BugFix] Fix torch.rand usage in triton penalty test#6680
[Test][BugFix] Fix torch.rand usage in triton penalty test#6680zzzzwwjj merged 1 commit intovllm-project:mainfrom
Conversation
Signed-off-by: whx-sjtu <2952154980@qq.com>
Summary of ChangesHello @whx-sjtu, 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 resolves an issue in the Triton-related nightly tests by ensuring that random tensors generated within the test data creation utility are correctly placed on the specified device. This prevents potential device mismatch errors and improves the reliability of the tests. 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
|
|
👋 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. |
There was a problem hiding this comment.
Code Review
This pull request addresses errors in a Triton-related nightly test by correcting the usage of torch.rand. The change correctly uses a keyword argument for the device parameter. However, I've found a critical bug in the modified code that was present before: the temperature variable is not being updated correctly. I've added a specific comment to address this.
In line with the repository's style guide, I'm also suggesting an updated PR title and a summary to better describe the changes.
Suggested PR Title:
[Test][BugFix] Fix torch.rand usage in triton penalty testSuggested PR Summary:
### What this PR does / why we need it?
This PR fixes a `TypeError` in `tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py` that was causing nightly test failures. The `torch.rand()` function was being called with the `device` string as a positional argument, which is incorrect. This has been corrected to use the `device` keyword argument.
Fixes #
### Does this PR introduce _any_ user-facing change?
No, this change only affects a test file.
### How was this patch tested?
CI is expected to pass with this fix.| for i in range(num_reqs): | ||
| if torch.rand(1) > 0.2: | ||
| presence_penalty[i] = torch.rand(1, device).item() * 1.8 + 0.2 | ||
| presence_penalty[i] = torch.rand(1, device=device).item() * 1.8 + 0.2 |
There was a problem hiding this comment.
There appears to be a copy-paste error here. This loop is intended to initialize the temperature tensor, but this line is modifying presence_penalty instead. This will result in incorrect test data, with temperature remaining as a tensor of ones and presence_penalty being potentially overwritten.
| presence_penalty[i] = torch.rand(1, device=device).item() * 1.8 + 0.2 | |
| temperature[i] = torch.rand(1, device=device).item() * 1.8 + 0.2 |
…ect#6680) ### What this PR does / why we need it? This PR fixes a `TypeError` in `tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py` that was causing nightly test failures. The `torch.rand()` function was being called with the `device` string as a positional argument, which is incorrect. This has been corrected to use the `device` keyword argument. Fixes # ### Does this PR introduce _any_ user-facing change? No, this change only affects a test file. ### How was this patch tested? CI is expected to pass with this fix. - vLLM version: v0.15.0 - vLLM main: vllm-project/vllm@1339784 Signed-off-by: whx-sjtu <2952154980@qq.com> Signed-off-by: mikequan0425 <mikequan0425@foxmail.com>
…to qwen3next_rebase * 'main' of https://github.com/vllm-project/vllm-ascend: [Docs] Fix GLM-5 deploy command (vllm-project#6711) [npugraph_ex]enable npugraph_ex by default (vllm-project#6664) [doc]add GLM5.md (vllm-project#6709) [Model] GLM5 adaptation (vllm-project#6642) [Bugfix] Update target probs to target logits in rejection sample (vllm-project#6685) [Main][Ops] Make triton rope support index_selecting from cos_sin_cache (vllm-project#5450) [CI]fix nightly multi node test error for wait for pod ready (vllm-project#6675) [main to main] upgrade main 0210 (vllm-project#6673) [main][Quant] Remove unused rotation functions and parameters from W4A4 LAOS quantization (vllm-project#6648) [Test][BugFix] Fix torch.rand usage in triton penalty test (vllm-project#6680) Add Worker Interface:check_health (vllm-project#6681)
…ect#6680) ### What this PR does / why we need it? This PR fixes a `TypeError` in `tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py` that was causing nightly test failures. The `torch.rand()` function was being called with the `device` string as a positional argument, which is incorrect. This has been corrected to use the `device` keyword argument. Fixes # ### Does this PR introduce _any_ user-facing change? No, this change only affects a test file. ### How was this patch tested? CI is expected to pass with this fix. - vLLM version: v0.15.0 - vLLM main: vllm-project/vllm@1339784 Signed-off-by: whx-sjtu <2952154980@qq.com> Signed-off-by: momochenchuw <chenchuw@huawei.com>
…ect#6680) ### What this PR does / why we need it? This PR fixes a `TypeError` in `tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py` that was causing nightly test failures. The `torch.rand()` function was being called with the `device` string as a positional argument, which is incorrect. This has been corrected to use the `device` keyword argument. Fixes # ### Does this PR introduce _any_ user-facing change? No, this change only affects a test file. ### How was this patch tested? CI is expected to pass with this fix. - vLLM version: v0.15.0 - vLLM main: vllm-project/vllm@1339784 Signed-off-by: whx-sjtu <2952154980@qq.com>
…ect#6680) ### What this PR does / why we need it? This PR fixes a `TypeError` in `tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py` that was causing nightly test failures. The `torch.rand()` function was being called with the `device` string as a positional argument, which is incorrect. This has been corrected to use the `device` keyword argument. Fixes # ### Does this PR introduce _any_ user-facing change? No, this change only affects a test file. ### How was this patch tested? CI is expected to pass with this fix. - vLLM version: v0.15.0 - vLLM main: vllm-project/vllm@1339784 Signed-off-by: whx-sjtu <2952154980@qq.com> Signed-off-by: zrj026 <zhangrunjiang026@gmail.com>
…ect#6680) ### What this PR does / why we need it? This PR fixes a `TypeError` in `tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py` that was causing nightly test failures. The `torch.rand()` function was being called with the `device` string as a positional argument, which is incorrect. This has been corrected to use the `device` keyword argument. Fixes # ### Does this PR introduce _any_ user-facing change? No, this change only affects a test file. ### How was this patch tested? CI is expected to pass with this fix. - vLLM version: v0.15.0 - vLLM main: vllm-project/vllm@1339784 Signed-off-by: whx-sjtu <2952154980@qq.com>
…ect#6680) ### What this PR does / why we need it? This PR fixes a `TypeError` in `tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py` that was causing nightly test failures. The `torch.rand()` function was being called with the `device` string as a positional argument, which is incorrect. This has been corrected to use the `device` keyword argument. Fixes # ### Does this PR introduce _any_ user-facing change? No, this change only affects a test file. ### How was this patch tested? CI is expected to pass with this fix. - vLLM version: v0.15.0 - vLLM main: vllm-project/vllm@1339784 Signed-off-by: whx-sjtu <2952154980@qq.com> Signed-off-by: zrj026 <zhangrunjiang026@gmail.com>
…ect#6680) ### What this PR does / why we need it? This PR fixes a `TypeError` in `tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py` that was causing nightly test failures. The `torch.rand()` function was being called with the `device` string as a positional argument, which is incorrect. This has been corrected to use the `device` keyword argument. Fixes # ### Does this PR introduce _any_ user-facing change? No, this change only affects a test file. ### How was this patch tested? CI is expected to pass with this fix. - vLLM version: v0.15.0 - vLLM main: vllm-project/vllm@1339784 Signed-off-by: whx-sjtu <2952154980@qq.com>
…ect#6680) ### What this PR does / why we need it? This PR fixes a `TypeError` in `tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py` that was causing nightly test failures. The `torch.rand()` function was being called with the `device` string as a positional argument, which is incorrect. This has been corrected to use the `device` keyword argument. Fixes # ### Does this PR introduce _any_ user-facing change? No, this change only affects a test file. ### How was this patch tested? CI is expected to pass with this fix. - vLLM version: v0.15.0 - vLLM main: vllm-project/vllm@1339784 Signed-off-by: whx-sjtu <2952154980@qq.com>
What this PR does / why we need it?
This PR fixes a
TypeErrorintests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.pythat was causing nightly test failures. Thetorch.rand()function was being called with thedevicestring as a positional argument, which is incorrect. This has been corrected to use thedevicekeyword argument.Fixes #
Does this PR introduce any user-facing change?
No, this change only affects a test file.
How was this patch tested?
CI is expected to pass with this fix.