Skip to content

feat(perf): show dynamic input dims as dynamic(<actual>) in model info#1055

Merged
xieofxie merged 4 commits into
mainfrom
hualxie/fix_batch
Jul 6, 2026
Merged

feat(perf): show dynamic input dims as dynamic(<actual>) in model info#1055
xieofxie merged 4 commits into
mainfrom
hualxie/fix_batch

Conversation

@xieofxie

@xieofxie xieofxie commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

The pre-benchmark model-info output previously printed dynamic input dimensions as None, which was ambiguous — it didn't convey that the axis was free, nor what size the generated benchmark data actually used.

This changes dynamic dims to render as dynamic(<actual>):

Before

Inputs:      pixel_values         [None, 3, 64, 64]        float32
Outputs:     logits               [None, 1000]

After

Inputs:      pixel_values         [dynamic(1), 3, 64, 64]  float32
Outputs:     logits               [dynamic, 1000]

The value in parentheses is the concrete size the generated input tensor actually used for that axis (e.g. the resolved batch size), so both facts stay visible: the model left the axis free, and the benchmark ran it at size N.

Changes

  • Added _format_input_shape(shape, actual) — maps each None dim to dynamic(<actual>), falling back to bare dynamic when no concrete shape is available; static dims are unchanged.
  • _print_model_info gained an actual_shapes param, threaded from self._inputs (name → real arr.shape) at the call site.
  • Added TestFormatInputShape covering single/multiple dynamic dims, all-static, and the no-actual fallback.

Close #1052

@xieofxie xieofxie requested a review from a team as a code owner July 6, 2026 03:19
@xieofxie

xieofxie commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

tested on

  • : dynamic model
  • : static model: if not match, will output
    [11:08:54 WARNING winml.modelkit.commands.perf] Requested --batch-size 10 could not be applied: the model's leading input dimension is statically 4. Throughput is scaled by the actual batch (4), not the requested value.

@xieofxie xieofxie merged commit a5cadea into main Jul 6, 2026
9 checks passed
@xieofxie xieofxie deleted the hualxie/fix_batch branch July 6, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: fix and verify batch for dynamic shape model, batch != 1 static shape model

2 participants