-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding grounding dino #26087
Merged
amyeroberts
merged 274 commits into
huggingface:main
from
EduardoPach:adding-grounding-dino
Apr 11, 2024
Merged
Adding grounding dino #26087
Changes from 1 commit
Commits
Show all changes
274 commits
Select commit
Hold shift + click to select a range
6e37211
Fixed typo when converting weigths to GroundingDINO vision backbone
EduardoPach 0db05e0
Final modifications on modeling
EduardoPach a1eba2e
Removed unnecessary class
EduardoPach 9cf7c3a
Fixed convert structure
EduardoPach 9c55b24
Added image processing
EduardoPach ae570bb
make fixup partially completed
EduardoPach 1f6475f
Now text_backbone_config has its own class
EduardoPach d763e04
Modified convert script
EduardoPach 04022d4
Removed unnecessary config attribute
EduardoPach 938f805
Added new function to generate sub sentence mask
EduardoPach 6f08b04
Renamed parameters with gamma in the name as it's currently not allowed
EduardoPach 7666253
Removed tokenization and image_processing scripts since we'll map fro…
EduardoPach 046e0c5
Fixed some issues with configuration
EduardoPach 70b248d
Just some modifications on conversion script
EduardoPach 3bc92b7
Other modifications
EduardoPach 4cae0ca
Copied deformable detr
EduardoPach 149b462
First commit
EduardoPach 92c31bf
Added bert to model
EduardoPach 8f0a755
Bert validated
EduardoPach fb1c55c
Created Text and Fusion layers for Encoder
EduardoPach 86131af
Adapted Encoder layer
EduardoPach 8ad3226
Fixed typos
EduardoPach 21e3fa2
Adjusted Encoder
EduardoPach 5ddfa38
Converted encoder to hf
EduardoPach 0512f7a
Modified Decoder Layer
EduardoPach d2cd35f
Modified main decoder class
EduardoPach cb2ad7f
Removed copy comments
EduardoPach eaf958d
Fixed forward from GroundingDINOModel and GroundingDINODecoder
EduardoPach 88d07b3
Added all necessary layers, configurations and forward logic up to Gr…
EduardoPach f17bd3d
Added all layers to convertion
EduardoPach dcd1990
Fixed outputs for GroundingDINOModel and GroundingDINOForObjectDetection
EduardoPach 39a161c
Fixed mask input to encoders and fixed nn.MultiheadAttention batch fi…
EduardoPach 5ec72fb
Fixed forward from GroundingDINOTextEnhancerLayer
EduardoPach 086f68a
Fixed output bug with GroundingDINODeformableLayer
EduardoPach f75cda2
Fixed bugs that prevent GroundingDINOForObjectDetection to run forwar…
EduardoPach 8dbed3d
Fixed attentions to be passed correctly
EduardoPach a2af172
Passing temperature arg when creating Sine position embedding
EduardoPach 759fc14
Removed copy comments
EduardoPach 5196373
Added temperature argument for position embedding
EduardoPach 900cff4
Fixed typo when converting weigths to GroundingDINO vision backbone
EduardoPach f23a54a
Final modifications on modeling
EduardoPach 3090b2c
Removed unnecessary class
EduardoPach 5c19e75
Fixed convert structure
EduardoPach aec2f68
Added image processing
EduardoPach b7a79cd
make fixup partially completed
EduardoPach 685f1d6
Now text_backbone_config has its own class
EduardoPach d6e88fc
Modified convert script
EduardoPach 0242e57
Removed unnecessary config attribute
EduardoPach af06c85
Added new function to generate sub sentence mask
EduardoPach 43c0ce5
Renamed parameters with gamma in the name as it's currently not allowed
EduardoPach 2bb7b70
Removed tokenization and image_processing scripts since we'll map fro…
EduardoPach 98f3840
Fixed some issues with configuration
EduardoPach 703eeff
Just some modifications on conversion script
EduardoPach c1c1467
Other modifications
EduardoPach bfb8829
Fix style
NielsRogge 587589e
Improve fixup
NielsRogge f683611
Improve conversion script
NielsRogge 3a0c742
Improve conversion script
NielsRogge 6115547
Add GroundingDINOProcessor
NielsRogge cc1788f
More improvements
NielsRogge a6dea4a
Return token type ids
NielsRogge ae6e110
something
EduardoPach 9fba8c2
Fix more tests
NielsRogge 684a0bb
More improvements
NielsRogge 3b2d576
More cleanup
NielsRogge 88e5d02
More improvements
NielsRogge 55390d1
Merge branch 'adding-grounding-dino' of https://github.com/EduardoPac…
EduardoPach 8bae1bd
Fixed tests, improved modeling and config
EduardoPach f343f78
More improvements and fixing tests
EduardoPach 033d903
Improved tests and modeling
EduardoPach baed29a
Improved tests and added image processor
EduardoPach 50c5f67
Improved tests inference
EduardoPach d2922e1
More improvements
EduardoPach 891c34d
More test improvements
EduardoPach eccaec9
Fixed last test
EduardoPach f32be01
Improved docstrings and comments
EduardoPach 1c657e2
Fix style
NielsRogge 1202ce8
Update src/transformers/models/grounding_dino/modeling_grounding_dino.py
EduardoPach d62dd11
Update src/transformers/models/grounding_dino/modeling_grounding_dino.py
EduardoPach bbf873b
Update src/transformers/models/grounding_dino/modeling_grounding_dino.py
EduardoPach c69b8a2
Update src/transformers/models/grounding_dino/modeling_grounding_dino.py
EduardoPach 274752c
Update src/transformers/models/grounding_dino/modeling_grounding_dino.py
EduardoPach 91373e0
Better naming
EduardoPach 4945883
Better naming
EduardoPach 5882f5f
Added Copied statement
EduardoPach c96a1a1
Added Copied statement
EduardoPach 558ad87
Moved param init from GroundingDINOBiMultiHeadAttention
EduardoPach 5c32bdc
Better naming
EduardoPach c561087
Fixing clamp style
EduardoPach 07d4c62
Better naming
EduardoPach ba37183
Update src/transformers/models/grounding_dino/modeling_grounding_dino.py
EduardoPach c746e1d
Update src/transformers/models/grounding_dino/modeling_grounding_dino.py
EduardoPach 07b260d
Update src/transformers/models/grounding_dino/configuration_grounding…
EduardoPach 898e072
Update src/transformers/models/grounding_dino/convert_grounding_dino_…
EduardoPach 34b36a3
Update src/transformers/models/grounding_dino/modeling_grounding_dino.py
EduardoPach e14d6ae
Improving conversion script
EduardoPach f867e50
Improved config
EduardoPach fc105be
Improved naming
EduardoPach ed1176e
Improved naming again
EduardoPach ef5c90f
Improved grouding-dino.md
EduardoPach b2fd868
Moved grounding dino to multimodal
EduardoPach c23497c
Update src/transformers/models/grounding_dino/convert_grounding_dino_…
EduardoPach a729a38
Fixed docstrings and style
EduardoPach aafcc34
Fix docstrings
NielsRogge e4bad9b
Remove timm attributes
NielsRogge e48d411
Reorder imports
NielsRogge a7f026f
More improvements
NielsRogge 1930b2a
Add Grounding DINO to pipeline
NielsRogge 6ac265c
Remove model from check_repo
NielsRogge 93b8609
Added grounded post_process to GroundingDINOProcessor
EduardoPach 6461389
Fixed style
EduardoPach e35f1c9
Fixed GroundingDINOTextPrenetConfig docstrings
EduardoPach 695ffa5
Aligned inputs.keys() when both image and text are passed with model_…
EduardoPach 7d16d7f
Added tests for GroundingDINOImageProcessor and GroundingDINOProcessor
EduardoPach 98321e3
Testing post_process_grounded_object_detection from GroundingDINOProc…
EduardoPach 3da62df
Fixed order
EduardoPach 6be9a68
Marked test with require_torch
EduardoPach cc1ee60
Temporarily changed repo_id
EduardoPach 8cf167e
More improvements
EduardoPach 27edb8e
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
EduardoPach 2927c13
Fix style
NielsRogge 42ee6bc
Final improvements
EduardoPach 85acfbc
Merge branch 'adding-grounding-dino' of https://github.com/EduardoPac…
EduardoPach e2b48b0
Improve annotators
NielsRogge 5e1f0d9
Fix style
NielsRogge c9a8440
Add is_torch_available
NielsRogge f954f4b
Remove type hints
NielsRogge 2eb2a98
vocab_tokens as one liner
EduardoPach 625123a
Removed print statements
EduardoPach 4553ad1
Renamed GroundingDINOTextPrenetConfig to GroundingDINOTextConfig
EduardoPach 3b6b2c2
remove unnecessary comments
EduardoPach afb2649
Removed unnecessary tests on conversion script
EduardoPach 4fdaf42
Renamed GroundingDINO to camel case GroundingDino
EduardoPach 559de31
Fixed GroundingDinoProcessor docstrings
EduardoPach fef983e
loading MSDA kernels in the modeling file
EduardoPach fbf82be
Fix merge
NielsRogge 9994ee0
Fix copies
NielsRogge 14c839d
Replace nn.multiheadattention
NielsRogge 5a6f258
Replace nn.multiheadattention
NielsRogge 9fa83da
Fixed inputs for GroundingDinoMultiheadAttention & order of modules
06ba0ec
Fixed processing to avoid messing with inputs
9cda12e
Added more tips for GroundingDino
bde2c6a
Make style
01c382e
Chaning name to align with SAM
5d1f0e7
Replace final nn.multiheadattention
NielsRogge 339915f
Fix model tests
NielsRogge 1bb4886
Update year, remove GenerationTesterMixin
NielsRogge 4bb58d3
Address comments
NielsRogge 2c5d4ea
Address more comments
NielsRogge f21162c
Rename TextPrenet to TextModel
NielsRogge 48f1734
Rename hidden_states
NielsRogge d3f45c3
Address more comments
NielsRogge 3134d39
Address more comments
NielsRogge 1485264
Address comment
NielsRogge c918fca
Merge branch 'adding-grounding-dino' of https://github.com/EduardoPac…
fc2251e
Merge branch 'adding-grounding-dino' of https://github.com/EduardoPac…
36c64be
Address more comments
NielsRogge 8f338dd
Address merge
NielsRogge a46c4f0
Address comment
NielsRogge a8a6bea
Address comment
NielsRogge 28686ec
Address comment
NielsRogge a3330ac
Make style
e9a45cb
Merge branch 'adding-grounding-dino' of https://github.com/EduardoPac…
21a1b4b
Added layer norm eps to layer norms
7292639
Address more comments
NielsRogge 6e51931
More fixes
d5481bb
Fixed equivalence
1fcf142
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
NielsRogge 098a59d
Make fixup
NielsRogge e005007
Remove print statements
NielsRogge daa29dc
Address comments
NielsRogge 7d4c763
Address comments
NielsRogge f52dd2d
Address comments
NielsRogge afb5c6e
Address comments
NielsRogge 4a88014
Address comments
NielsRogge 34e37b4
Address comments
NielsRogge 4854862
Add comment
NielsRogge c9fcadd
Address comment
NielsRogge 580ce27
Fix merge
NielsRogge 6366302
Remove overwriting of test
NielsRogge b5b1f1b
Fix bbox_embed
NielsRogge 9faa6b4
Improve decoder_bbox_embed_share
NielsRogge e7761f7
Simplify outputs
NielsRogge 09ae5c1
Updated post_process_grounded_object_detection
6036be6
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
9700e22
Renamed sources to feature_maps
66ebb6d
Improved tests for Grounding Dino ImageProcessor and Processor
1f4ffae
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
b27e7fb
Fixed test requirements and imports
17387df
Fixed image_processing
eed03aa
Fixed processor tests
3e8772a
Fixed imports for image processing tests
1682c0a
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
c549574
Fix copies
fdf7e82
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
EduardoPach 126dd83
Updated modeling
EduardoPach d24335b
Fix style
EduardoPach 7d6bd5b
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
EduardoPach 0b8f4e8
Moved functions to correct position
EduardoPach eafd39f
Fixed copy issues
EduardoPach fb1e202
Update src/transformers/models/deformable_detr/modeling_deformable_de…
EduardoPach 516de4a
Update src/transformers/models/grounding_dino/modeling_grounding_dino.py
EduardoPach 0ae3c5d
Update src/transformers/models/grounding_dino/modeling_grounding_dino.py
EduardoPach 7255f13
Keeping consistency custom cuda kernels for MSDA
EduardoPach 2fb611a
Make GroundingDinoProcessor logic clearer
EduardoPach 83004b7
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
EduardoPach c7a4ef0
Updated Grounding DINO checkpoints
EduardoPach baa1959
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
EduardoPach 03137fd
Changed tests to correct structure
EduardoPach 3ee2d78
Updated gpu-cpu equivalence test
EduardoPach 8361ffc
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
EduardoPach fcfad83
fix copies
EduardoPach ed7a71e
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
EduardoPach fe7cd12
Update src/transformers/models/grounding_dino/processing_grounding_di…
EduardoPach ebf136f
Update src/transformers/models/grounding_dino/processing_grounding_di…
EduardoPach 8728db6
Update src/transformers/models/grounding_dino/modeling_grounding_dino.py
EduardoPach 1be93d6
Update src/transformers/models/grounding_dino/configuration_grounding…
EduardoPach 0c99ac7
Fixed erros and style
EduardoPach 538e88f
Fix copies
EduardoPach 18d3d63
Removed inheritance from PreTrainedModel from GroundingDinoTextModel
EduardoPach b4735d5
Fixed GroundingDinoTextModel
EduardoPach 1cf5cf0
Fixed type of default backbone config
EduardoPach 88c0467
Fixed missing methods for GroundingDinoTextModel and Added timm suppo…
EduardoPach 2d95044
Addressed comments
EduardoPach 710c1be
Addressed batched image processing tests
EduardoPach 06a59b2
Addressed zero shot test comment
EduardoPach 2de4e15
Addressed tip comment
EduardoPach 0780569
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
EduardoPach 4b9c9ad
Removed GroundingDinoTextModel from check_repo
EduardoPach 4df56a4
Removed inplace masking
EduardoPach 0e0ae3c
Addressed comments
EduardoPach e8222f3
Addressed comments
EduardoPach 6cab49a
Addressed comments
EduardoPach 8012f13
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
EduardoPach 37b272f
Fix copies
EduardoPach d6966ce
Fixing timm test
EduardoPach 1a94461
Fixed batching equivalence test
EduardoPach a584f65
Update docs/source/en/model_doc/grounding-dino.md
EduardoPach a9dfee3
Update docs/source/en/model_doc/grounding-dino.md
EduardoPach 6f13fbb
Update docs/source/en/model_doc/grounding-dino.md
EduardoPach 2f845b0
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
EduardoPach a1e9ff0
Addressed more comments
EduardoPach 38a2e97
Added a new comment
EduardoPach e9633b4
Reduced image size
EduardoPach 89e070f
Addressed more comments
EduardoPach a961ab7
Nits
EduardoPach 6c2a617
Merge remote-tracking branch 'upstream/main' into adding-grounding-dino
EduardoPach f945c7a
Nits
EduardoPach b0891ca
Changed the way text_config is initialized
EduardoPach c630a9c
Update src/transformers/models/grounding_dino/processing_grounding_di…
EduardoPach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added all layers to convertion
- Loading branch information
commit f17bd3d6e5d6413613e24ee1777308c130523081
There are no files selected for viewing
This file contains 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like renaming with re.sub would simplify a bit. Mostly because you don't have to check if it's bias or weight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it's fine, I also do it this way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realise you're indicating that the code works, and the refactor might not be worth the effort, but this comes across as dismissive @NielsRogge.
@ArthurZucker is giving a helpful suggestion which will improve the code as well as make it easier for reviewers and future readers of this code. It's OK to say one is going to leave as-is if it's a lot of work and not a requirement from the reviewer, but it's also an opportunity to make things better. "Fine" isn't what we're striving for.