Skip to content

feat: add --dry-run VRAM/size estimation mode#1958

Open
mvanhorn wants to merge 3 commits into
intel:mainfrom
mvanhorn:osc/feat-dry-run
Open

feat: add --dry-run VRAM/size estimation mode#1958
mvanhorn wants to merge 3 commits into
intel:mainfrom
mvanhorn:osc/feat-dry-run

Conversation

@mvanhorn

Copy link
Copy Markdown

Re-submit of #1592, reworked per your feedback. The VRAM estimate is now built on auto-round's own block-wise memory model instead of a raw parameter count:

  • Reuses auto_round.utils.device.estimate_tuning_block_mem and get_moe_memory_ratio (@xin3he's card_0 = block_input_output + layer_activation + additional formula).
  • Models peak memory at decoder-block granularity (@wenhuach21).
  • Excludes the block input/output cache when low_gpu_mem_usage is set, and includes it otherwise (@wenhuach21's caching point).
  • MoE handled via get_moe_memory_ratio; layer/hidden-size discovery is robust across config field names and nested configs (text_config etc.) since num_hidden_layers doesn't cover every model (@xin3he).
  • Loads AutoConfig only, no weights.

Unit tests cover helper reuse, the low_gpu_mem_usage path, MoE, and layer-count fallbacks (8 passing). Supersedes #1592 (couldn't reopen after the rebase).

mvanhorn and others added 3 commits June 27, 2026 10:27
Adds a --dry-run flag that estimates peak block-tuning VRAM, output size,
and approximate time from the model config alone (AutoConfig only, no
weights). The VRAM estimate is built on auto-round's own block-wise memory
model, reusing auto_round.utils.device.estimate_tuning_block_mem and
get_moe_memory_ratio per maintainer feedback on intel#1592:

- peak memory at decoder-block granularity (card_0 = block I/O cache +
  layer activations + additional overhead)
- block input/output cache excluded when low_gpu_mem_usage is set
- MoE handled via get_moe_memory_ratio
- robust layer/hidden-size discovery across config field names and nested
  (text_config etc.) configs

Adds unit tests for helper reuse, the low_gpu_mem_usage path, MoE, and
layer-count fallbacks.

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
for more information, see https://pre-commit.ci

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Matches the codebase convention (calib_dataset.py, utils/model.py) where
every optional modelscope import carries a pylint E0401 disable, since
modelscope is not in requirements. Fixes the Code-Scan-AutoRound failure.

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
@mvanhorn

Copy link
Copy Markdown
Author

Pushed a fix for the two red checks:

  • Code-Scan (pylint E0401): the optional modelscope import in _load_auto_config now carries # pylint: disable=E0401, matching how calib_dataset.py and utils/model.py handle modelscope (it's not in requirements). Scan is now 10.00/10 locally.
  • DCO: signed off all commits on the branch.

@wenhuach21

Copy link
Copy Markdown
Contributor

Hi, thanks for the PR! It would be very useful if the estimation is both general and accurate.

Could you kindly share some evaluation results demonstrating its accuracy? It would be helpful to include results covering an LLM, a VLM, and an MoE model.

@mvanhorn

mvanhorn commented Jul 8, 2026

Copy link
Copy Markdown
Author

Happy to. Since --dry-run estimates VRAM/size analytically from the model config rather than measuring on hardware, I can put together a table comparing the estimate against the theoretical footprint (param count x bit-width, plus the group/zp/scale overhead the estimator accounts for) for a representative LLM, VLM, and MoE. That validates the estimation math end to end without needing a specific GPU.

Where I'd lean on you: confirming the estimate against actual measured peak VRAM on real hardware for those three model classes - you're better set up for that than I am. If a config-vs-theoretical table plus your measured spot-check works, I'll post the table. Which three models would you want represented (so the numbers match something you can cross-check)?

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]: dry-run estimation should fall back to text_config for Qwen3.5-MoE [Feature]: add --dry-run estimation mode

2 participants