microsoft / microsoft/winml-cli
layoutlm + layoutlmv3 / document-question-answering: 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
All LayoutLM and LayoutLMv3 models fail on document-question-answering because the task is not registered in Optimum's TasksManager for these model types.
Eval Results (2026-03-11)
| Status | Model | model_type | Task | Error |
|---|---|---|---|---|
| FAIL | impira/layoutlm-document-qa | layoutlm | document-question-answering | Task 'document-question-answering' not supported by TasksManager |
| FAIL | impira/layoutlm-invoices | layoutlm | document-question-answering | same |
| FAIL | rubentito/layoutlmv3-base-mpdocvqa | layoutlmv3 | document-question-answering | same |
| FAIL | xhyi/layoutlmv3_docvqa_t11c5000 | layoutlmv3 | document-question-answering | same |
| FAIL | pardeepSF/layoutlm-vqa | bert | document-question-answering | same (bert model_type but doc-qa task) |
| FAIL | zpm/Llama-3.1-PersianQA | llama | document-question-answering | same (misrouted) |
6/6 models fail — 0 pass.
Root Cause
document-question-answering is not registered as a supported ONNX export task for layoutlm and layoutlmv3 model types in Optimum's TasksManager. These models support it at inference time, but the ONNX export path is not configured.
LayoutLM document-question-answering uses input_ids, attention_mask, token_type_ids, bbox (bounding boxes) — the non-standard bbox input means the standard question-answering ONNX config doesn't apply.
Note: zpm/Llama-3.1-PersianQA is misrouted as document-question-answering — it should be question-answering. Not a LayoutLM issue; tracked separately.
Current State
- No
layoutlm.pyorlayoutlmv3.pyinmodelkit/models/hf/ document-question-answeringtask has no ONNX config in Optimum for these model types- Optimum supports LayoutLM for some tasks — check what's available
Desired State
All 4 LayoutLM/LayoutLMv3 models pass wmk perf.
Acceptance Criteria
-
impira/layoutlm-document-qaandimpira/layoutlm-invoicespasswmk perf -
rubentito/layoutlmv3-base-mpdocvqaandxhyi/layoutlmv3_docvqa_t11c5000passwmk perf - Fix is universal — no hardcoded model names (CLAUDE.md Cardinal Rule #1)
-
uv run pytest tests/passes (CLAUDE.md Cardinal Rule #3)
Technical Notes
- Register
document-question-answeringtask forlayoutlmandlayoutlmv3via@register_onnx_overwrite() - The ONNX config must include the
bboxinput tensor (shape:[batch, seq, 4], dtype int64) — this is non-standard and requires a customLayoutLMIOConfig - LayoutLMv3 also takes
pixel_valuesin addition to text inputs — multimodal input handling required - Check Optimum's source for existing
LayoutLMOnnxConfig/LayoutLMv3OnnxConfigto see if they can be adapted
Related Files
modelkit/models/hf/bert.py— pattern for custom ONNX config with custom inputsmodelkit/export/io.py—register_onnx_overwrite()eval_results/2026-03-11/models/impira__layoutlm-document-qa__document-question-answering/result.jsoneval_results/2026-03-11/models/rubentito__layoutlmv3-base-mpdocvqa__document-question-answering/result.json
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/hf/bert.py and modelkit/export/io.py, then inspect Optimum's existing LayoutLMOnnxConfig and LayoutLMv3OnnxConfig support. Run the affected wmk perf evaluations and review the listed result.json files to confirm the failure. Done means all four LayoutLM/LayoutLMv3 models pass wmk perf and uv run pytest tests/ passes without hardcoded model names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100