Skip to content

Fix jax vit unit tests#2467

Open
bkowalskiINTEL wants to merge 7 commits into
masterfrom
dev/bkowalsk/fix_vit_test
Open

Fix jax vit unit tests#2467
bkowalskiINTEL wants to merge 7 commits into
masterfrom
dev/bkowalsk/fix_vit_test

Conversation

@bkowalskiINTEL
Copy link
Copy Markdown
Contributor

This PR changes how the accuracy is evaluated in jax vit unit tests.
Previously: exact top-5 match with hardcoded labels
Now: exact top-1 match with label calculated on the original model + top-1 label propability error threshold

Also, now the input images for vit are in uint8 instead of float32

Signed-off-by: Bartosz Kowalski <bartosz.kowalski@intel.com>
Signed-off-by: Bartosz Kowalski <bartosz.kowalski@intel.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the JAX ViT quantization unit test to use a more robust accuracy check by comparing top‑1 predictions (label + probability) against the original (unquantized) model, and switches test image inputs to uint8 to match the ViT example/input pipeline.

Changes:

  • Switch ViT test evaluation from hardcoded top‑5 label matching to top‑1 label matching plus a probability-delta threshold.
  • Add int8 to the tested quantization dtypes for the ViT classification test matrix.
  • Simplify load_image() in JAX test utilities to always return uint8 (no optional normalization path).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
test/jax/test_vit_quantization.py Adjusts ViT quantization test to compare top‑1 label and probability between original and quantized models; adds int8 coverage.
test/jax/jax_test_utility.py Changes load_image() to always return unnormalized uint8 image tensors.

Comment thread test/jax/test_vit_quantization.py
Comment thread test/jax/test_vit_quantization.py Outdated
Signed-off-by: Bartosz Kowalski <bartosz.kowalski@intel.com>
@anko-intel anko-intel requested a review from wpietka May 13, 2026 10:28
@bkowalskiINTEL bkowalskiINTEL requested a review from Copilot May 13, 2026 11:10
Signed-off-by: Bartosz Kowalski <bartosz.kowalski@intel.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread test/jax/test_vit_quantization.py
Comment thread test/jax/test_vit_quantization.py
Comment thread test/jax/jax_test_utility.py
Signed-off-by: Bartosz Kowalski <bartosz.kowalski@intel.com>
@bkowalskiINTEL bkowalskiINTEL force-pushed the dev/bkowalsk/fix_vit_test branch from e84c750 to 2e8e814 Compare May 13, 2026 13:49
Copy link
Copy Markdown
Contributor

@wpietka wpietka left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@anko-intel anko-intel left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants