Skip to content

PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度

disable parallel for non low_gpu_mem_usage (#2116)

Xin He417d87de8322
diff --git a/auto_round/auto_scheme/delta_loss.py b/auto_round/auto_scheme/delta_loss.py
index 7a1584937..e362687e3 100644
--- a/auto_round/auto_scheme/delta_loss.py
+++ b/auto_round/auto_scheme/delta_loss.py
@@ -1858,11 +1858,19 @@ def _get_scheme_worker_count(num_schemes, num_gpus):
def _can_parallel_scheme_scoring(
- parallel_enabled, model_id, num_gpus, uncached_count, need_imatrix, disk_stream_model, is_vlm
+ parallel_enabled,
+ model_id,
+ num_gpus,
+ uncached_count,
+ need_imatrix,
+ disk_stream_model,
+ is_vlm,
+ low_gpu_mem_usage=True,
):
"""Return whether candidate schemes can be scored in separate workers."""
return (
parallel_enabled
+ and low_gpu_mem_usage
and model_id is not None
and num_gpus >= 1
and uncached_count >= 2
@@ -2441,6 +2449,7 @@ def _gen_layer_config(
need_imatrix,
worker_disk_stream_model,
is_vlm,
+ low_gpu_mem_usage=auto_scheme.low_gpu_mem_usage,
)
logger.info(
"AutoScheme scoring mode: parallel_configured=%s, parallel_enabled=%s, disk_stream_enabled=%s",
diff --git a/test/fixtures.py b/test/fixtures.py
index 6842f8c14..2f3ba0c40 100644
--- a/test/fixtures.py
+++ b/test/fixtures.py
@@ -405,6 +405,8 @@ def clean_tmp_model_folder():
shutil.rmtree("./tmp", ignore_errors=True) # unittest default workspace
shutil.rmtree("./ar_work_space", ignore_errors=True) # autoround default workspace
shutil.rmtree("./tmp_autoround", ignore_errors=True) # autoround default model output path
+ # autoround default AutoScheme cache path
+ shutil.rmtree(os.path.expanduser("~/.cache/auto_round"), ignore_errors=True)
# Create objective fixtures for testing