feat(eval): add audio classification evaluation and music genre recipes - #1388
ssss141414 wants to merge 5 commits into
Conversation
|
REQUEST_CHANGES One blocking finding:
After the Producer repair, Tester must rerun the focused audio/eval/recipe tests, full Ruff, and the canonical The rest of the review is clean: exact candidate/tree/base and sealed title/body; five authoritative and seven historical manifests rehashed; implementation, recipes, L0/L1/L2/L3/Analyze evidence, Review surface: 1 line comment, 1 review thread, 1 open thread. PR remains OPEN draft with This is an ordinary conversation comment, not a GitHub Review state. Do not ready or merge the PR. |
|
APPROVE No blocking findings. Reviewed exact candidate The repair from Frozen evidence was independently rehashed and sampled. L0-L2 and Analyze retain original execution SHA Independent exact-head validation: focused PR #1388 is OPEN draft by Exact-head GitHub checks:
Coverage is full: verified Disposition: terminal skill-level APPROVE. Keep the PR draft. This is an ordinary conversation comment, not a GitHub Review state. |
Summary
This contribution adds generalized
audio-classificationevaluation and refreshes CPU FP32/FP16 recipes fordima806/music_genres_classification. The L2 outcome adds task-family evaluator, configuration, CLI, and regression-test support rather than checkpoint-specific production logic. Goal L3 remains PASS for repaired candidatecaefc9ccde629d2596f26ccde41fb5dfdb5092ecthrough the exact execution/reuse provenance below; the two-row result is functional-smoke evidence only, not representative accuracy or benchmark quality.Model metadata
What the model does
A Wav2Vec2 music-genre classifier that accepts mono waveform samples at 16 kHz and emits ten logits for the GTZAN genres.
dima806/music_genres_classification@5f71fb1e2c6bedcddb2bfb1e929fc70655780902; its model card identifies GTZAN music genre classification, exact config selectsWav2Vec2ForSequenceClassificationwith tenid2labelentries, exact preprocessor config sets 16,000 Hz and normalization, and the exported ONNX contract isinput_values[1,16000] -> logits[1,10](verified).Primary user stories
verifiedfrom the pinned model card).verifiedfrom the pinned model card).Supported tasks
audio-classificationacross the checkpoint, Transformers, Optimum ONNX, and WinML surfaces. The Hub pipeline tag, Optimum Wav2Vec2 vendor registry, and WinML inspect/config/build resolution agree (verified). Optimum already registers Wav2Vec2 audio classification; WinML adds no vendor-registry alias.Model architecture
Wav2Vec2ForSequenceClassificationsource, a 94,571,146-parameter trace, and the exported ONNX graph (verified).Validation and support evidence
Baseline
Baseline was current
maincommit8d631f6f1e5db26a04e8c13045280408c6f984dcwithwinml, version 0.0.1.dev0. Auto-config resolvedaudio-classification. CPU build passed in 61.2 s (33.7 s export, 16.4 s optimize); baseline perf was 61.63 ms mean, 62.29 ms p50, 64.19 ms p90, 16.23 samples/s, and +62.2 MB RAM. Baseline Eval failed becauseaudio-classificationwas not registered. The observed--no-optimizebehavior is owned separately and is not changed here. Optimum's pinned Wav2Vec2 registry already listedaudio-classification,audio-frame-classification,audio-xvector,automatic-speech-recognition, andfeature-extraction; WinML added no registry entries.Goal
Outcome
The highest reached verdict is L3 PASS with full planned CPU FP32/FP16 coverage and no deferred tuples. The shipped Lane B delta contains two refreshed recipes, generalized evaluator/config/CLI registration, and regression tests. Model findings
wav2vec2-018throughwav2vec2-022and methodology finding_meta-115were published separately in Lane A PR gim-home/ModelKitArtifacts#307, head837b125a4e60372c2b446fd8003a366645fec95a; those skill/knowledge files are not part of thiswinml-clichange.PR #1388 already exists as a draft with the
model-scale-by-skilllabel, but it still points to prior head95506e515042b10567c4392ada4481df079f2dfd. Repaired candidatecaefc9ccde629d2596f26ccde41fb5dfdb5092ecis clean and one commit ahead of the remote branch; this report does not claim it has been pushed or that the PR has been updated.L0, L1, L2, and Analyze were executed on
4eb6900fa1857a1feaa565a3774e054e3a2f06d0. They were first REUSE-REBIND evidence for95506e515042b10567c4392ada4481df079f2dfd, not relabeled final-SHA executions; L3 and its then-current quality gates were run fresh on95506e515042b10567c4392ada4481df079f2dfd. For repaired candidatecaefc9ccde629d2596f26ccde41fb5dfdb5092ec, L0-L3, Analyze, Models, Optim, mypy, Remaining, and license evidence are again REUSE-REBIND, preserving those original execution SHAs. The exact95506e515042b10567c4392ada4481df079f2dfd..caefc9ccde629d2596f26ccde41fb5dfdb5092ecdiff changes onlytests/unit/eval/test_audio_classification_evaluator.py: it removes the mixed ONNX from-import and qualifies the sameTensorProtoandhelperobjects throughonnx, with identical fixture graph operations, arguments, opset, IR, save behavior, and no production, recipe, dependency, artifact, or runtime-path change. Fresh repaired-head checks found nofrom onnx import, passed the import/runtime probe, passed 34 focused tests, passed Ruff, and passed Commands with 3726 tests and 9 skips.Per-EP/device/precision results and Functional smoke Eval
Both L1 rows used 3 warmups and 10 measured iterations. FP16 was slower than FP32 in this short CPU run; no speed threshold applies.
L0 structural validation. Both artifacts passed ONNX load/checker at IR 8 and opset 17, with FP32 graph I/O
input_values[1,16000] FLOAT -> logits[1,10] FLOAT. FP32 has 385 nodes, 276 initializers (216 FLOAT, 60 INT64), and 378,438,918 total bytes (153,862-byte model plus 378,285,056-byte external data). FP16 has 387 nodes, 276 initializers (216 FLOAT16, 60 INT64), and 189,296,375 total bytes (154,359-byte model plus 189,142,016-byte external data). This proves true FP16 initializer conversion while preserving FP32 I/O; both use eager attention and local external data.L2 numerical parity. One real 1,323,632-byte WAV was decoded from mono 22,050 Hz / 661,794 frames, resampled to 16,000 Hz, reduced to 16,000 normalized samples, and supplied as
input_values[1,16000] float32to pinned PyTorch and ONNX. Frozen FP32 bounds were cosine >= 0.9999 and maximum absolute error <= 0.01; observed cosine was 1.0, maximum absolute error1.0371208190917969e-05, and reference/candidate top-1 were both 6. Frozen FP16 bounds were cosine >= 0.999 and maximum absolute error <= 0.05; observed cosine was0.9999998211860657, maximum absolute error0.0035549402236938477, and reference/candidate top-1 were both 6.Functional smoke Eval. This L3 run executed on
95506e515042b10567c4392ada4481df079f2dfdand is REUSE-REBIND evidence for repaired candidatecaefc9ccde629d2596f26ccde41fb5dfdb5092ec; it passed using FP32 ONNX Runtime CPU and pinneddanilotpnta/GTZAN_genre_classification@77564793c44e244eaff98a267bb7ba7cc1bda0b1, config/splitgtzan/train. Exactly 2 samples were requested, 101 eligible rows were examined, 2 were selected/decoded/processed, 4 inference windows ran, 2 samples were truncated, and 0 were rejected. The authoritative scalar labels mapped exactly and case-sensitively:blues -> 3andclassical -> 5. Both embedded PCM_16 WAVs were mono 22,050 Hz with 661,794 decoded float32 frames; each was resampled to 16,000 Hz, capped at 2.0 seconds / 32,000 samples, and split into exactly two 16,000-sample windows. Mean logits were aggregated once per utterance before argmax and pinnedid2labeldecoding. Predictions wereblues -> jazzandclassical -> classical; accuracy was 0.5 and macro-F1 was 0.5. This proves bounded end-to-end operability only and is not representative accuracy or benchmark quality.The evaluator supports raw audio bytes and ordinary paths, preserves virtual archive paths for
xopen, and decodes with SoundFile without requiring TorchCodec or FFmpeg. It converts decoded float32 audio to mono, resamples to the checkpoint rate, applies optional duration and static-window caps, requires one static audio input and one rank-2 class-logits output, maps scalar labels exactly through configured metadata, and computes utterance accuracy/macro-F1 after mean-logit aggregation.Fresh repaired-head evidence on
caefc9ccde629d2596f26ccde41fb5dfdb5092ec: ONNX import/runtime probe PASS with nofrom onnx import; focused audio regressions 34 passed, 1 warning; touched-file Ruff PASS; Commands 3726 passed, 9 skipped, 2 warnings. Reused evidence retains its original execution SHA: invalidated Eval/schema/recipe tests 173 passed, 1 warning, full Ruff and license headers PASS, L3, Analyze 1529 passed, 45 skipped, Models 1541 passed, 7 skipped, 1 xfailed, Optim 876 passed, 16 skipped, 1 xfailed, and Remaining 964 passed, 2 skipped, 1 deselected were established on95506e515042b10567c4392ada4481df079f2dfdor its explicitly cited source chain. Mypy remains provenance-bound at 441 files, 0 issues on baseline and 442 files, 0 issues on95506e515042b10567c4392ada4481df079f2dfd; it was not rerun or relabeled as acaefc9ccde629d2596f26ccde41fb5dfdb5092ecexecution.Delta
The base-to-candidate range is
8d631f6f1e5db26a04e8c13045280408c6f984dc..caefc9ccde629d2596f26ccde41fb5dfdb5092ec: 11 files changed, 2089 insertions(+), 3 deletions(-) across five commits.examples/recipes/README.mdis untouched.examples/recipes/dima806_music_genres_classification/cpu/cpu/audio-classification_fp32_config.json/export/compatibility/transformers_attentionfrom absent to"eager"; retains FP32 recipe semantics.examples/recipes/dima806_music_genres_classification/cpu/cpu/audio-classification_fp16_config.json/export/compatibility/transformers_attentionfrom absent to"eager"; retains FP16 recipe semantics.src/winml/modelkit/commands/eval.pysrc/winml/modelkit/eval/__init__.pysrc/winml/modelkit/eval/audio_classification_evaluator.pysrc/winml/modelkit/eval/config.pyDatasetConfig.max_duration_secondswith null/unbounded default and label-mapping round-trip.src/winml/modelkit/eval/evaluate.pyaudio-classificationevaluator.src/winml/modelkit/utils/eval_utils.pytests/unit/eval/test_audio_classification_evaluator.pyonnx.TensorProtoandonnx.helperexclusively.tests/unit/eval/test_eval.pytests/unit/recipes/test_cpu_recipes.pyBug fix explanation.
Value('string')genre labels were rejected before configured mapping.WinMLAudioClassificationEvaluator,_AudioModelAdapter,DatasetConfig, Eval registry/schema, and CLI plumbing now preserve embedded bytes orxopen-readable virtual paths, decode through SoundFile, normalize audio shape/rate, validate static model contracts, retain scalar string keys for explicit mapping, aggregate window logits, and emit accuracy/macro-F1.95506e515042b10567c4392ada4481df079f2dfdestablished the pinned two-row smoke, 173 invalidated schema/recipe tests, L0-L3, Analyze, full Ruff/license, mypy, and the non-Commands partitions through the stated provenance chain.caefc9ccde629d2596f26ccde41fb5dfdb5092ecfreshly passed the import/runtime probe with nofrom onnx import, 34 focused tests, touched-file Ruff, and Commands at 3726 passed / 9 skipped. The exact test-only alias-qualification diff has no behavior impact, so the prior model/runtime evidence is REUSE-REBIND rather than relabeled as freshly executed.The class-wide code fix is recipe-free and metadata-driven; the recipes only record exact checkpoint/precision compatibility. Reducibility is consistent with the L2 charter.
Analyze summary - component level and op level
Analyze was ANALYZE-PARTIAL-SUCCESS for both artifacts; each command exited 1 because some requested EPs had no rule data. This is static rule analysis, not runtime execution or an accelerator support claim.
Component-level summary
Op-level summary
CUDA, MIGraphX, legacy TensorRT, and DirectML had no loaded rule data and were skipped/unknown; that static limitation caused the nonzero Analyze status. No runtime inference was performed on those EPs.
Reproduce commands
The commands below preserve the Tester invocations with portable variables in place of machine-local interpreter, model-cache, and output paths.
label-map.jsoncontains{ "blues": 3, "classical": 5 }.The Tester used Python 3.11.15, uv 0.12.5, Transformers 4.57.6, ONNX 1.18.0,
onnxruntime-windowsml1.27.1.202607110137, Datasets 5.0.1, SoundFile 0.14.0, and Torch 2.14.0 with lock digest8353285ee649c5df37f15e8129c1bcc3d24f178e38c88dafcc18b95a16ee86d8.