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 ViT-MAE decoder interpolate #33330

Merged
merged 3 commits into from
Sep 30, 2024
Merged

Fix ViT-MAE decoder interpolate #33330

merged 3 commits into from
Sep 30, 2024

Conversation

xenova
Copy link
Contributor

@xenova xenova commented Sep 5, 2024

What does this PR do?

Similar to #33226, with a fix for the ViT-MAE decoder (see comment).

Fixes #32410

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.

@amyeroberts

@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 another speedy and clean fix!

@xenova
Copy link
Contributor Author

xenova commented Sep 6, 2024

I'll add a unit test and then merge 👍

@xenova
Copy link
Contributor Author

xenova commented Sep 30, 2024

Apologies for the delay - totally forgot about this! 😅

Before:

FAILED tests/models/vit_mae/test_modeling_vit_mae.py::ViTMAEModelIntegrationTest::test_inference_interpolate_pos_encoding_custom_sizes - RuntimeError: The size of tensor a (257) must match the size of tensor b (256) at non-singleton dimension 1

After:

34 passed, 114 skipped, 4 warnings in 8.80s

@amyeroberts can we trigger slow tests and then I'll merge? :) Thanks! nvm I was able to do it! Just re-requesting review to check that I did the unit tests right.

@HuggingFaceDocBuilderDev

This comment was marked as duplicate.

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.

Looks great - thanks!

@xenova xenova merged commit 18c5b21 into main Sep 30, 2024
20 checks passed
@xenova xenova deleted the fix-vit-mae-interpolation branch September 30, 2024 16:47
dataKim1201 pushed a commit to dataKim1201/transformers that referenced this pull request Oct 7, 2024
* Fix ViT-MAE decoder interpolate

* Add unit test for `interpolate_pos_encoding` w/ custom sizes

* [run_slow] vit_mae
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.

Potential error in num_patches calculation in src/transformers/models/vit_mae/modeling_vit_mae.py
3 participants