You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Restore runtime LoRA tensor counts in DGL. Log the applied count by model component and adapter file after execution, and warn when incompatible tensors are skipped.
Reset the counters after reporting so each sampling run produces one summary per adapter.
If this PR adds or changes model support, I have added or updated its usage guide and relevant model index/README entries following the model documentation requirements.
Summary by CodeRabbit
Improvements
Automatic LoRA mode now applies unquantized weights immediately when using the compute backend without row splitting, and applies LoRA at runtime for quantized, offloaded, or row-split weights.
LoRA adapter reports show clearer counts of applied and incompatible tensors, with optional component labels.
Runtime reporting captures adapter statistics when tensors were applied or skipped as incompatible.
No actionable comments were generated in the recent review.
Walkthrough
Automatic LoRA mode selection now uses row-split status, backend placement, and tensor metadata. Model integrations and documentation use the resolved selection rules. LoRA execution also updates statistics reporting and tracking cleanup.
Changes: LoRA Mode and Execution
Layer / File(s)
Summary
Mode resolution and model integration src/dgl/models/lora.h, src/dgl/models/lora.cpp, src/dgl/models/model_runtime.cpp, src/dgl/models/model_base.h, src/dgl/models/model_base.cpp, src/dgl/model_value.cpp, src/dgl/models/detail_detector.cpp, src/dgl/models/upscaler.cpp, docs/dgl.md, docs/models/lora.md, examples/common/common.cpp
Automatic mode selection now considers row splitting, backend placement, and tensor quantization metadata. Runtime model setup, detector and upscaler integrations, and the related documentation use the resolved mode rules.
Statistics reporting src/model/adapter/lora.hpp
LoraModel::stat accepts an optional component label and reports compatible and incompatible tensor counts. Unused-tensor and incomplete-application warnings remain limited to non-runtime calls.
prepare stores the backend module. At execution end, the code records statistics and clears applied and skipped-incompatible tensor tracking when an adapter exists and either list is nonempty, then ends each model runner.
sequenceDiagram
participant ModelRuntime
participant ModelLoader
participant SDBackendManager
participant resolve_lora_mode
ModelRuntime->>ModelLoader: inspect stored tensor metadata
ModelRuntime->>SDBackendManager: inspect backend placement
ModelRuntime->>resolve_lora_mode: provide mode and row-split status
resolve_lora_mode-->>ModelRuntime: return resolved mode
Loading
Suggested reviewers:wbruna
Merge Risk: Minimal · up to 4cba5
This change unifies automatic LoRA mode selection, updates the documentation to match, and adds per-component LoRA tensor count reporting. No concrete merge-blocking issue was found. Normal build and runtime checks are still advisable.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix: restore runtime LoRA tensor counts" names the main change. The raw summary and PR description both show the change restores runtime LoRA tensor count logging by model component and ada…
Description check
The description follows the repository template. It includes Summary, Related Issue / Discussion, Additional Information, and Checklist sections. The Summary explains the change: runtime LoRA tensor c…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix: restore runtime LoRA tensor counts" names the main change. The raw summary and PR description both show the change restores runtime LoRA tensor count logging by model component and adapter, with warnings for skipped incompatible tensors and counter reset after reporting. The title is specific and concise. The summary also covers a mode-resolution refactor (resolve_lora_mode, auto mode selection) from the commit message, which the title does not mention. That gap is partial, not a mismatch.
Full details: Description check
Explanation
The description follows the repository template. It includes Summary, Related Issue / Discussion, Additional Information, and Checklist sections. The Summary explains the change: runtime LoRA tensor count logging per component and adapter, incompatible-tensor warnings, and counter reset after each run. Related Issue is marked N/A, and Additional Information is marked N/A. Both checklist items are checked. The description does not mention the auto-mode resolution refactor, the documentation updates for auto mode, or the removal of the persistent argument. These omissions are non-critical for the pass decision but reduce reviewer context.
Resolution
Optionally add a note to the Summary that describes the auto LoRA mode unification (resolve_lora_mode) and the related documentation changes, because the diff changes user-facing auto-mode behavior.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
Cppcheck (2.22.0)
Cppcheck (2.22.0) exceeded its 180-second time budget. Findings from completed work are retained; remaining checks are incomplete.
src/dgl/models/model_runtime.cpp
Cppcheck interrupted; analysis of this file is incomplete
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 7a424ebb-f293-432c-9358-6ecdfa2bdfcf
Commits
Reviewing files that changed from the base of the PR and between 7001abe and 4cba5db.
Files selected for processing: 11
docs/dgl.md
docs/models/lora.md
examples/common/common.cpp
src/dgl/model_value.cpp
src/dgl/models/detail_detector.cpp
src/dgl/models/lora.cpp
src/dgl/models/lora.h
src/dgl/models/model_base.cpp
src/dgl/models/model_base.h
src/dgl/models/model_runtime.cpp
src/dgl/models/upscaler.cpp
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related Issue / Discussion
N/A
Additional Information
N/A
Checklist
Summary by CodeRabbit