Repository navigation
Use deep copies instead of shallow copies for bbox_embed in GroundingDINO decoder (#37333). - #38999
Closed
rabibastinj wants to merge 1 commit into
Closed
rabibastinj wants to merge 1 commit into
rabibastinj wants to merge 1 commit into
Conversation
Member
|
cc @qubvel, but @rabibastinj please delete the tests that copilot added - we don't want to add whole new test files just for this! |
ArthurZucker
reviewed
Jul 1, 2025
| input_dim=config.d_model, hidden_dim=config.d_model, output_dim=4, num_layers=3 | ||
| ) | ||
| self.bbox_embed = nn.ModuleList([shared_head] * config.decoder_layers) | ||
| #self.bbox_embed = nn.ModuleList([shared_head] * config.decoder_layers) |
Collaborator
There was a problem hiding this comment.
why not remove the comment?
This was referenced Apr 29, 2026
Collaborator
|
Thanks a lot for the PR! This was superseded by #38238, which landed on main and covers the same change, so closing this one. |
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.
Fixes #37333
The decoder was using shallow copies of
GroundingDinoMLPPredictionHead, causing allbbox_embedlayers to share the same instance, which led to unintended parameter sharing. This PR updates it to usecopy.deepcopy().What I Changed
copy.deepcopy()whendecoder_bbox_embed_share=True.tests/models/Rabi_Testcases/:GD_Unique_Instances_Testcase.py– verifies each decoder layer gets a unique instanceGD_Layer_Independency_Testcase.py– ensures that modifying one layer does not affect anotherTesting
pytest tests/models/Rabi_Testcases/