Skip to content

test(quantize): use fake model for image-segmentation e2e calibration#965

Merged
KayMKM merged 3 commits into
mainfrom
yuesu/quantize-e2e-fake-seg-model
Jun 25, 2026
Merged

test(quantize): use fake model for image-segmentation e2e calibration#965
KayMKM merged 3 commits into
mainfrom
yuesu/quantize-e2e-fake-seg-model

Conversation

@KayMKM

@KayMKM KayMKM commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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.

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.
@KayMKM KayMKM requested a review from a team as a code owner June 25, 2026 05:14
Comment thread tests/e2e/test_quantize_e2e.py Outdated
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.
@KayMKM KayMKM merged commit 31c2b2d into main Jun 25, 2026
9 checks passed
@KayMKM KayMKM deleted the yuesu/quantize-e2e-fake-seg-model branch June 25, 2026 07:00
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