Skip to content

Conversation

yonigozlan
Copy link
Member

What does this PR do?

Use a custom center_crop function to be equivalent to the one used in slow processors.
The only difference with torchvision one is that instead of using int(round(..)) to define crop_top and crop_left, which round towards the even number, we just use int(...) to always round down.
Thanks @rootonchair for adding this first to bridgetower image processor!

Slightly breaking as it will change current results from fast image processors using center_crop

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

Thanks.
If it is breaking, add a 🔴
If it is a bug fix (because slow is quite standard) then still add the red because its quite important no?

Lastly, I only see 1 test being uskipped, wondering if some perceiver were failing and are now fixed or where they skipped?

@yonigozlan
Copy link
Member Author

Lastly, I only see 1 test being uskipped, wondering if some perceiver were failing and are now fixed or where they skipped?

The 1 test unskipped is a common test so it was also skipped for perceiver! In total it's unskipped for around 10 processors, which were all using center_crop by default

@yonigozlan yonigozlan changed the title Make center_crop fast equivalent to slow 🔴Make center_crop fast equivalent to slow Sep 15, 2025
@yonigozlan yonigozlan requested review from ArthurZucker and removed request for Cyrilvallez September 15, 2025 14:52
@yonigozlan yonigozlan enabled auto-merge (squash) September 16, 2025 15:52
Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: chinese_clip, perceiver

@yonigozlan yonigozlan merged commit beb09cb into huggingface:main Sep 16, 2025
23 checks passed
ErfanBaghaei pushed a commit to ErfanBaghaei/transformers that referenced this pull request Sep 25, 2025
make center_crop fast equivalent to slow
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/transformers that referenced this pull request Oct 2, 2025
make center_crop fast equivalent to slow
yuchenxie4645 pushed a commit to yuchenxie4645/transformers that referenced this pull request Oct 4, 2025
make center_crop fast equivalent to slow
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.

3 participants