[Feature]: speedup autoscheme with multi-process and cache files#2083
Open
xin3he wants to merge 21 commits into
Open
[Feature]: speedup autoscheme with multi-process and cache files#2083xin3he wants to merge 21 commits into
xin3he wants to merge 21 commits into
Conversation
…oad functionality
…prepare_model_low_gpu
…yers to accept both space-separated and comma-separated formats
… improve memory monitoring
for more information, see https://pre-commit.ci
4 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR speeds up AutoScheme by adding per-scheme, per-op score caching and optional multi-process scheme scoring, reducing repeated sensitivity evaluation cost across runs. It also broadens related CLI parsing and model-free export support to better interoperate with AutoScheme outputs.
Changes:
- Add per-scheme JSON caching (per-op layer scores) and multiprocessing-based scoring with serial fallback in AutoScheme.
- Improve CLI ergonomics for AutoScheme flags (
--options,--shared_layers) and consolidate/expand CPU tests around the new behaviors. - Extend model-free pathways with BF16 handling and MXFP “auto_round” metadata support; add unified
load_modelhelper and adjust device/memory utilities.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/test_cpu/utils/test_cli_usage.py | Adds tests for comma/space normalization of --options and --shared_layers. |
| test/test_cpu/schemes/test_auto_scheme.py | Adds tests for env overrides, cache files, cache key behavior, multiprocessing helpers, and expert grouping; consolidates prior internal tests. |
| test/test_cpu/schemes/test_auto_scheme_internal.py | Removes now-duplicated internal tests (moved into test_auto_scheme.py). |
| test/test_cpu/quantization/test_model_free.py | Expands model-free tests for BF16 and MXFP auto_round-format metadata output. |
| test/helpers.py | Updates the MoE reference model ID used by fixtures. |
| test/fixtures.py | Updates tiny MoE fixture generation (from-config) and workspace cleanup paths. |
| auto_round/utils/model.py | Introduces unified load_model() dispatching across LLM/MLLM/diffusion. |
| auto_round/utils/device.py | Replaces expensive partitioning with greedy balancing; adds process-tree RSS accounting. |
| auto_round/utils/device_manager.py | Hardens total-memory querying across backends and improves error handling. |
| auto_round/modeling/fused_moe/replace_modules.py | Adjusts safe_to_cpu_ to avoid .to("cpu") when meta tensors exist. |
| auto_round/compressors/model_free.py | Adds BF16 support, MXFP auto_round-style quantization_config generation, and better AutoScheme option validation/conversion. |
| auto_round/cli/parser.py | Makes --options accept multiple args; clarifies --shared_layers help text. |
| auto_round/cli/main.py | Normalizes new --options/--shared_layers argument shapes before constructing AutoScheme. |
| auto_round/auto_scheme/utils.py | Improves scheme-loss matrix headers (supports expert column). |
| auto_round/auto_scheme/delta_loss.py | Implements per-scheme cache, multiprocessing scoring workers, safer grad/progress handling, and uses unified load_model(). |
Signed-off-by: Xin He <xin3.he@intel.com>
Signed-off-by: Xin He <xin3.he@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Feature Description
Save and use cached per-op score files to skip time-consuming sensitivity evaluation.
Enable multi-process to speedup the evaluation. It will fallback if multi-process fails, like OOM.
Motivation and Use Case
For LLM, like GLM5.2, the AutoScheme usually takes 1h.
For different bits and shared_layers, we usually need to re-run the entire AutoScheme process, which is not necessary if we cache the per-op score.
Real model test
Type of Change
New feature
Related Issues
Fixes or relates to #2080 #1988
Checklist Before Submitting
/azp run Unit-Test-CUDA-AutoRound.