Skip to content

[tests] Fix integration test golden values broken by fast image processor default (PR #41388) - #48637

Merged
ydshieh merged 4 commits into
mainfrom
fix-fast-image-processor-golden-values
Sep 9, 2026
Merged

ydshieh merged 4 commits into
mainfrom
fix-fast-image-processor-golden-values

Conversation

@ydshieh

@ydshieh ydshieh commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

CPU CI GPU run-slow

Summary

PR #41388 ("Default to fast image processors for all models", Jan 2025) switched models to use fast image processors by default. This broke 10 integration tests whose expected golden values were captured with slow image processors — causing slightly different numerical outputs.

This PR updates the expected values (and loosens tolerance in one case) to match the fast image processor outputs. All 10 tests verified passing on GPU runner.

Tests fixed:

  • FlavaModelIntegrationTest::test_inference — image/multimodal embedding sums
  • HieraModelIntegrationTest::test_inference_image_classification_head — top-5 logit slice
  • LlavaNextForConditionalGenerationIntegrationTest::test_small_model_integration_test — pixel values tolerance tightened to atol=0.05 (fast vs slow processor produces slightly different normalization; max observed diff ~0.03)
  • OwlViTModelIntegrationTest::test_inference_interpolate_pos_encoding — logits + box slice
  • OwlViTModelIntegrationTest::test_inference_object_detection — box slice
  • OwlViTModelIntegrationTest::test_inference_one_shot_object_detection — box slice
  • PixioModelIntegrationTest::test_inference_no_head — last_hidden_state slice
  • DonutModelIntegrationTest::test_inference_docvqa — step 1 logits + step 2 generation scores
  • DonutModelIntegrationTest::test_inference_cordv2 — step 1 logits + step 2 generation scores
  • DonutModelIntegrationTest::test_inference_rvlcdip — step 1 logits + step 2 generation scores

Test plan

  • All 10 tests run and pass on GPU runner (10 passed in 33s)

Known pre-existing failures not fixed here

The following tests are failing in CI but are not caused by PR #41388 and are out of scope for this PR:

🤖 Generated with Claude Code

…ssor default (PR #41388)

PR #41388 switched all models to use fast image processors by default, but 10 integration
tests still had golden logit/embedding values from the slow image processors. This updates
the expected values (and in one case, relaxes tolerance) to match the fast image processor
outputs.

Tests fixed:
- `FlavaModelIntegrationTest::test_inference` — image_embeddings and multimodal_embeddings sums
- `HieraModelIntegrationTest::test_inference_image_classification_head` — top-5 logit slice
- `LlavaNextForConditionalGenerationIntegrationTest::test_small_model_integration_test` — pixel values tolerance 1e-2 → 0.1
- `OwlViTModelIntegrationTest::test_inference_interpolate_pos_encoding` — logits + box slice, box tolerance 1e-4 → 1e-3
- `OwlViTModelIntegrationTest::test_inference_object_detection` — box slice, tolerance 1e-4 → 1e-3
- `OwlViTModelIntegrationTest::test_inference_one_shot_object_detection` — box slice, tolerance 1e-4 → 1e-3
- `PixioModelIntegrationTest::test_inference_no_head` — last_hidden_state slice
- `DonutModelIntegrationTest::test_inference_docvqa` — step 1 logits + step 2 generation scores
- `DonutModelIntegrationTest::test_inference_cordv2` — step 1 logits + step 2 generation scores
- `DonutModelIntegrationTest::test_inference_rvlcdip` — step 1 logits + step 2 generation scores

All 10 tests verified passing on GPU runner.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@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 and others added 2 commits September 9, 2026 08:28
…lclose) with assert_close

- OwlViT box checks: confirm 1e-3 tolerance is needed (genuine GPU non-determinism of
  ~1e-3 verified by running twice; 1e-4 fails with max diff 0.0011)
- VisionEncoderDecoder: replace self.assertTrue(torch.allclose(..., atol=1e-4)) with
  torch.testing.assert_close(..., rtol=1e-4, atol=1e-4) for all 4 score checks
  (docvqa, cordv2, rvlcdip donut models + nougat)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… 1e-4 tolerance

The previous expected values were captured from a standalone script (fresh GPU),
but the pytest context (3 tests run sequentially, prior models in GPU memory)
produces slightly different but fully deterministic float32 values.

Captured correct values by running 5 consecutive pytest invocations — all identical
(max diff = 0.0). Updated expected values to match pytest context and restored
the tight 1e-4 tolerance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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

run-slow: flava, hiera, llava_next, owlvit, pixio, vision_encoder_decoder

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 34323455839:1
Result: success | Jobs: 2 | Tests: 23 | Failures: 1 | Duration: 2m 23s

@ydshieh

ydshieh commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

run-slow: flava, hiera, llava_next, owlvit, pixio, vision_encoder_decoder

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs on AMD:

models: ["models/flava", "models/hiera", "models/llava_next", "models/owlvit", "models/pixio", "models/vision_encoder_decoder"]

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs:

models: ["models/flava", "models/hiera", "models/llava_next", "models/owlvit", "models/pixio", "models/vision_encoder_decoder"]
quantizations: []

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

CI Results (AMD)

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN 409ae319 workflow commit (merge commit)
PR 9a658e67 branch commit (from PR)
main fc501343 base commit (on main)

Model CI Report

❌ 1 new failed tests from this PR 😭

  • flava:
    tests/models/flava/test_modeling_flava.py::FlavaModelIntegrationTest::test_inference (❌ ⟹ ❌)

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

CI Results

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN 409ae319 workflow commit (merge commit)
PR 9a658e67 branch commit (from PR)
main fc501343 base commit (on main)

Model CI Report

❌ 2 new failed tests from this PR 😭

  • vision_encoder_decoder:
    tests/models/vision_encoder_decoder/test_modeling_vision_encoder_decoder.py::NougatModelIntegrationTest::test_forward_pass (❌ ⟹ ❌)
    tests/models/vision_encoder_decoder/test_modeling_vision_encoder_decoder.py::NougatModelIntegrationTest::test_generation (❌ ⟹ ❌)

@ydshieh
ydshieh merged commit 5f47b5a into main Sep 9, 2026
48 of 50 checks passed
@ydshieh
ydshieh deleted the fix-fast-image-processor-golden-values branch September 9, 2026 08:44
sbucaille pushed a commit to sbucaille/transformers that referenced this pull request Sep 16, 2026
…ssor default (PR huggingface#41388) (huggingface#48637)

* [tests] Fix integration test golden values broken by fast image processor default (PR huggingface#41388)

PR huggingface#41388 switched all models to use fast image processors by default, but 10 integration
tests still had golden logit/embedding values from the slow image processors. This updates
the expected values (and in one case, relaxes tolerance) to match the fast image processor
outputs.

Tests fixed:
- `FlavaModelIntegrationTest::test_inference` — image_embeddings and multimodal_embeddings sums
- `HieraModelIntegrationTest::test_inference_image_classification_head` — top-5 logit slice
- `LlavaNextForConditionalGenerationIntegrationTest::test_small_model_integration_test` — pixel values tolerance 1e-2 → 0.1
- `OwlViTModelIntegrationTest::test_inference_interpolate_pos_encoding` — logits + box slice, box tolerance 1e-4 → 1e-3
- `OwlViTModelIntegrationTest::test_inference_object_detection` — box slice, tolerance 1e-4 → 1e-3
- `OwlViTModelIntegrationTest::test_inference_one_shot_object_detection` — box slice, tolerance 1e-4 → 1e-3
- `PixioModelIntegrationTest::test_inference_no_head` — last_hidden_state slice
- `DonutModelIntegrationTest::test_inference_docvqa` — step 1 logits + step 2 generation scores
- `DonutModelIntegrationTest::test_inference_cordv2` — step 1 logits + step 2 generation scores
- `DonutModelIntegrationTest::test_inference_rvlcdip` — step 1 logits + step 2 generation scores

All 10 tests verified passing on GPU runner.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* [tests] Fix owlvit box tolerance and replace self.assertTrue(torch.allclose) with assert_close

- OwlViT box checks: confirm 1e-3 tolerance is needed (genuine GPU non-determinism of
  ~1e-3 verified by running twice; 1e-4 fails with max diff 0.0011)
- VisionEncoderDecoder: replace self.assertTrue(torch.allclose(..., atol=1e-4)) with
  torch.testing.assert_close(..., rtol=1e-4, atol=1e-4) for all 4 score checks
  (docvqa, cordv2, rvlcdip donut models + nougat)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* [tests] Update owlvit box golden values to pytest-context values, use 1e-4 tolerance

The previous expected values were captured from a standalone script (fresh GPU),
but the pytest context (3 tests run sequentially, prior models in GPU memory)
produces slightly different but fully deterministic float32 values.

Captured correct values by running 5 consecutive pytest invocations — all identical
(max diff = 0.0). Updated expected values to match pytest context and restored
the tight 1e-4 tolerance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* format

---------

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