Skip to content
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

[GroundingDino] Adding ms_deform_attn kernels #30768

Merged

Conversation

EduardoPach
Copy link
Contributor

What does this PR do?

This PR fixes #30765 (comment) by adding the missing ms_deformable_attn kernels to GroundingDino

Who can review it?

@NielsRogge

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@EduardoPach EduardoPach changed the title Adding ms_deform_attn kernels to GroundingDino [GroundingDino] Adding ms_deform_attn kernels May 12, 2024
@@ -0,0 +1,40 @@
/*!
**************************************************************************************************
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need new kernels for Grounding DINO? Can't we reuse the ones from Deformable DETR? https://github.com/huggingface/transformers/tree/main/src/transformers/kernels/deformable_detr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, but then the same would be true to Deta https://github.com/huggingface/transformers/tree/main/src/transformers/kernels/deta as it's just a copy and paste

Copy link
Contributor

@NielsRogge NielsRogge May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, tbh I have no idea why they were duplicated for Deta if they're exactly the same as Deformable DETR.

So I'd advocate to just share the kernel among these 3 models in case they're the same (pinging @amyeroberts here).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were probably duplicated because the kernels used to live at the model level i.e. src/transformers/models/model_name/ - and there shouldn't be imports from one modeling file to another.

Happy to have them shared i.e. grounding DINO just points to deformable DETR kernels in the modeling file.

There's a possible issue where changes might be made to the kernels to e.g. update deformable DETR which isn't compatible with other dependant models. This would effectively be hidden as it's not obvious from the kernel paths here. The likelihood of this happening is so low, I think we can just ignore it for the moment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GroundingDino pointing to DeformableDetr kernels here bc1f8cb

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing!

@amyeroberts amyeroberts merged commit 453893e into huggingface:main May 13, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grounding DINO missing custom kernels
4 participants