feat(build): optional -c/--config, auto field, autoconf UX (#477)#603
Closed
DingmaomaoBJTU wants to merge 3 commits into
Closed
feat(build): optional -c/--config, auto field, autoconf UX (#477)#603DingmaomaoBJTU wants to merge 3 commits into
DingmaomaoBJTU wants to merge 3 commits into
Conversation
Contributor
|
tests need fixed |
xieofxie
reviewed
May 13, 2026
| default=None, | ||
| help="WinMLBuildConfig JSON file. If omitted, config is auto-generated from -m.", | ||
| ) | ||
| @click.option( |
xieofxie
reviewed
May 13, 2026
| raise click.UsageError("-m/--model is required when -c is not provided.") | ||
| from ..config import generate_build_config | ||
|
|
||
| config_or_configs = generate_build_config( |
Contributor
There was a problem hiding this comment.
interesting that we do not have a flag in this function but have to generate everything and set to None afterwards..
xieofxie
reviewed
May 13, 2026
| console, | ||
| model=model_id or "random-init", | ||
| config=Path(config_file).name, | ||
| config=Path(config_file).name if config_file else "(auto)", |
xieofxie
reviewed
May 13, 2026
| result.update( | ||
| { | ||
| "export": self.export.to_dict() if self.export is not None else None, | ||
| "optim": self.optim.to_dict(), |
Contributor
There was a problem hiding this comment.
should we also support non-optim?
xieofxie
reviewed
May 13, 2026
| # 5-row block-letter art for "WinML CLI". '#' = filled pixel, ' ' = empty. | ||
| # All letters use the same █ character so identical shapes (i vs I) look | ||
| # consistent regardless of horizontal position. | ||
| _LETTER_ART: dict[str, list[str]] = { |
Contributor
There was a problem hiding this comment.
forget to merge main? https://github.com/microsoft/WinML-ModelKit/pull/572/changes
Port winml build UX improvements from #477: - -c/--config is now optional; omit it to auto-generate config from -m (-m becomes required when -c is omitted) - WinMLBuildConfig gains auto: bool = True; pipeline sets it to False after the optimize+autoconf loop and saves it into winml_build_config.json so subsequent runs skip the analyzer on reuse - Setup header shows (autoconf on)/(autoconf off) next to config name - Summary section prints the saved config path after the final artifact
test_build_omit_config_requires_model timed out in CI (26 min) because `winml build -o out/` (no -c, no -m) passed the output/cache check then hit WinMLEPRegistry.get_instance() — which loads native DLLs — before reaching the UsageError for missing -m. Move the config-file-less model check before the EP auto-selection block so the error is raised cheaply without touching hardware.
- Use @build_config_option from cli_utils for -c/--config (replaces inline @click.option, gains path_type=Path so config_file is Path|None) - Add _CONFIG_AUTO_LABEL = "(auto)" module-level const; replace all string literals "(auto)" with it - Fix no_compile check in auto-generate path: `if no_compile is True` (matches tristate from #570 — None means inherit, not skip) - Add None guard for optim in to_dict() for parity with export/quant/compile - Rebase onto main: drops redundant banner commit (already merged as #572)
6ecd0fa to
f842a12
Compare
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
Port
winml buildUX improvements from #477:-c/--config: omit it to auto-generate the build config from-m <model>directly (one-step workflow;-mbecomes required when-cis omitted)WinMLBuildConfig.autofield (defaultTrue): the build pipeline sets it toFalseafter the optimize + autoconf loop and saves it intowinml_build_config.json— marks the config as "already resolved" so CI/CD pipelines or subsequentwinml build -cruns skip the analyzer on reuse(autoconf on)/(autoconf off)next to the config nameChanged files
src/winml/modelkit/config/build.pyauto: bool = TruetoWinMLBuildConfig;to_dict()omits it whenTrue, writes"auto": falsewhenFalse;generate_cache_key()excludes itsrc/winml/modelkit/build/common.pyrun_optimize_analyze_loop()respectsauto=False(skips autoconf) and setsconfig.auto = Falseafter the loopsrc/winml/modelkit/commands/build.py-cmade optional; auto-generate config path; passautotoprint_setup; pass config path toprint_finalsrc/winml/modelkit/utils/console.pyprint_setup()shows autoconf status;print_final()prints saved config pathtests/cli/test_main.pyTestBuildCommandArgs: arg-validation tests for optional-ctests/unit/config/test_build.pyTestWinMLBuildConfigAutoField: roundtrip and serialization tests forautofield