[https://nvbugs/5732958][bug] Fix TestLlama4MinLatency::test_llama_allclose_to_hf failure#10191
Conversation
📝 WalkthroughWalkthroughAdds explicit RuntimeError handling to the LlaMA model when layernorm chaining is missing during forward passes, and introduces required Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10–15 minutes
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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. Comment |
|
@coderabbitai generate docstrings |
✅ Actions performedInitiated docstring generation; will generate only if new commits exist. |
|
Caution Docstrings generation - FAILED An unexpected error occurred while opening a pull request: Reference update failed - https://docs.github.com/rest/git/refs#create-a-reference |
e2627b7 to
67c34be
Compare
|
/bot run |
|
PR_Github #29574 [ run ] triggered by Bot. Commit: |
|
PR_Github #29574 [ run ] completed with state
|
yechank-nvidia
left a comment
There was a problem hiding this comment.
LGTM. Thx for the fix!
|
My current PR does not work for test_llama_sanity tests because those tests do not even load weights! I will need to modify by PR such that Llama/Llama4 works even when load_weights()/post_load_weights() are not called at all, instead of raising an error to tell users to call post_load_weights() |
8b9634a to
cc6c98d
Compare
|
/bot run |
|
PR_Github #37305 [ run ] triggered by Bot. Commit: |
|
PR_Github #37305 [ run ] completed with state
|
|
/bot run |
|
PR_Github #37332 [ run ] triggered by Bot. Commit: |
|
PR_Github #37332 [ run ] completed with state
|
cc6c98d to
3160459
Compare
|
/bot run |
1 similar comment
|
/bot run |
|
PR_Github #37479 [ run ] triggered by Bot. Commit: |
|
PR_Github #37479 [ run ] completed with state |
|
/bot run |
|
PR_Github #37510 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #37599 [ run ] triggered by Bot. Commit: |
|
PR_Github #37599 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #37618 [ run ] triggered by Bot. Commit: |
|
PR_Github #37618 [ run ] completed with state
|
…lclose_to_hf failure Make Llama/Llama4 forward pass work correctly both with and without post_load_weights() being called, by making the layernorm fusion gracefully degrade: - In post_load_weights(), when moving layernorms between layers, set the source layernorm to None to indicate it has been absorbed. - In DecoderLayer.forward(), if next_layer_layernorm is None (i.e. post_load_weights was not called), fall back to simple residual add instead of raising an error. - In DecoderLayer.forward(), if input_layernorm is still present (not absorbed by previous layer), apply it normally. - In Model.forward(), guard self.norm call since it may be None after being moved to the last decoder layer. - Remove the transformers>=4.57.1 skip in the test, since the root cause (missing post_load_weights) is now fixed. Signed-off-by: Po-Han Huang <pohanh@nvidia.com>
3160459 to
2a3c372
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #37880 [ run ] triggered by Bot. Commit: |
|
PR_Github #37880 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #37939 [ run ] triggered by Bot. Commit: |
|
PR_Github #37939 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #38036 [ run ] triggered by Bot. Commit: |
|
PR_Github #38036 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #38104 [ run ] triggered by Bot. Commit: |
|
PR_Github #38104 [ run ] completed with state |
|
Test comment from Claude Code - please ignore. |
|
/bot run --disable-fail-fast |
2 similar comments
|
/bot run --disable-fail-fast |
|
/bot run --disable-fail-fast |
|
PR_Github #38121 [ run ] triggered by Bot. Commit: |
|
PR_Github #38122 [ run ] triggered by Bot. Commit: |
|
PR_Github #38121 [ run ] completed with state |
|
PR_Github #38122 [ run ] completed with state |
Description
This test was fixed in #7478 but was broken by #7993 because the latter PR moved the next_layer_layernorm setting logic from load_weights() to post_load_weights() but the test definition was not updated. The failure was hidden because we did not upgrade transformers version yet.
To fix this, remember to call post_load_weights() after load_weights() in test definition (post_load_weights() is called automatically if the users are using pyexecutor). Also, handle the case where post_load_weights() is never called.
By Claude Code:
Summary by CodeRabbit
Bug Fixes
post_load_weights()is not called afterload_weights(), improving failure clarity.Tests
✏️ Tip: You can customize this high-level summary in your review settings.
Test Coverage
TestLlama4MinLatency::test_llama_allclose_to_hf
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
Update tava architecture diagram if there is a significant design change in PR.
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.
Details
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-listparameter 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.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip 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-pipelineReuse 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.