microsoft / microsoft/winml-cli
gpt2 / text-generation: all models pass wmk perf
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40
- Forks
- 11
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 50
Description
Summary
openai-community/gpt2 export completes successfully but wmk perf fails because WinMLModelForCausalLM is not implemented — the inference wrapper for text-generation falls back to WinMLModelForGenericTask which does not handle autoregressive decoding correctly.
Eval Results (2026-03-11)
| Status | Model | Task | Error |
|---|---|---|---|
| FAIL | openai-community/gpt2 | text-generation | Export completes; perf fails (WinMLModelForCausalLM not implemented) |
1/1 gpt2 model fails.
Note: All Qwen2/Qwen3 text-generation models fail for the same root cause (tracked in issue #432).
Root Cause
modelkit/models/winml/__init__.py:37 maps text-generation → WinMLModelForCausalLM, but WinMLModelForCausalLM is not in the _import_winml_class() map. The fallback to WinMLModelForGenericTask does not provide autoregressive decoding, so the benchmark either produces wrong output or crashes.
Unlike Qwen2/Qwen3, GPT-2 is small enough that the ONNX export succeeds (no protobuf size issue) — the only blocker is the missing inference class.
Current State
modelkit/models/winml/__init__.py:37—"text-generation": "WinMLModelForCausalLM"(mapped but not implemented)_import_winml_class()(modelkit/models/winml/__init__.py:56-91) — no entry forWinMLModelForCausalLM- GPT-2 export path works (confirmed by stdout showing completed build stages)
Desired State
openai-community/gpt2 / text-generation passes wmk perf.
Acceptance Criteria
-
openai-community/gpt2passeswmk perf -
WinMLModelForCausalLMimplemented as a proper inference wrapper - Fix also unblocks Qwen2/Qwen3 smaller models once their ONNX size issue is resolved (#432)
- Fix is universal — works for any causal LM, not just GPT-2 (CLAUDE.md Cardinal Rule #1)
-
uv run pytest tests/passes (CLAUDE.md Cardinal Rule #3)
Technical Notes
WinMLModelForCausalLMneeds to: load ONNX session, generateinput_ids, run a single forward pass (not full generation loop for benchmarking), return logits- For
wmk perfpurposes, a single forward pass with fixedinput_idsis sufficient — no need to implement full greedy/beam decode - Check
modelkit/models/winml/sequence_classification.pyas implementation pattern - GPT-2 ONNX inputs:
input_ids(int64, shape [batch, seq]) + optionallyattention_mask— confirm viawmk inspect -m openai-community/gpt2
Related Files
modelkit/models/winml/__init__.py:37,56-91— task mapping and class importmodelkit/models/winml/sequence_classification.py— implementation patternmodelkit/models/winml/image_classification.py— another patterneval_results/2026-03-11/models/openai-community__gpt2__text-generation/result.json
References
- Related: issue #432 (Qwen2/Qwen3 text-generation) — same missing class
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with modelkit/models/winml/init.py, especially _import_winml_class(), and compare modelkit/models/winml/sequence_classification.py and image_classification.py. Run wmk inspect -m openai-community/gpt2 to confirm the ONNX inputs, then use the existing evaluation result as a baseline. Done means GPT-2 passes wmk perf, the causal-LM wrapper is mapped universally, and uv run pytest tests/ passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100