Fix RT-DETR indexing error when num_feature_levels exceeds backbone o…#46833
Open
c1prk wants to merge 3 commits into
Open
Fix RT-DETR indexing error when num_feature_levels exceeds backbone o…#46833c1prk wants to merge 3 commits into
c1prk wants to merge 3 commits into
Conversation
Contributor
|
CI Dashboard: View test results in Grafana |
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: d_fine, pp_doclayout_v2, rt_detr, rt_detr_v2 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Fixes a
TypeErrorinRTDetrModel.forwardthat occurs whennum_feature_levelsis set higher than the number of backbone output levels (default is 3).When extra decoder feature levels need to be synthesized, the first extra level passed the entire list of encoder feature maps to a
Conv2dlayer and indexed[-1]on the result, instead of indexing[-1]on the input list first to select a single tensor. The corrected line now matches the pattern already used correctly on the very next line of the same block.The change is made in
modular_rt_detr.py(the source of truth) andmodeling_rt_detr.pyis regenerated from it. The default config (num_feature_levels=3) is unaffected, so no existing behavior changes. A regression test was added that builds the model withnum_feature_levels=4and confirms the forward pass returns logits of the expected shape.AI assistance was used to help diagnose and draft this fix; I reviewed and verified every changed line and reproduced both the bug and the fix myself.
Fixes #46832
Code Agent Policy
Before submitting
Test results
(passes locally)
Who can review?
@yonigozlan @molbap