recipe(segformer): add nvidia b4 ADE recipe coverage#1123
Conversation
|
Producer-side reviewer sanity check for the SegFormer B4 recipe PR. Verdict: APPROVE-PENDING-CI (comment-only; GitHub does not allow approving my own PR). Evidence checked:
Open items before ready-for-merge:
|
|
Follow-up evidence added after baseline-delta review:
Lane A methodology follow-up was also completed locally (kept out of this Lane B model PR):
The local skill directory is not itself a git repo, so I could not open a separate Lane A skill PR from this machine in this session. |
|
|
@microsoft-github-policy-service agree [company="{your company}"] |
|
@microsoft-github-policy-service agree |
|
Perf evidence has been reorganized into a compact table in the PR body.
So the recipe delta is now stated as footprint/catalog coverage, not a CPU speedup claim. |
|
@microsoft-github-policy-service agree company="Microsoft" |
79fd994 to
0339b00
Compare
0339b00 to
48c40ea
Compare
48c40ea to
71fa1c3
Compare
|
Current head The PR is now recipe-only and ships only exact-evidence CPU/CPU |
|
Reviewer verdict: APPROVE (comment-only; GitHub does not allow approving my own PR identity). Reviewed SHA: Evidence:
Coverage annotation: full for the target tuples shipped by this PR ( |
Summary
Adds verified CPU/CPU recipe coverage for
nvidia/segformer-b4-finetuned-ade-512-512image segmentation. This is a Lane BL0recipe-only contribution: two checked-in recipes (fp32andfp16) under the exact-evidence layout, no modelkit source changes, no catalog/index changes, and noexamples/recipes/README.mdchange.Highest verified Goal on the reachable host is
L3 PASSfor both shipped CPU tuples: build, CPU perf, numeric compare vs PyTorch, and task-metric eval all completed. Thew8a16candidate was removed because its artifact validation showed fp32 semantics, so it is not shipped or claimed here.Model metadata
What the model does
nvidia/segformer-b4-finetuned-ade-512-512is a SegFormer semantic image segmentation checkpoint fine-tuned for ADE-style scene parsing. A user supplies an RGB image and the model produces per-pixel logits for 150 semantic labels.Evidence/confidence: pinned Hugging Face checkpoint config (
architectures=['SegformerForSemanticSegmentation'],model_type='segformer',num_labels=150) andwinml inspecttask resolution (verified).Primary user stories
verifiedfrom checkpoint task/config and recipe eval dataset).verifiedfromwinml evalondanjacobellis/scene_parse_150).verifiedfrom built artifacts and perf/eval results).Supported tasks
image-segmentationAutoModelForSemanticSegmentation; WinML loaderWinMLModelForImageSegmentation; exporterSegformerIOConfigsemantic-segmentationsemantic-segmentationModel architecture
SegFormer B4 uses hierarchical overlap patch embeddings and a multi-stage transformer encoder, followed by an all-MLP segmentation decode head.
Evidence/confidence: config values from pinned checkpoint; HTP export metadata reports
SegformerForSemanticSegmentation, 64,108,374 parameters, 937 modules, 339 traced modules, inputpixel_values [1,3,512,512]; ONNX outputlogits [1,150,128,128](verified/mapped).Validation and support evidence
1. Baseline
origin/main=5deebd422e95f28fe8fd912ee50ce874710187b3.71fa1c3e.0.2.0; runtime providers observed:['DmlExecutionProvider', 'CPUExecutionProvider'].winml inspect -m nvidia/segformer-b4-finetuned-ade-512-512 --format jsonresolvesmodel_type=segformer, architectureSegformerForSemanticSegmentation, taskimage-segmentation, loaderAutoModelForSemanticSegmentation, exporterSegformerIOConfig, WinML classWinMLModelForImageSegmentation.winml config -m nvidia/segformer-b4-finetuned-ade-512-512 -t image-segmentationsucceeds and emits a 512x512pixel_valuesinput andlogitsoutput config. The shipped recipes refine this into explicit CPU/CPU checked-in coverage for fp32 and fp16.segformer: vendor tasks[]; after WinML registration['feature-extraction', 'image-classification', 'image-segmentation', 'semantic-segmentation']; added by WinML same list. Effort remains recipe-only because WinML already registers the exporter/loader.2. Goal
L0recipe-only.L3, because CPU build, perf, numeric compare, and dataset eval are reachable on this host.L0; checked-in recipe files only.(EP, device, precision)tuple must have exact L0 build/structure evidence, L1 perf data, L2 numeric compare data, and L3 task metric data.3. Outcome
examples/recipes/nvidia_segformer-b4-finetuned-ade-512-512/cpu/cpu/image-segmentation_fp32_config.jsonexamples/recipes/nvidia_segformer-b4-finetuned-ade-512-512/cpu/cpu/image-segmentation_fp16_config.jsonL3 PASSfor CPU/CPU fp32 and CPU/CPU fp16.cpu/cpu/fp32,cpu/cpu/fp16). No accelerator EP/device recipe is shipped.w8a16candidate becausewinml_build_config.jsonhadquant: null, the final artifact size matched fp32, and initializer data types were fp32 rather than quantized.4. Per-EP/device/precision results
model.onnx+ external data; precisionfp32; inputspixel_values [1,3,512,512]; outputslogits [1,150,128,128]0.9999999999999606; max abs diff mean2.7338663736979168e-05danjacobellis/scene_parse_150, validation, 1 sample: mean_iou0.43409010767936707; overall_accuracy0.7907461524009705model.onnx+ external data; precisionfp16; FLOAT16 initializers; fp32 I/O preserved0.999999974186835; max abs diff mean0.026076634724934895danjacobellis/scene_parse_150, validation, 1 sample: mean_iou0.43414419889450073; overall_accuracy0.7908576726913452Artifact footprint:
model.onnxmodel.onnx.datafp32fp165. Delta
export.input_tensors[0].shape: explicit[1,3,512,512]matching this ADE 512 checkpoint.loader.task:image-segmentation.loader.model_class:AutoModelForSemanticSegmentation.quant.mode='fp16',fp16_keep_io_types=true, and requires the build command to pass--precision fp16.danjacobellis/scene_parse_150, splitvalidation, annotation column mapping, and ADE20K label mapping file.w8a16recipe claim.src/winml/modelkit/files were changed.6. Analyze summary - component level and op level
Static rule analysis was run against the fp32 artifact with
WINMLCLI_RULES_DIRpointing at the populated ModelKitArtifacts runtime rules. The command exited nonzero after producing useful JSON/console classifications, so this is recorded asANALYZE-PARTIAL-SUCCESS; it is static compatibility analysis, not runtime execution.Component-level summary:
SegformerModelencoder plusSegformerDecodeHead; HTP metadata: 937 modules, 339 traced modules, 64,108,374 params; ONNX graph output logits for 150 classesOp-level summary:
7. Reproduce commands
Quality gates on current local PR head
71fa1c3e:uv run ruff check src/ tests/All checks passed!uv run mypy -p winml.modelkitSuccess: no issues found in 409 source files