test(quantize): use fake model for image-segmentation e2e calibration#965
Merged
Conversation
The image-segmentation quantize e2e test exported and calibrated the real nvidia/segformer-b0-finetuned-ade-512-512 model, whose heavy backbone caused random hangs on QNN hosts. Replace it with a tiny FP32 conv model that has identical segmentation I/O (pixel_values [batch, 3, H, W] -> logits [batch, num_labels, H/4, W/4]) and random weights, built via the new _build_fake_segmentation_onnx() helper. The ImageSegmentationDataset path is still fully exercised: the test keeps --model-name so the real image processor and dataset samples feed real pixel_values into calibration; only the heavy model is swapped out.
zhenchaoni
reviewed
Jun 25, 2026
Address review feedback: relocate the fake image-segmentation model builder out of the e2e test and into the shared tests/fixtures/create_test_models.py as create_fake_segmentation_model(), matching that module's existing create_*_model() -> ModelProto convention and wiring it into main(). Add tests/fixtures/__init__.py so the helper is importable (consistent with tests/assets). The quantize e2e fixture now imports and saves the shared model. No behavior change: I/O contract (pixel_values [batch, 3, H, W] -> logits [batch, num_labels, H/4, W/4]) and seeded-random weights are unchanged.
zhenchaoni
approved these changes
Jun 25, 2026
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.
The image-segmentation quantize e2e test exported and calibrated the real nvidia/segformer-b0-finetuned-ade-512-512 model, whose heavy backbone caused random hangs on QNN hosts. Replace it with a tiny FP32 conv model that has identical segmentation I/O (pixel_values [batch, 3, H, W] -> logits [batch, num_labels, H/4, W/4]) and random weights, built via the new _build_fake_segmentation_onnx() helper.
The ImageSegmentationDataset path is still fully exercised: the test keeps --model-name so the real image processor and dataset samples feed real pixel_values into calibration; only the heavy model is swapped out.