NVIDIA / NVIDIA/Model-Optimizer

Diffusers Example quantize.py: --calib-size help text is misleading (acts as number of samples/prompts, not “calibration steps”). Suggest clearer name/alias and ceil batching.

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

@jingyu-ml is already working on this.

Since Nov 17, 2025.

documentation feature request investigating torch.quantization
Dominant language
Python
Stars
3.8k
Forks
604
Avg merge
2d 8h
Merged PRs (30d)
142

Description

The CLI flag --calib-size is documented as:

“Number of calibration steps.”

But in the script it’s used as the number of calibration samples/prompts, then divided by --batch-size to compute how many batches to run once. This is easy to misinterpret as “steps/epochs.”

Concretely, the code does:
• args.calib_size = args.calib_size // args.batch_size
• do_calibrate(...) iterates over batches of prompts and breaks when i >= calib_size (so: one pass, limited to that many batches).

Result: --calib-size 128 --batch-size 2 runs 64 batches × 2 prompts = 128 images total, not “128 calibration steps.”

This confused me because “steps” usually implies repeated passes/epochs, not “samples.”

FWIW, the Model Optimizer docs describe PTQ calibration as running on a small set of samples (typically 128–512), which matches the implementation, so the help text should say “samples/prompts,” not “steps.” 

Proposed fix (backward-compatible)
Clarify the help text and add an alias that reflects the actual meaning:

$-$ parser.add_argument("--calib-size", type=int, default=128,
$-$ help="Number of calibration steps.")
$+$ parser.add_argument("--calib-size", "--calib-samples", dest="calib_size",
$+$ type=int, default=128,
$+$ help="Number of calibration samples (prompts/images). "
$+$ "Internally divided by --batch-size to compute how many batches to run once.")

Why this matters
• Prevents users from over- or under-estimating calibration runtime (especially at high resolutions/long --n-steps).
• Aligns the CLI with the docs’ guidance that PTQ uses a small number of samples (128–512), not multiple epochs. 

Thanks for considering! Happy to submit a PR with the above diff if that helps.

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.