Skip to content

fix(glm4v): bump backend_equivalence_atol to 0.5 for Pillow 13 compatibility - #50170

Merged
ydshieh merged 1 commit into
mainfrom
fix-glm4v-pillow13-atol
Oct 30, 2026
Merged

ydshieh merged 1 commit into
mainfrom
fix-glm4v-pillow13-atol

Conversation

@ydshieh

@ydshieh ydshieh commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

🤗 Transformers CI

What does this PR do?

Follow-up to #50105 — missed glm4v in the original fix.

Pillow >= 13 changed the order of bicubic resize passes (see python-pillow/Pillow#9549): it now sometimes resizes vertically first when height shrinks substantially more than width, producing slightly different pixel values when comparing PIL vs torchvision backends.

This causes test_backends_equivalence_batched to exceed the default atol=0.1 by a tiny margin (observed: 0.1022 > 0.1). Bumping backend_equivalence_atol to 0.5 (same fix as #50105) resolves it.

Verified on runner with Pillow 13.0.0: ✅ PASS

…ibility

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: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

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

run-slow: glm4v

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@ydshieh
ydshieh merged commit 27ae491 into main Oct 30, 2026
35 checks passed
@ydshieh
ydshieh deleted the fix-glm4v-pillow13-atol branch October 30, 2026 14:32
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>
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.

2 participants