[TRTLLM-12529][feat] Graceful exit when lora unsupported#13869
[TRTLLM-12529][feat] Graceful exit when lora unsupported#13869brb-nv wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
Signed-off-by: Balaram Buddharaju <169953907+brb-nv@users.noreply.github.com>
📝 WalkthroughWalkthroughThis PR introduces LoRA target-module validation to prevent unsupported configurations. A new exception class and validation function scan models for registered LoRA layers, resolve target names through a canonical registry, and raise exceptions with informative messages when targets are unsupported or unknown. The executor integrates this validation before LoRA binding. Unit tests verify the function with a minimal attention-only model; integration tests validate multi-LoRA generation on Qwen MoE and confirm fail-fast rejection of per-expert targets. ChangesLoRA Target Module Validation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tensorrt_llm/_torch/peft/lora/layer.py (1)
568-569: 💤 Low valuePrefer built-in generic types over legacy
typingequivalents.Per Python 3.10+ guidelines, use
dict[str, int]andlist[str]instead ofDict[str, int]andList[str].♻️ Suggested fix
- requested: Dict[str, int] = {} - unknown: List[str] = [] + requested: dict[str, int] = {} + unknown: list[str] = []🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tensorrt_llm/_torch/peft/lora/layer.py` around lines 568 - 569, Replace the legacy typing generics with built-in generics for the variables declared in layer.py: change the type annotations of requested and unknown from Dict[str, int] and List[str] to dict[str, int] and list[str] respectively (update any matching declarations or variable annotations in the scope where requested and unknown are defined, e.g., the assignments in _torch/peft/lora/layer.py). Also remove or adjust any unused imports from typing if Dict/List are no longer used elsewhere in the file.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tensorrt_llm/_torch/peft/lora/layer.py`:
- Around line 568-569: Replace the legacy typing generics with built-in generics
for the variables declared in layer.py: change the type annotations of requested
and unknown from Dict[str, int] and List[str] to dict[str, int] and list[str]
respectively (update any matching declarations or variable annotations in the
scope where requested and unknown are defined, e.g., the assignments in
_torch/peft/lora/layer.py). Also remove or adjust any unused imports from typing
if Dict/List are no longer used elsewhere in the file.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: cbed61a6-f278-4683-9a59-64cb584c704c
📒 Files selected for processing (4)
tensorrt_llm/_torch/peft/lora/layer.pytensorrt_llm/_torch/pyexecutor/_util.pytests/unittest/_torch/lora/test_lora.pytests/unittest/_torch/modules/tests_lora_modules/test_moe_multi_lora.py
|
/bot run --disable-fail-fast |
|
PR_Github #47261 [ run ] triggered by Bot. Commit: |
|
PR_Github #47261 [ run ] completed with state |
|
/bot run --disable-fail-fast |
|
PR_Github #47292 [ run ] triggered by Bot. Commit: |
|
PR_Github #47292 [ run ] completed with state
|
Description
This MR enables graceful exit when LoRA is not supported for a module. Also, adds a few tests for multi-lora with MoE models.
Previously:
Now. Exception is raised during worker initialization.
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
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
To see a list of available CI bot commands, please comment
/bot help.Summary by CodeRabbit
Release Notes
New Features
Tests