feat: Add export override options to winml eval command#1141
Open
xieofxie wants to merge 1 commit into
Open
Conversation
Bring winml eval to parity with build/perf by adding --shape-config, --input-specs, --export-config, and --dynamic-axes. These shape the ONNX export when eval builds from a HuggingFace model ID and are ignored (with a warning) for pre-built ONNX inputs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings
winml evalto parity withwinml buildandwinml perfby adding four export override options:--shape-config— JSON shape overrides for the auto-generated HuggingFace export config--input-specs— JSON input tensor specs merged into the HuggingFace export config (symbolic dims infer dynamic axes)--export-config— JSON ONNX export config overrides (opset version, constant folding, etc.)--dynamic-axes— JSON dynamic axes mapping for HuggingFace ONNX exportThese options shape the ONNX export that
evalgenerates when-mis a HuggingFace model ID. When-mis a pre-built.onnxfile there is no export step, so the flags are ignored and the command prints a warning.Changes
eval/config.py— addedshape_configandexport_overridesfields toWinMLEvaluationConfig, JSON-safe serialization ofInputTensorSpecvalues, andto_dict/from_dictsupport.eval/evaluate.py—_load_modelthreads{"export": ...}overrides plusshape_configintoWinMLAutoModel.from_pretrainedon the HuggingFace build path; thefrom_onnxpath is unchanged.commands/eval.py— added the four option decorators/params and an_apply_export_overrideshelper that parses the JSON and warns + skips for pre-built ONNX inputs.docs/commands/eval.md— documented the four flags and added a pitfall note.TestEvalExportOverrides(10 cases) and updated the existingfrom_pretrainedassertion for the newshape_configkwarg.Verification
uv run pytest tests/unit/commands/test_eval.py tests/unit/eval/test_eval.py→ 103 passeduv run ruff check→ clean