microsoft / microsoft/winml-cli

All model commands should accept model name or ONNX path as a positional argument

Open
#447 0 comments 0 reactions 1 assignee View on GitHub

@hi-brenda is already working on this.

Since May 7, 2026.

dev experience P2 triaged
Dominant language
Python
Stars
40
Forks
11
Avg merge
1d 8h
Merged PRs (30d)
50

Description

Summary

Every command that takes a model input requires -m / --model flag syntax. No command accepts the model name or ONNX file path as a positional argument. This makes the natural follow-on from winml hubwinml inspect ProsusAI/finbert — fail, and equally natural ONNX workflows — winml analyze model.onnx — also fail. The correct syntax is undiscoverable without reading --help.

Motivation

The natural mental model after browsing winml hub or exporting a model is:

# After browsing catalog
winml inspect ProsusAI/finbert
winml perf ProsusAI/finbert
winml build ProsusAI/finbert -o ./

# After exporting to ONNX
winml analyze model.onnx
winml optimize model.onnx -o optimized/
winml quantize model.onnx -o quantized/
winml compile model.onnx --ep qnn -o compiled/
winml perf model.onnx

None of these work today. Every command requires -m:

winml inspect -m ProsusAI/finbert
winml analyze -m model.onnx
winml perf -m model.onnx

The winml hub output gives no hint that -m is required. The flag is undiscoverable without reading --help — a friction point that catches every new user on their first command after browsing the catalog or exporting a model.

Affected Commands

All 10 commands that accept a model input use --model / -m with no positional fallback:

Command Accepts Current Should also accept
inspect HF model ID, ONNX path winml inspect -m MODEL winml inspect MODEL
analyze HF model ID, ONNX path winml analyze -m MODEL winml analyze MODEL
perf HF model ID, ONNX path winml perf -m MODEL winml perf MODEL
export HF model ID winml export -m MODEL winml export MODEL
build HF model ID, ONNX path winml build -c cfg -m MODEL -o out/ winml build MODEL -c cfg -o out/
config HF model ID, ONNX path winml config -m MODEL winml config MODEL
compile ONNX path winml compile -m model.onnx winml compile model.onnx
optimize ONNX path winml optimize -m model.onnx winml optimize model.onnx
quantize ONNX path winml quantize -m model.onnx winml quantize model.onnx
eval HF model ID, ONNX path winml eval -m MODEL winml eval MODEL

Proposed Solution

Add MODEL as an optional click.argument with required=False to each command. If both the positional arg and -m are provided, -m wins (backward-compatible). If neither is provided, existing error handling applies unchanged.

@click.argument("model_arg", required=False, default=None, metavar="MODEL")
@click.option("-m", "--model", "model_id", default=None, ...)
def inspect(model_arg, model_id, ...):
    model_id = model_id or model_arg
    ...

The metavar should reflect what each command accepts:

  • Commands accepting both HF IDs and ONNX paths: metavar="MODEL_OR_ONNX"
  • Commands accepting only ONNX paths (compile, optimize, quantize): metavar="MODEL_ONNX"
  • Commands accepting only HF IDs (export): metavar="MODEL"

Acceptance Criteria

  • All 10 affected commands accept an optional positional argument for the model input
  • Positional arg and -m flag are mutually usable; -m takes precedence if both are supplied
  • winml inspect ProsusAI/finbert works identically to winml inspect -m ProsusAI/finbert
  • winml analyze model.onnx works identically to winml analyze -m model.onnx
  • --help output for each command shows the positional in the usage line with appropriate metavar
  • No regression in existing -m flag behavior
  • winml hub / winml catalog output includes a hint line referencing the positional form

Related

  • #413 — winml hub → winml catalog rename (hub is the entry point that exposes this gap)
  • #442 — winml flow (guided pipeline — positional arg is especially important here)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.