feat: add --dry-run VRAM/size estimation mode#1958
Conversation
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>
4649988 to
700c697
Compare
|
Pushed a fix for the two red checks:
|
|
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. |
|
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)? |
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:
auto_round.utils.device.estimate_tuning_block_memandget_moe_memory_ratio(@xin3he'scard_0 = block_input_output + layer_activation + additionalformula).low_gpu_mem_usageis set, and includes it otherwise (@wenhuach21's caching point).get_moe_memory_ratio; layer/hidden-size discovery is robust across config field names and nested configs (text_configetc.) sincenum_hidden_layersdoesn't cover every model (@xin3he).AutoConfigonly, no weights.Unit tests cover helper reuse, the
low_gpu_mem_usagepath, MoE, and layer-count fallbacks (8 passing). Supersedes #1592 (couldn't reopen after the rebase).