Fix large-model FP16 conversion and add XLM-RoBERTa NER recipes#1137
Fix large-model FP16 conversion and add XLM-RoBERTa NER recipes#1137ssss141414 wants to merge 2 commits into
Conversation
REQUEST_CHANGESIndependent review of PR #1137 at Blocking findings
Independent verification completed
Please preserve Draft state while addressing these findings. |
|
Explainer follow-up on findings #1?#3:
|
REQUEST_CHANGESIndependent reviewer verdict for model 7 only at PR head Blocking gate
Exact owner routing
Previous blockers re-verified
Independent verification
Public-contract audit
All prior code/thread blockers are closed, but |
b2935ab to
cb7f830
Compare
|
Addressed the latest
Draft state and the |
APPROVE — independent adding-model-support review (model 7 only)Reviewed exact PR head Gate results
VerdictAPPROVE. All model-7 reviewer gates pass at the exact requested head. Keep the PR in Draft; this verdict does not authorize transition to Ready for Review. |
Summary
Adds CPU
fp32andfp16token-classification recipes forDavlan/xlm-roberta-large-ner-hrland generalized fixes for ONNX models whose external data exceeds protobuf's 2 GB in-memory limit. It also avoids unnecessary optional WindowsML provider-catalog initialization for explicit CPU sessions and static analysis, eliminating successful-command teardown crashes. After rebasing onto current main38767add6f91c7b10b6394fae3af6f437e02effd, exact PR headcb7f8305754d4148ae507493e4e40efb893559d9reaches Effort L2 / Goal L2 / Outcome L2: both required CPU precisions pass build, perf, and PyTorch-vs-ONNX numeric parity with full coverage.Model metadata
What the model does
A multilingual named-entity recognition model that accepts tokenized text in Arabic, German, English, Spanish, French, Italian, Latvian, Dutch, Portuguese, or Chinese and emits one label score vector per token. The model card advertises person, organization, and location recognition, while pinned checkpoint revision
1f929ffad9b7353f9c84b0b3f579fc3bb0b3685eadditionally publishes DATE labels; this conflict is preserved rather than silently reconciled. Confidence: verified.Primary user stories
Supported tasks
token-classificationthrough the checkpoint, Transformers, Optimum ONNX, and WinML surfaces. The pinned Hub metadata,XLMRobertaForTokenClassificationarchitecture, Optimum registration, andwinml inspectresolution agree. Confidence: verified.Model architecture
XLMRobertaForTokenClassificationcomponent sources (verified).Validation and support evidence
Baseline
Fresh clean-main baseline:
38767add6f91c7b10b6394fae3af6f437e02effd, confirmed aftergit fetch origin main;winml, version 0.2.0. The PR was rebased conflict-free so its merge base equals this commit.fp32build: PASS, exit0; CLI build time 184.1 s, wrapper elapsed 202.028 s; graph 328,813 bytes plus 2,237,493,248 bytes external data.-1073741819(0xC0000005) after writing valid diagnostic JSON. With 10 warmups and 100 iterations, mean/p50/p90/p95/p99 latency was 844.147/833.493/865.409/945.695/1,336.831 ms, throughput 1.18 samples/s, and RSS total delta 1,300.82 MB. Output existence does not upgrade the failed process exit to L1 PASS.-1073741819(0xC0000005) after writing JSON. Independently, the result isEVAL-BLOCKED-DATA-PROVENANCE: ORG precision/recall/F10/0/0and overall accuracy0.9090909090909091are invalid diagnostics because checkpoint and dataset label IDs conflict.fp32recipe. Thefp16recipe preserves export, optimization, compile, and loader settings and changes/quantfromnullto explicit FP16 settings.xlm-robertatoken classification (VENDOR-ONLY); WinML adds no vendor registration. The contribution therefore repairs generalized conversion and lifecycle defects rather than adding a checkpoint-specific exporter.Goal
Committed Effort L2 / Goal L2 / Outcome L2. Success requires both
CPUExecutionProvider / cputuples (fp32,fp16) to pass structural build, crash-free perf, and named-input numeric parity against pinned PyTorch. Revision-3 reissued the charter after the current-main rebase and invalidated all measurements from the superseded base. L3 remains unavailable because no checkpoint-owner-authoritative dataset revision, split/subset, and exact nine-label mapping is published.Outcome
38767add6f91c7b10b6394fae3af6f437e02effd; PR headcb7f8305754d4148ae507493e4e40efb893559d9.fp32andfp16; overall verdict PASS, coverage full, no deferred tuples, and no ceiling downgrade.examples/recipes/README.mdis untouched; no model-ID or model-type special case was added; no model-8 path is present.xlm-roberta-001throughxlm-roberta-004and_meta-083remain the applicable record.Per-EP/device/precision results — including perf and eval data
Goal ladder
[1,512,9]logits; 14 active tokens; top-1 match 1.0[1,512,9]logits; 14 active tokens; top-1 match 1.0Exact perf
Exact L2 parity against pinned PyTorch
The reference and both ONNX runs use the exact sentence
Microsoft hired Alice in Berlin on 19 July 2026., tokenizer output padded/truncated to[1,512], and checkpoint revision1f929ffad9b7353f9c84b0b3f579fc3bb0b3685e.[1,512,9]logits[1,512,9]logitsEval:
EVAL-BLOCKED-DATA-PROVENANCEBoth
fp32andfp16smoke commands exited 0 againstBramVanroy/conll2003revision4ffbd53d9e0b92b473b9b7dcff12f53e7c17ce0c, splitvalidation, first unshuffled streaming sample (samples=1, seed42). The emitted values are retained only as invalid diagnostics and excluded from support claims:number)1)1)The checkpoint map is
[O, B-DATE, I-DATE, B-PER, I-PER, B-ORG, I-ORG, B-LOC, I-LOC]; the dataset map is[O, B-PER, I-PER, B-ORG, I-ORG, B-LOC, I-LOC, B-MISC, I-MISC]. Numeric IDs 1–8 are incompatible, and the dataset has no DATE labels. No checkpoint-owner-authoritative dataset revision, split/subset, and exact DATE/PER/ORG/LOC mapping exists, so an inferred remap would be semantically unsafe and no L3 metric is claimed.Delta
Recipes
examples/recipes/Davlan_xlm-roberta-large-ner-hrl/cpu/cpu/token-classification_fp32_config.json; it is semantically identical to current-main auto-config.examples/recipes/Davlan_xlm-roberta-large-ner-hrl/cpu/cpu/token-classification_fp16_config.json; JSON pointer/quantchanges fromnullto FP16 mode withsamples=10,calibration_method=minmax, uint8 weight/activation defaults,task=token-classification, model identity/type fields,fp16_keep_io_types=true, and no block list./export,/optim,/compile, and/loaderremain identical.Generalized source fixes
convert_to_fp16()andFP16Pass.run()accept/pass a model path, useinfer_shapes_path()through a closed temporary file, and disable duplicate ORT FP16 shape inference. Already-FP16 path input materializes external tensors before return, so relocation remains self-contained. No checkpoint special case is used.WinMLSession.__init__()andresolve_device()bypass optional WindowsML provider-catalog initialization for explicit built-in CPU routing.analyze()enumerates local optional EP/device pairs only when runtime unknown-op probing is requested; default static rule analysis does not load optional plugins.Fresh post-rebase gates
mypy -p winml.modelkit: PASS; changed-file Ruff: PASS;git diff --check 38767add6f91c7b10b6394fae3af6f437e02effd...HEAD: PASS.Analyze summary — component level and op level
ANALYZE-PARTIAL-SUCCESS: each all-EP command exited1because QNN classifications are partial, while each emitted complete valid 11-run / 11-result JSON. This is static rule compatibility analysis, not measured accelerator execution.Component-level summary
Both artifacts carry
XLMRobertaForTokenClassificationhierarchy metadata: 558,850,057 parameters, 444 total modules, 172 traced modules, 344 execution steps, embeddings plus all 24 encoder layers, and the per-token classifier.Dropout is optimized away in evaluation export. The extra fp16 unmapped node is the graph-output cast.
Op-level summary
Rule-less groups reported all 18 types unknown: CUDA/GPU, MIGraphX/GPU, DML/GPU, CPU/CPU, and VitisAI/NPU. Rules provenance: public release v0.2.0, archive
rules-v0.2.0.zip, SHA-2566dcabbe7f5493fbc2bd23de195ab6e35b3578d510f18c2e220bc5538a1f232cc, 1,746 parquet files.Reproduce commands
These PowerShell commands separate a clean baseline worktree at exact current-main commit from exact PR-head validation. Every checkpoint-loading operation consumes the materialized pinned
$SNAPSHOT; no floating Hub model ID is passed to build or eval.