Repository navigation
Fix image backend equivalence tests for Pillow 13 - #50105
Merged
Merged
Conversation
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: chinese_clip, cohere_compass, ernie4_5_vl_moe, flava, ovis2, paddleocr_vl, qwen2_vl, video_llama_3 |
Collaborator
Author
|
run-slow: chinese_clip, cohere_compass, ernie4_5_vl_moe, flava, ovis2, paddleocr_vl, qwen2_vl, video_llama_3 |
|
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. |
zucchini-nlp
approved these changes
Oct 29, 2026
zucchini-nlp
left a comment
Member
There was a problem hiding this comment.
fine by me to merge so we don't block pr ci. Arw these all affected models, I was expecting more 😅
Contributor
ydshieh
added a commit
that referenced
this pull request
Oct 30, 2026
…ibility (#50170) Pillow >= 13 changed the order of bicubic resize passes (vertical-first when height shrinks more than width), producing slightly different pixel values when compared against torchvision. Matches the fix applied to other models in #50105. Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
ydshieh
added a commit
that referenced
this pull request
Nov 9, 2026
…) (#50510) * Fix flaky backend equivalence tests with Pillow 13 (follow-up of #50105) Pillow >= 13 can reverse the order of the two bicubic resize passes, which gives isolated pixel differences vs torchvision above the default `atol=0.1`. #50105 (and #50170, #50327) set `backend_equivalence_atol = 0.5` for the affected models; bridgetower, poolformer, deepseek_ocr2, got_ocr2, hunyuan_vl and levit were missed. bridgetower, deepseek_ocr2 and got_ocr2 override the backend equivalence tests and call `_assert_tensors_equivalence` without `atol`, which ignored `backend_equivalence_atol`. Make the helper default to the class attribute (same value as before when it's not set), so those tests (and e.g. flava's `test_slow_fast_equivalence`) also use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Pass `backend_equivalence_atol` explicitly instead of changing the helper default Keep `_assert_tensors_equivalence` unchanged and pass `atol=self.backend_equivalence_atol` to the pixel value comparisons of the overridden backend equivalence tests (bridgetower, deepseek_ocr2, got_ocr2, and flava, which already sets `backend_equivalence_atol = 0.5`). Masks are still compared with the default tolerance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Per python-pillow/Pillow#9549 - Pillow 13.x changed the order of the two bicubic resize passes.
Previously, it resized horizontally, then vertically. It now sometimes resizes vertically first when the height shrinks substantially more than the width, to improve performance
That produces slightly different pixels and affects our tests when we're comparing PIL's output with Torchvision
This patch bumps
backend_equivalence_atolto0.5to match Pillow 13.x behavior.