@@ -436,22 +436,23 @@ def _validate_loader_tasks_for_model(
436436 help = "Output directory for all build artifacts" ,
437437)
438438@click .option (
439- "--use-cache" ,
440- is_flag = True ,
439+ "--use-cache/--no-use-cache" ,
441440 default = False ,
441+ show_default = True ,
442442 help = "Use WinML CLI global cache (~/.cache/winml/). Mutually exclusive with -o." ,
443443)
444444@click .option (
445- "--rebuild" ,
446- is_flag = True ,
445+ "--rebuild/--no-rebuild" ,
447446 default = False ,
447+ show_default = True ,
448448 help = "Overwrite existing artifacts and rebuild" ,
449449)
450450@click .option (
451- "--no-quant" ,
452- is_flag = True ,
453- default = False ,
454- help = "Skip quantization (overrides config)" ,
451+ "--quant/--no-quant" ,
452+ "quant" ,
453+ default = True ,
454+ show_default = True ,
455+ help = "Enable quantization (use --no-quant to skip, overrides config)" ,
455456)
456457@click .option (
457458 "--no-compile/--compile" ,
@@ -472,16 +473,18 @@ def _validate_loader_tasks_for_model(
472473 optional_message = "Default: auto-detect." ,
473474)
474475@click .option (
475- "--no-analyze" ,
476- is_flag = True ,
477- default = False ,
478- help = "Skip analyzer loop during build" ,
476+ "--analyze/--no-analyze" ,
477+ "analyze" ,
478+ default = True ,
479+ show_default = True ,
480+ help = "Run analyzer loop during build (use --no-analyze to skip)" ,
479481)
480482@click .option (
481- "--no-optimize" ,
482- is_flag = True ,
483- default = False ,
484- help = "Skip optimization (for pre-quantized ONNX models)" ,
483+ "--optimize/--no-optimize" ,
484+ "optimize" ,
485+ default = True ,
486+ show_default = True ,
487+ help = "Run optimization (use --no-optimize to skip for pre-quantized ONNX models)" ,
485488)
486489@click .option (
487490 "--max-optim-iterations" ,
@@ -503,12 +506,12 @@ def build(
503506 output_dir : str | None ,
504507 use_cache : bool ,
505508 rebuild : bool ,
506- no_quant : bool ,
509+ quant : bool ,
507510 no_compile : bool | None ,
508- no_optimize : bool ,
511+ optimize : bool ,
509512 ep : EPNameOrAlias | None ,
510513 device : str ,
511- no_analyze : bool ,
514+ analyze : bool ,
512515 max_optim_iterations : int | None ,
513516 allow_unsupported_nodes : bool ,
514517 trust_remote_code : bool ,
@@ -579,7 +582,7 @@ def build(
579582 if config_file is not None :
580583 config_or_configs = _load_config (
581584 config_file ,
582- no_quant = no_quant ,
585+ no_quant = not quant ,
583586 no_compile = no_compile ,
584587 )
585588 else :
@@ -592,7 +595,7 @@ def build(
592595 trust_remote_code = trust_remote_code ,
593596 device = device ,
594597 )
595- if no_quant :
598+ if not quant :
596599 config_or_configs .quant = None
597600 # Auto-generated configs: compile disabled by default unless
598601 # --compile was explicitly passed (no_compile=False).
@@ -610,7 +613,7 @@ def _patch_device(cfg: WinMLBuildConfig) -> None:
610613 from ..config import resolve_quant_compile_config
611614
612615 resolved_quant , _ = resolve_quant_compile_config (device = device , ep = ep )
613- if no_quant or resolved_quant is None :
616+ if not quant or resolved_quant is None :
614617 cfg .quant = None
615618 elif cfg .quant is None :
616619 # Populate calibration identifiers from the loader/model
@@ -643,9 +646,7 @@ def _patch_device(cfg: WinMLBuildConfig) -> None:
643646 # scratch state when the user passes the wrong file or a
644647 # hand-edited config (#P1 UX).
645648 _configs_to_validate : list [WinMLBuildConfig ] = (
646- config_or_configs
647- if isinstance (config_or_configs , list )
648- else [config_or_configs ]
649+ config_or_configs if isinstance (config_or_configs , list ) else [config_or_configs ]
649650 )
650651 try :
651652 for _cfg in _configs_to_validate :
@@ -661,9 +662,9 @@ def _patch_device(cfg: WinMLBuildConfig) -> None:
661662
662663 # Build extra kwargs for pipeline control
663664 extra_kwargs : dict [str , Any ] = {}
664- if no_optimize :
665+ if not optimize :
665666 extra_kwargs ["skip_optimize" ] = True
666- if no_analyze :
667+ if not analyze :
667668 extra_kwargs ["hack_max_optim_iterations" ] = 0
668669 elif max_optim_iterations is not None :
669670 extra_kwargs ["hack_max_optim_iterations" ] = max_optim_iterations
0 commit comments