feat(eval): support Common Voice gender classification - #1328
Draft
ssss141414 wants to merge 3 commits into
Draft
Conversation
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.
Summary
This dependent contribution adds WinML CPU FP32 and FP16 support for
prithivMLmods/Common-Voice-Gender-Detection, a Wav2Vec2 audio classifier that emits female or male voice labels. Effort L2 ships model recipes plus a class-wide scalar-string label-mapping extension; Outcome L2 is complete, and the highest tested Goal is L3 PASS. The branch is stacked on Draft #1326 at exact head1bd919b583aa8ccd974e35fa6a1a132ac7e1c9f8; that PR owns the generic audio-classification evaluator and raw-streaming implementation included in this PR's diff againstmain.Model metadata
What the model does
This Wav2Vec2 sequence-classification checkpoint accepts 16 kHz speech waveforms and emits two logits interpreted as female or male voice labels (
verified). Evidence: pinned checkpointprithivMLmods/Common-Voice-Gender-Detection@ebbf41293c8dbea45c5bb0de6e3ef77bf89cc2ee, its audio-classification model card, and the pinnedWav2Vec2ForSequenceClassificationimplementation.Primary user stories
verifiedfrom the checkpoint model card andid2labelmetadata).Supported tasks
audio-classificationacross the checkpoint, Transformers, Optimum ONNX, and WinML surfaces (verifiedfrom the checkpoint pipeline tag,Wav2Vec2ForSequenceClassification, the Optimum Wav2Vec2 ONNX task registry, and WinML inspect/config behavior).Model architecture
mapped).Validation and support evidence
1. Baseline
The frozen baseline is
microsoft/winml-climain commit0876e5ae1c98a169a6137e092e0d7b30bf9cee33, WinML0.3.0. Recipe-free FP32 CPU build passed in 46.1 s, producing an approximately 360.9 MB model with 619/619 tagged ONNX nodes andinput_values float32[1,16000] -> logits float32[1,2]. CPU perf over three measured iterations was 59.565 ms mean, 57.39 ms p50, 16.79 samples/s, and +63.55 MB RSS total delta. Eval failed before dataset loading because current-main WinML did not registeraudio-classification. Generated config already selectedexport.compatibility.transformers_attention=eager. Optimum exposedaudio-classificationandfeature-extractionboth before and after WinML registration, so the probe verdict wasVENDOR-ONLYwith no WinML-added task.2. Goal
3. Outcome
The shipped tier is L2 and the highest Goal verdict is L3 PASS, with full technical coverage. Required tuples
CPUExecutionProvider/cpu/fp32andCPUExecutionProvider/cpu/fp16both passed; no tuples are deferred. The contribution adds two CPU recipes and a generic, schema-driven scalarValue('string')mapping path. The model branch deliberately depends on Draft #1326 at1bd919b583aa8ccd974e35fa6a1a132ac7e1c9f8; #1326 retains ownership of evaluator registration, the base audio-classification implementation, rawAudio(decode=False)plus SoundFile decoding, fixed-window aggregation, and existing ClassLabel/sequence behavior. This PR adds only exact scalar-string mapping validation/resolution, its focused tests, schema help, and the model recipes.Lane A knowledge was appended separately in gim-home/ModelKitArtifacts#254 at commit
0c896ff8e9eff8e26f41c3ee40058e960f149e85, with publishedwav2vec2.jsonSHA-25614d78c8ae620e646f72a9255a924767c3b273633844e3219c7a6a9e0dcb279c0.No methodology friction observed.4. Per-EP/device/precision results and Functional smoke Eval
L2 parity passed against pinned PyTorch
Wav2Vec2ForSequenceClassification@ebbf41293c8dbea45c5bb0de6e3ef77bf89cc2eeusing deterministic float32 input[1,16000]. FP32 cosine was0.9999999999999206, max absolute error8.821487426757812e-06, mean absolute error8.225440979003906e-06, finite output, and matching argmax. FP16 cosine was0.9999999999953266, max absolute error0.0008280277252197266, mean absolute error0.0007888078689575195, finite output, and matching argmax.Functional smoke Eval: L3 PASS on final candidate
e4d19ba1d4af532ba4cf0b047ff2fb395ac9d868, FP32 CPU, usingAsmaaQ/gender_audio_1080@47f6563cf1b819cbf1cbc8569a8dfe8fc426bab3, configdefault, splittest, streaming, no shuffle. Exact mapping wasfemale -> 0,male -> 1, matching the checkpoint. Selection took the first eligible row for each exact mapped label in source order. Accounting was requested/selected/processed/rejected =2/2/2/0, with no rejection reasons; both classes were represented. The female row was mono 16 kHz PCM16, 55,872 frames (3.492 s), four 16,000-sample windows; the male row was mono 16 kHz PCM16, 81,216 frames (5.076 s), six windows. Fan-out caps were 2 rows, 2 classes, 10 total windows, 1 beam, and 0 other expansion. Accuracy was1.0; macro-F1 was1.0; represented classes were2/2and class coverage was1.0.This is bounded real-data end-to-end operability evidence only. Two rows are not representative accuracy and are not a benchmark-quality claim. Only FP32 CPU Eval was measured; no FP16 or other-EP accuracy is implied. The former blocker was rejection of scalar
datasets.Value('string')targets before inference; the new capability accepts them only through a complete, exact, explicit mapping to checkpoint class IDs.5. Delta
Recipes added:
examples/recipes/prithivMLmods_Common-Voice-Gender-Detection/cpu/cpu/audio-classification_fp32_config.json:/export/compatibility/transformers_attentioniseager, identical to the generated baseline value.examples/recipes/prithivMLmods_Common-Voice-Gender-Detection/cpu/cpu/audio-classification_fp16_config.json:/export/compatibility/transformers_attentioniseager, identical to baseline;/quantis the existing FP16 quantization object, while baseline has no/quant.Parsed FP32 recipe content equals the baseline exactly. Parsed FP16 content equals baseline after substituting only the FP16
/quantobject. Recipe-free Eval acceptance passed through the final built FP32 model.examples/recipes/README.mdremains untouched.Code delta relative to dependency #1326:
src/winml/modelkit/eval/audio_classification_evaluator.py:_validate_target_schema,_target_for_row, and_validate_scalar_string_mappingadd exact scalar-string mapping support.src/winml/modelkit/utils/eval_utils.py:_AUDIO_CLASSIFICATION_SCHEMAdocuments explicitly mapped scalar strings.tests/unit/eval/test_audio_classification_evaluator.py: focused class-wide regressions cover the new and preserved paths.Bug fix explanation:
datasets.Value('string')targets, such asfemaleandmale, was rejected during target-schema validation before inference even when the caller supplied an explicit mapping.ClassLabeland sequence-valued label forms but had no scalar-string validation/resolution branch, so schema validation rejected the feature before exact mapping semantics could be applied._validate_target_schemarecognizes scalar string features only when_validate_scalar_string_mappingproves a non-empty, one-to-one, complete mapping to contiguous checkpoint IDs;_target_for_rowresolves each observed value by exact key lookup._AUDIO_CLASSIFICATION_SCHEMAexposes that contract.ClassLabel, sequenceClassLabel/string multi-label behavior, metrics, raw streamingdecode=False, SoundFile decoding, and fixed-window aggregation are preserved. Intentional change is limited to explicitly mapped scalar strings. Missing, empty, non-integer, duplicate-destination, out-of-range, incomplete, and unmapped observed values fail closed before inference.18tests in11.18 s; the previously failing scalar-string mapping test passed; related eval/metric/recipe/command coverage passed198tests in producer verification. Tester CI passed 3,648 tests with 9 skipped in the commands group and 1,538 tests with 6 skipped and 2 expected failures in the models group. Ruff, full-package mypy, and license checks all passed.6. Analyze summary - component level and op level
Analyze completed as
ANALYZE-PARTIAL-SUCCESSwith exit code 1 because six targets have no populated static rules. Static rule classification is not accelerator runtime execution.Component-level summary
The five shared gaps are the final feature-extractor Gelu, feature-projection output Reshape, first encoder-layer Gemm input Reshape, projector Gemm input Reshape, and projector output Reshape. They remain unattributed because adjacency alone is not accepted as semantic ownership evidence. FP16 additionally has input/output precision-adapter Casts. Every source component is mapped; resolving transition ownership would require exporter provenance or an instrumented unoptimized export with stable correspondence, and requires no product repair.
Op-level summary
Rule-less targets CUDA/GPU, MIGraphX/GPU, TensorRT/GPU, DML/GPU, CPU/CPU, and VitisAI/NPU have no populated classifications. These are rules-availability gaps, not runtime failures or measured support claims.
7. Reproduce commands
Prerequisites: Windows PowerShell, Git,
uv, internet access to the public Hugging Face checkpoint/dataset, and sufficient disk/RAM for approximately 361 MB FP32 and 180 MB FP16 external-weight payloads. The commands clone the exact dependent branch, verify its SHA and dependency ancestry, install the locked environment, clone the public static-rule repository, and reproduce build, perf, Analyze, bounded Eval, and quality checks.The Eval command is a two-row functional smoke only, not representative accuracy. Analyze is static rule classification, not accelerator runtime evidence.
Dependency and provenance
1bd919b583aa8ccd974e35fa6a1a132ac7e1c9f8, owns the generic audio evaluator implementation described above. This dependent PR does not duplicate or rewrite that ownership.ssss141414/add-common-voice-gender-dependent, exact heade4d19ba1d4af532ba4cf0b047ff2fb395ac9d868; the dependency head is its verified ancestor.0c896ff8e9eff8e26f41c3ee40058e960f149e85, published knowledge-file SHA-25614d78c8ae620e646f72a9255a924767c3b273633844e3219c7a6a9e0dcb279c0.