Skip to content

support(transformer): add DigitalEdu tabular recipe - #1198

Open
kujin66 wants to merge 1 commit into
mainfrom
kujin66/add-snowflash-digitaledu-transformers-codegen
Open

support(transformer): add DigitalEdu tabular recipe#1198
kujin66 wants to merge 1 commit into
mainfrom
kujin66/add-snowflash-digitaledu-transformers-codegen

Conversation

@kujin66

@kujin66 kujin66 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds WinML support for SnowFlash383935/DigitalEduTransformers, a remote-code tabular Transformer checkpoint. The change adds a tensor-in/tensor-out wrapper for the custom model_type="transformer", registers the tabular-classification task boundary, and ships verified CPU fp32/fp16 recipes. Highest verified goal: L2 numeric comparison passes on CPU for fp32 and fp16; L3 eval is CLI-blocked because winml eval has no tabular-classification evaluator today.

Model metadata

What the model does: Binary tabular classification over seven numeric features, exposed by the model repository as custom Hugging Face code (FleshkaTabularTransformer). Evidence: checkpoint config uses model_type="transformer", architectures=["FleshkaTabularTransformer"], input_dim=7, and pipeline_tag="tabular-classification".

Primary user stories: Convert and run the trained tabular classifier through WinML/ONNX with a stable tensor contract instead of the model-card Python list API.

Supported tasks: tabular-classification in WinML, mapped to Optimum's text-classification exporter boundary after the wrapper exposes features -> logits.

Model architecture:

FleshkaTabularTransformer
├── normalization buffers (mean/std, 7 features)
├── input projection (7 -> 512)
├── Transformer encoder stack x 32
│   ├── multi-head self-attention (16 heads)
│   ├── feed-forward block
│   └── residual / normalization path
└── classification head (512 -> 1 logit)
  • Source/confidence: pinned Hugging Face checkpoint config and remote model class, verified through --trust-remote-code config/build runs.

Validation and support evidence

Baseline

Before this change, winml config -m SnowFlash383935/DigitalEduTransformers --trust-remote-code resolved model_type="transformer" to an unsupported Optimum task and failed with no ONNX config. Explicit --task tabular-classification --trust-remote-code also failed because tabular-classification was not in the task boundary.

After this change, winml config -m SnowFlash383935/DigitalEduTransformers --task tabular-classification --trust-remote-code -o $OUT succeeds and auto-detects TabularTransformerWrapper, input features [1, 7] float32, output logits.

Goal

Effort: L2, because this requires a new custom wrapper/export config plus a new WinML task family entry. Goal ceiling: L2 numeric comparison on CPU. Outcome: L2 support with CPU fp32/fp16 recipes.

Outcome

Shipped code paths:

  • src/winml/modelkit/models/hf/transformer.py
  • src/winml/modelkit/models/hf/__init__.py
  • src/winml/modelkit/loader/task.py
  • src/winml/modelkit/inference/tasks.py
  • src/winml/modelkit/models/winml/__init__.py
  • tests/unit/models/test_tabular_transformer.py

Shipped recipes:

  • examples/recipes/SnowFlash383935_DigitalEduTransformers/cpu/cpu/tabular-classification_fp32_config.json
  • examples/recipes/SnowFlash383935_DigitalEduTransformers/cpu/cpu/tabular-classification_fp16_config.json

Coverage is partial by task level: CPU fp32/fp16 build, perf, and L2 numeric comparison pass; L3 task evaluation is CLI-blocked pending a tabular-classification evaluator.

Per-EP/device/precision results

Tier EP / Device Precision Verdict Mean p50 Throughput RAM delta Task metric
L0 CPUExecutionProvider / cpu fp32 PASS, build complete in 158.7s - - - - -
L0 CPUExecutionProvider / cpu fp16 PASS, build complete in 93.9s - - - - -
L1 CPUExecutionProvider / cpu fp32 PASS 20.82 ms 20.56 ms 48.03 samples/s +404.9 MB -
L1 CPUExecutionProvider / cpu fp16 PASS 22.90 ms 22.85 ms 43.66 samples/s +411.5 MB -
L2 CPUExecutionProvider / cpu fp32 PASS - - - - cosine 1.000000000, max_abs 0.000000358
L2 CPUExecutionProvider / cpu fp16 PASS - - - - cosine 1.000000000, max_abs 0.000606775
L3 CPUExecutionProvider / cpu fp32/fp16 CLI-BLOCKED - - - - Task 'tabular-classification' is not supported by winml eval

Structural checks: both artifacts load as ONNX IR 10 with input features [1, 7] and output logits [1, 1]. fp16 build reports Model Precision: fp16 and final artifact size is 192.6 MB vs 385.0 MB fp32.

Quality gates:

  • python -m pytest tests/unit/models/test_tabular_transformer.py tests/unit/loader/test_known_tasks.py tests/unit/inference/test_tasks.py --tb=short --no-cov -p no:cacheprovider: 67 passed.
  • uv run ruff check src/ tests/: All checks passed.
  • uv run mypy -p winml.modelkit: Success, no issues found in 411 source files.

Delta

