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

[cuda kernels] only compile them when initializing #29133

Merged
merged 12 commits into from
Feb 20, 2024
Merged

Conversation

ArthurZucker
Copy link
Collaborator

@ArthurZucker ArthurZucker commented Feb 20, 2024

What does this PR do?

Fixes #29130, from 1min to 6seconds

@ArthurZucker ArthurZucker changed the title only compile when needed [cuda kernels] only compile them when initializing Feb 20, 2024
@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.

@ArthurZucker ArthurZucker marked this pull request as ready for review February 20, 2024 10:59
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.

Great - thanks for fixing!

As long as the model tests pass in an env with ninja installed I think it's good to go!

@ArthurZucker
Copy link
Collaborator Author

I'll make sure of that before merging! Testing now!

@ArthurZucker
Copy link
Collaborator Author

ArthurZucker commented Feb 20, 2024

FAILED tests/models/deformable_detr/test_modeling_deformable_detr.py::DeformableDetrModelIntegrationTests::test_inference_object_detection_head - AssertionError: False is not true
FAILED tests/models/deformable_detr/test_modeling_deformable_detr.py::DeformableDetrModelIntegrationTests::test_inference_object_detection_head_equivalence_cpu_gpu - AssertionError: assert False
FAILED tests/models/deformable_detr/test_modeling_deformable_detr.py::DeformableDetrModelIntegrationTests::test_inference_object_detection_head_with_box_refine_two_stage - AssertionError: False is not true

failing. Logits do no match, failing on main as well

FAILED tests/models/deta/test_modeling_deta.py::DetaModelIntegrationTests::test_inference_object_detection_head - AssertionError: False is not true
FAILED tests/models/deta/test_modeling_deta.py::DetaModelIntegrationTests::test_inference_object_detection_head_swin_backbone - AssertionError: False is not true

failing as well on main. Merging

Yoso is alright

@ArthurZucker ArthurZucker merged commit 5e95dca into main Feb 20, 2024
18 checks passed
@ArthurZucker ArthurZucker deleted the fix-make-fixup branch February 20, 2024 11:39
@NielsRogge NielsRogge mentioned this pull request Feb 23, 2024
8 tasks

global MultiScaleDeformableAttention

root = Path(__file__).resolve().parent.parent.parent / "kernels" / "deta"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @ArthurZucker, was it intended for the root to be deta related?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@EduardoPach I think this is a copy-pasta. Would you like to open a PR to fix?

Copy link
Contributor

Choose a reason for hiding this comment

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

@amyeroberts, sure!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks

itazap pushed a commit that referenced this pull request May 14, 2024
* only compile when needed

* fix mra as well

* fix yoso as well

* update

* rempve comment

* Update src/transformers/models/deformable_detr/modeling_deformable_detr.py

* Update src/transformers/models/deformable_detr/modeling_deformable_detr.py

* opps

* Update src/transformers/models/deta/modeling_deta.py

* nit
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.

Move kernel compilation to init rather than at import stage
4 participants