-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[TRTLLM-6646][test] NIM migration to TRT-LLM LLMAPI : Add QWQ-32b torch test #7284
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
[TRTLLM-6646][test] NIM migration to TRT-LLM LLMAPI : Add QWQ-32b torch test #7284
Conversation
📝 WalkthroughWalkthroughAdds Qwen/QwQ-32B accuracy entries to CNN/DailyMail and MMLU reference YAMLs, introduces a new TestQwQ_32B integration test (tensor-parallel size 4, KvCacheConfig and memory/device skip guards) in the PyTorch LLM accuracy tests, and registers the test in the QA test list. No public APIs changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant PyTest as pytest
participant Test as TestQwQ_32B
participant Kv as KvCacheConfig
participant Builder as LLM Builder
participant Loader as Model Loader
participant Eval as Evaluator
PyTest->>Test: run test_auto_dtype_tp4
Test->>Test: check device count >= 4 and GPU memory >= 80000
alt skip conditions met
Test-->>PyTest: skip
else
Test->>Kv: create(free_gpu_memory_fraction=0.5)
Test->>Builder: build(model_path, kv_config, max_num_tokens=16384, tensor_parallel_size=4, max_batch_size=8)
Builder->>Loader: load Qwen/QwQ-32B
Test->>Eval: evaluate(CNN/DailyMail)
Eval-->>Test: cnn_dailymail result
Test->>Eval: evaluate(MMLU)
Eval-->>Test: mmlu result
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
Hi @crazydemo Could you help me to review this MR? |
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.
Actionable comments posted: 1
🧹 Nitpick comments (3)
tests/integration/defs/accuracy/test_llm_api_pytorch.py (3)
2824-2828
: Guard for multi‑GPU requirement.Add a device-count gate so single‑GPU runners skip earlier without entering the test.
Apply:
+@pytest.mark.skip_less_device(2) @pytest.mark.parametrize("tp_size", [8, 4, 2], ids=["tp8", "tp4", "tp2"]) def test_auto_dtype(self, tp_size): if get_device_count() != tp_size: pytest.skip("Device count mismatch with world size")
2830-2834
: Consider dialing down batch size for headroom on TP=2.If CI still flirts with OOM, reduce max_batch_size from 8 to 4 (model is heavy; 16k tokens + KV=0.5).
Optional tweak:
with LLM(self.MODEL_PATH, max_num_tokens=16384, kv_cache_config=kv_cache_config, tensor_parallel_size=tp_size, - max_batch_size=8) as llm: + max_batch_size=4) as llm:
2835-2838
: Verify prompt formatting for CNN/DailyMail.If QwQ-32B expects chat formatting, pass apply_chat_template to match the reference numbers; otherwise ignore.
Optional:
- task = CnnDailymail(self.MODEL_NAME) - task.evaluate(llm) + task = CnnDailymail(self.MODEL_NAME) + task.evaluate(llm, extra_evaluator_kwargs=dict(apply_chat_template=True))
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
tests/integration/defs/accuracy/references/cnn_dailymail.yaml
(1 hunks)tests/integration/defs/accuracy/references/mmlu.yaml
(1 hunks)tests/integration/defs/accuracy/test_llm_api_pytorch.py
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.py
: Code must target Python 3.8+
Indent Python code with 4 spaces; do not use tabs
Preserve module namespaces when importing; import modules/packages and access members via the module (e.g., from package.subpackage import foo; foo.SomeClass())
Python file names should be snake_case
Python class names should be PascalCase
Python functions/methods and local variables should be snake_case; variables beginning with a number should be prefixed with k_ (e.g., k_99th_percentile)
Global variables should be UPPER_SNAKE_CASE prefixed with G_ (e.g., G_MY_GLOBAL); constants should be UPPER_SNAKE_CASE
Avoid shadowing variables from outer scopes; initialize all externally visible members in init
Prefer docstrings for interfaces used outside a file; comments should be reserved for in-function or file-local interfaces
Use Google-style docstrings for classes and functions; attributes and variables may be documented inline with trailing string literals
Avoid reflection when simpler, explicit code suffices (e.g., avoid dict(**locals()) patterns)
In try/except, catch the narrowest exceptions possible
For duck-typing patterns, keep the try body minimal and move logic to else to avoid masking unrelated failures
Files:
tests/integration/defs/accuracy/test_llm_api_pytorch.py
**/*.{c,cc,cpp,cxx,h,hh,hpp,hxx,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Prepend the NVIDIA copyright header (current year) to all source files (.cpp, .h, .cu, .py, etc.)
Files:
tests/integration/defs/accuracy/test_llm_api_pytorch.py
🧠 Learnings (2)
📓 Common learnings
Learnt from: moraxu
PR: NVIDIA/TensorRT-LLM#6303
File: tests/integration/test_lists/qa/examples_test_list.txt:494-494
Timestamp: 2025-07-28T17:06:08.621Z
Learning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxu
PR: NVIDIA/TensorRT-LLM#6303
File: tests/integration/test_lists/qa/examples_test_list.txt:494-494
Timestamp: 2025-07-28T17:06:08.621Z
Learning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.
Applied to files:
tests/integration/defs/accuracy/test_llm_api_pytorch.py
🧬 Code graph analysis (1)
tests/integration/defs/accuracy/test_llm_api_pytorch.py (4)
tests/integration/defs/accuracy/accuracy_core.py (5)
LlmapiAccuracyTestHarness
(788-799)CnnDailymail
(209-226)evaluate
(147-206)evaluate
(707-717)MMLU
(276-290)tests/integration/defs/conftest.py (2)
llm_models_root
(77-83)get_device_count
(1941-1943)tensorrt_llm/llmapi/llm_args.py (1)
KvCacheConfig
(944-1039)tensorrt_llm/llmapi/llm.py (1)
LLM
(1090-1106)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (2)
tests/integration/defs/accuracy/references/cnn_dailymail.yaml (1)
325-326
: QwQ-32B CNN/DailyMail reference added — LGTM.Placement and formatting are consistent with existing entries.
tests/integration/defs/accuracy/references/mmlu.yaml (1)
144-145
: QwQ-32B MMLU reference added — LGTM.Naming matches MODEL_NAME used in tests; value precision aligns with surrounding entries.
f636130
to
377b7d3
Compare
/bot run |
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/integration/defs/accuracy/test_llm_api_pytorch.py (1)
2819-2825
: Add an explicit timeout to avoid long-hanging CI runs.class TestQwQ_32B(LlmapiAccuracyTestHarness): @@ - @pytest.mark.skip_less_device_memory(320000) + @pytest.mark.timeout(7200) + @pytest.mark.skip_less_device_memory(100000)
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
tests/integration/defs/accuracy/references/cnn_dailymail.yaml
(1 hunks)tests/integration/defs/accuracy/references/mmlu.yaml
(1 hunks)tests/integration/defs/accuracy/test_llm_api_pytorch.py
(1 hunks)tests/integration/test_lists/qa/llm_function_nim.txt
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/integration/defs/accuracy/references/mmlu.yaml
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.py
: Code must target Python 3.8+
Indent Python code with 4 spaces; do not use tabs
Preserve module namespaces when importing; import modules/packages and access members via the module (e.g., from package.subpackage import foo; foo.SomeClass())
Python file names should be snake_case
Python class names should be PascalCase
Python functions/methods and local variables should be snake_case; variables beginning with a number should be prefixed with k_ (e.g., k_99th_percentile)
Global variables should be UPPER_SNAKE_CASE prefixed with G_ (e.g., G_MY_GLOBAL); constants should be UPPER_SNAKE_CASE
Avoid shadowing variables from outer scopes; initialize all externally visible members in init
Prefer docstrings for interfaces used outside a file; comments should be reserved for in-function or file-local interfaces
Use Google-style docstrings for classes and functions; attributes and variables may be documented inline with trailing string literals
Avoid reflection when simpler, explicit code suffices (e.g., avoid dict(**locals()) patterns)
In try/except, catch the narrowest exceptions possible
For duck-typing patterns, keep the try body minimal and move logic to else to avoid masking unrelated failures
Files:
tests/integration/defs/accuracy/test_llm_api_pytorch.py
**/*.{c,cc,cpp,cxx,h,hh,hpp,hxx,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Prepend the NVIDIA copyright header (current year) to all source files (.cpp, .h, .cu, .py, etc.)
Files:
tests/integration/defs/accuracy/test_llm_api_pytorch.py
🧠 Learnings (1)
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxu
PR: NVIDIA/TensorRT-LLM#6303
File: tests/integration/test_lists/qa/examples_test_list.txt:494-494
Timestamp: 2025-07-28T17:06:08.621Z
Learning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.
Applied to files:
tests/integration/test_lists/qa/llm_function_nim.txt
tests/integration/defs/accuracy/test_llm_api_pytorch.py
🧬 Code graph analysis (1)
tests/integration/defs/accuracy/test_llm_api_pytorch.py (4)
tests/integration/defs/accuracy/accuracy_core.py (5)
LlmapiAccuracyTestHarness
(788-799)CnnDailymail
(209-226)evaluate
(147-206)evaluate
(707-717)MMLU
(276-290)tests/integration/defs/conftest.py (1)
llm_models_root
(77-83)tensorrt_llm/llmapi/llm_args.py (1)
KvCacheConfig
(944-1039)tensorrt_llm/llmapi/llm.py (1)
LLM
(1090-1106)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (5)
tests/integration/defs/accuracy/references/cnn_dailymail.yaml (1)
325-326
: QwQ-32B CNN/DailyMail reference added — looks good.Name matches the new test’s MODEL_NAME and formatting is consistent with the file.
tests/integration/test_lists/qa/llm_function_nim.txt (1)
24-24
: QA list entry added correctly.Path matches class and method names; will be picked up by CI.
tests/integration/defs/accuracy/test_llm_api_pytorch.py (3)
2824-2832
: 2xH200 in PR description vs TP=4 and skip_less_device(4) in code — align intent.Pick one of these and adjust accordingly.
Option B (run on 2 GPUs, TP=2):
- @pytest.mark.skip_less_device(4) + @pytest.mark.skip_less_device(2) @@ - with LLM(self.MODEL_PATH, + with LLM(self.MODEL_PATH, max_num_tokens=16384, kv_cache_config=kv_cache_config, - tensor_parallel_size=4, + tensor_parallel_size=2, max_batch_size=8) as llm:If TP=4 is desired, keep the code as-is and update the PR summary to “requires 4 GPUs.”
2826-2832
: Runtime config is reasonable.free_gpu_memory_fraction=0.5 with max_num_tokens=16384 and BS=8 is a sensible starting point for QwQ-32B.
2833-2836
: Confirm whether a chat template is required for stable scores.Some Qwen-family instruct/reasoning models need apply_chat_template=True for CNN/DM; verify expectations for QwQ-32B to match the new reference values.
PR_Github #16675 [ run ] triggered by Bot |
PR_Github #16675 [ run ] completed with state |
12f8490
to
b3d126e
Compare
/bot run --skip-test |
PR_Github #16715 [ run ] triggered by Bot |
/bot run --skip-test |
PR_Github #16719 [ run ] triggered by Bot |
PR_Github #16715 [ run ] completed with state |
PR_Github #16719 [ run ] completed with state |
Signed-off-by: Yaran Wu <[email protected]>
Signed-off-by: Yaran Wu <[email protected]>
Signed-off-by: Yaran Wu <[email protected]>
Signed-off-by: Yaran Wu <[email protected]>
Signed-off-by: Yaran Wu <[email protected]>
Signed-off-by: Yaran Wu <[email protected]>
Signed-off-by: Yaran Wu <[email protected]>
Signed-off-by: Yaran Wu <[email protected]>
Signed-off-by: Yaran Wu <[email protected]>
Signed-off-by: Yaran Wu <[email protected]>
Signed-off-by: Yaran Wu <[email protected]>
Signed-off-by: Yaran Wu <[email protected]>
Signed-off-by: Yaran Wu <[email protected]>
c29bb2b
to
4fd4966
Compare
/bot run --skip-test |
PR_Github #16765 [ run ] triggered by Bot |
/bot run --skip-test |
PR_Github #16765 [ run ] completed with state |
PR_Github #16782 [ run ] triggered by Bot |
PR_Github #16782 [ run ] completed with state |
/bot run --skip-test |
/bot run --skip-test |
PR_Github #16798 [ run ] triggered by Bot |
PR_Github #16799 [ run ] triggered by Bot |
PR_Github #16798 [ run ] completed with state |
/bot run --skip-test |
PR_Github #16801 [ run ] triggered by Bot |
PR_Github #16799 [ run ] completed with state |
PR_Github #16801 [ run ] completed with state |
/bot reuse-pipeline |
GitHub Bot Help
Provide a user friendly way for developers to interact with a Jenkins server. Run See details below for each supported subcommand.
Launch build/test pipelines. All previously running jobs will be killed.
kill
Kill all running builds associated with pull request. skip
Skip testing for latest commit on pull request. reuse-pipeline
Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break. |
/bot reuse-pipeline |
PR_Github #16930 [ reuse-pipeline ] triggered by Bot |
PR_Github #16930 [ reuse-pipeline ] completed with state |
…ch test (NVIDIA#7284) Signed-off-by: Yaran Wu <[email protected]>
Summary by CodeRabbit
New Features
Tests
Description
Add QWQ-32b accuracy test into qa scope. We need to use multi-GPU nodes to run this model.
Each GPU node Peak memory usage of QWQ-32b
Platform: GPU- 2xH200
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...
Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]
to print this help message.See details below for each supported subcommand.
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]
Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id
(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test
(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast
(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test
(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"
(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"
(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"
(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test
(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test
(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test
(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge
(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"
(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log
(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug
(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-list
parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.md
and the
scripts/test_to_stage_mapping.py
helper.kill
kill
Kill all running builds associated with pull request.
skip
skip --comment COMMENT
Skip testing for latest commit on pull request.
--comment "Reason for skipping build/test"
is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipeline
Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.