The baseline could not emit a usable tabular recipe, so the PR adds the minimal class-wide support needed for this generic custom transformer tabular pattern:

  • Registers tabular-classification as a WinML task and maps it to Optimum text-classification only at the exporter boundary.
  • Adds TabularTransformerWrapper, exposing tensor features input and logits output while reusing the remote model's trained submodules and config normalization statistics.
  • Adds CPU fp32/fp16 recipes with features shape [1, 7], output logits, and trust_remote_code: true.

examples/recipes/README.md remains untouched.

Analyze summary

Static rule analysis completed for fp32 and fp16 with --ep all; this is compatibility analysis, not runtime execution.

Component-level summary:

Artifact Architecture coverage Mapping Actionable EP findings
fp32 normalization; projection; 32x Transformer encoder; classification head 1351 ops, model-root fallback tags from dynamo export QNN GPU partial: Reshape, Erf; Softmax unknown in accelerator rule data
fp16 normalization; projection; 32x Transformer encoder; classification head 1353 ops, model-root fallback tags from dynamo export QNN GPU partial: Reshape, Erf; Cast/Softmax unknown in accelerator rule data

Op-level summary:

Artifact Graph Dominant ops EP roll-up
fp32 1351 ops / 14 types Reshape 288; Transpose 224; Add 192; MatMul 160; Mul 128 TensorRT/OpenVINO: 1319 supported, 32 unknown; QNN: 1031 supported, 288 partial, 32 unknown; CUDA/MIGraphX/DML: no rule data
fp16 1353 ops / 15 types Reshape 288; Transpose 224; Add 192; MatMul 160; Mul 128 TensorRT/OpenVINO: 1320 supported, 33 unknown; QNN: 1032 supported, 288 partial, 33 unknown; CUDA/MIGraphX/DML: no rule data

Reproduce commands

$OUT='temp/digitaledu-repro'
winml config -m SnowFlash383935/DigitalEduTransformers --task tabular-classification --trust-remote-code -o $OUT\config
winml build -c examples\recipes\SnowFlash383935_DigitalEduTransformers\cpu\cpu\tabular-classification_fp32_config.json -m SnowFlash383935/DigitalEduTransformers --trust-remote-code -o $OUT\fp32 --ep cpu --device cpu --no-analyze --no-optimize --no-quant --no-compile --rebuild
winml build -c examples\recipes\SnowFlash383935_DigitalEduTransformers\cpu\cpu\tabular-classification_fp16_config.json -m SnowFlash383935/DigitalEduTransformers --trust-remote-code -o $OUT\fp16 --ep cpu --device cpu --precision fp16 --no-analyze --no-optimize --no-compile --rebuild
winml perf -m $OUT\fp32\model.onnx --ep cpu --device cpu
winml perf -m $OUT\fp16\model.onnx --ep cpu --device cpu
winml eval --schema --task tabular-classification
winml analyze --model $OUT\fp32\model.onnx --ep all --output $OUT\fp32\analyze_all.json
winml analyze --model $OUT\fp16\model.onnx --ep all --output $OUT\fp16\analyze_all.json

--trust-remote-code is required for this checkpoint because Hugging Face must load custom auto_map code from the model repository.

@kujin66 kujin66 added the model-scale-by-skill Model support PR created or maintained by the adding-model-support skill label Jul 24, 2026
@kujin66
kujin66 force-pushed the kujin66/add-snowflash-digitaledu-transformers-codegen branch from 60c6ef3 to ce190c1 Compare July 24, 2026 03:38
@kujin66

kujin66 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

APPROVE (skill reviewer verdict)

Reviewed PR #1198 against the adding-model-support reviewer checklist.

  • Shipment state: draft PR, model-scale-by-skill label present, head ce190c164ea9b3112b028e354987a183a21d756d.
  • Diff scope: L2 Lane B task/architecture support. The diff contains the new tabular Transformer wrapper/export registration, task registry/inference mapping, CPU fp32/fp16 recipes, and targeted tests; examples/recipes/README.md is untouched.
  • Required PR hierarchy: Summary, Model metadata, and Validation/support evidence are present with Baseline, Goal, Outcome, per-EP/device/precision results, Delta, Analyze summary, and Reproduce commands.
  • Verification evidence: --trust-remote-code config/build path is documented; CPU fp32/fp16 L0 build, L1 perf, L2 PyTorch-vs-ONNX comparison, fp32/fp16 analyze, and L3 CLI blocker are recorded.
  • Engineering review: wrapper exposes the trained remote model through tensor features -> logits without hardcoding a model id in shared code; OnnxConfig dynamic axes match the recipe; task boundary maps tabular-classification to Optimum text-classification only at the exporter edge.
  • GitHub checks on reviewed SHA: Analyze (Python), lint, test (analyze), test (commands), test (models), test (optim), test (remaining), CodeQL, and license/cla all completed successfully.
  • Review threads/comments: REST line comments empty; issue comments empty before this verdict; GraphQL reviewThreads empty.

No requested changes. Leave the PR in draft state per skill workflow.

@kujin66
kujin66 marked this pull request as ready for review July 30, 2026 03:59
@kujin66
kujin66 requested a review from a team as a code owner July 30, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

model-scale-by-skill Model support PR created or maintained by the adding-model-support skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant