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

Add do_convert_rgb to vit #34523

Merged
merged 8 commits into from
Nov 19, 2024

Conversation

jp1924
Copy link
Contributor

@jp1924 jp1924 commented Oct 31, 2024

What does this PR do?

While resolving issue #34301, discovered that ViT lacks do_rgb_convert.

Therefore, added do_rgb_convert to ViTImageProcessor.

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?

@amyeroberts, @qubvel

Copy link
Member

@qubvel qubvel left a comment

Choose a reason for hiding this comment

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

Hi @jp1924, thanks for adding this feature! To make it complete we also have to update VitImageProcessorFast to be compatible with this image processor. Please have a look if there is a required transform in torchvision or use Lambda transform. Thanks!

src/transformers/models/vit/image_processing_vit.py Outdated Show resolved Hide resolved
src/transformers/models/vit/image_processing_vit.py Outdated Show resolved Hide resolved
src/transformers/models/vit/image_processing_vit.py Outdated Show resolved Hide resolved
@jp1924
Copy link
Contributor Author

jp1924 commented Nov 7, 2024

Thanks for the advice @qubvel! That worked out well.

I wrote that type_hint with reference to siglip, should I modify siglip as well?

@jp1924 jp1924 requested a review from qubvel November 7, 2024 00:43
Copy link
Member

@qubvel qubvel left a comment

Choose a reason for hiding this comment

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

Hi @jp1924, thanks for the update! For fast image processor we also should add a transform that do RGB conversion, not only an argument.

@jp1924
Copy link
Contributor Author

jp1924 commented Nov 12, 2024

@qubvel
Oh..... I thought I added do_convert_rgb to the fast processor, but I only added it to the arg??? haha😂
Thanks for letting me know!

@jp1924 jp1924 requested a review from qubvel November 12, 2024 00:49
@qubvel qubvel added run-slow and removed run-slow labels Nov 15, 2024
Copy link
Member

@qubvel qubvel 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 the update! Looks good to me!

@qubvel qubvel requested a review from ArthurZucker November 15, 2024 23:29
@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

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

LGTM but as this was not requested before I am not entirely sure it will be used! 🤗

@ArthurZucker ArthurZucker merged commit fdb9230 into huggingface:main Nov 19, 2024
21 checks passed
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
* Add: do_convert_rgb

* Add: doc string

* Update src/transformers/models/vit/image_processing_vit.py

Co-authored-by: Pavel Iakubovskii <[email protected]>

* Update src/transformers/models/vit/image_processing_vit.py

Co-authored-by: Pavel Iakubovskii <[email protected]>

* Update src/transformers/models/vit/image_processing_vit.py

Co-authored-by: Pavel Iakubovskii <[email protected]>

* Add: do_convert_rgb to fast

* Add: convert_to_rgb

---------

Co-authored-by: Pavel Iakubovskii <[email protected]>
BernardZach pushed a commit to innovationcore/transformers that referenced this pull request Dec 6, 2024
* Add: do_convert_rgb

* Add: doc string

* Update src/transformers/models/vit/image_processing_vit.py

Co-authored-by: Pavel Iakubovskii <[email protected]>

* Update src/transformers/models/vit/image_processing_vit.py

Co-authored-by: Pavel Iakubovskii <[email protected]>

* Update src/transformers/models/vit/image_processing_vit.py

Co-authored-by: Pavel Iakubovskii <[email protected]>

* Add: do_convert_rgb to fast

* Add: convert_to_rgb

---------

Co-authored-by: Pavel Iakubovskii <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants