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

Fix custom kernel for DeformableDetr, RT-Detr, GroundingDINO, OmDet-Turbo in Pytorch 2.6.0 #35979

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

qubvel
Copy link
Member

@qubvel qubvel commented Jan 31, 2025

What does this PR do?

Updates

  • tesnor.type().is_cuda() -> tesnor.is_cuda();
  • tensor.data<...> -> tensor.data_ptr<...>

The following message appears in logs:

Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) 
is a drop-in replacement. If you were using data from type(), that is now available from Tensor 
itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of 
tensor.type().backend() use tensor.device().

Fixes #35976

Might be relevant:

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@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.

@qubvel
Copy link
Member Author

qubvel commented Jan 31, 2025

run-slow: rt-detr, deformable_detr, omdet-turbo

Copy link

This comment contains run-slow, running the specified jobs: ['models/deformable_detr'] ...

@qubvel qubvel added the Vision label Jan 31, 2025
@qubvel qubvel changed the title Updates deprecated code in DeformableDetr custom kernel FIx custom kernel for DeformableDetr, RT-Detr, GroindingDINO, OmDet-Turbo Jan 31, 2025
@qubvel qubvel changed the title FIx custom kernel for DeformableDetr, RT-Detr, GroindingDINO, OmDet-Turbo Fix custom kernel for DeformableDetr, RT-Detr, GroindingDINO, OmDet-Turbo in Pytorch 2.6.0 Jan 31, 2025
@qubvel qubvel marked this pull request as ready for review January 31, 2025 13:08
@qubvel
Copy link
Member Author

qubvel commented Jan 31, 2025

cc @molbap @ArthurZucker for review

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Thanks!

@qubvel qubvel merged commit 9c02cb6 into huggingface:main Feb 4, 2025
12 checks passed
@felifri
Copy link

felifri commented Feb 5, 2025

Thanks so much for the fix! can you change the name GroindingDINO to GroundingDINO?

@qubvel qubvel changed the title Fix custom kernel for DeformableDetr, RT-Detr, GroindingDINO, OmDet-Turbo in Pytorch 2.6.0 Fix custom kernel for DeformableDetr, RT-Detr, GroundingDINO, OmDet-Turbo in Pytorch 2.6.0 Feb 5, 2025
@qubvel
Copy link
Member Author

qubvel commented Feb 5, 2025

Done! Thanks 🤗

elvircrn pushed a commit to elvircrn/transformers that referenced this pull request Feb 13, 2025
…urbo in Pytorch 2.6.0 (huggingface#35979)

Updates type().is_cuda() -> .is_cuda(); .data<> -> .data_ptr<>
sbucaille pushed a commit to sbucaille/transformers that referenced this pull request Feb 16, 2025
…urbo in Pytorch 2.6.0 (huggingface#35979)

Updates type().is_cuda() -> .is_cuda(); .data<> -> .data_ptr<>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deformable DETR custom kernel fails to compile with PyTorch 2.6
4 participants