Skip to content

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

Fix cuda test and llmc test (#1152)

Sun, Xuehao07c9f634c38d
diff --git a/.azure-pipelines/scripts/ut/run_ut_cuda.sh b/.azure-pipelines/scripts/ut/run_ut_cuda.sh
index e675e12d5..18a9bb00d 100644
--- a/.azure-pipelines/scripts/ut/run_ut_cuda.sh
+++ b/.azure-pipelines/scripts/ut/run_ut_cuda.sh
@@ -34,7 +34,7 @@ function create_conda_env() {
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=$(python -c "import site; print(site.getsitepackages()[0])")/nvidia/nvjitlink/lib:$LD_LIBRARY_PATH
fi
- uv pip install -v --no-build-isolation .
+ uv pip install --no-build-isolation .
uv pip install pytest-cov pytest-html cmake==4.0.2
uv pip install torch==2.8.0 torchvision
}
@@ -108,7 +108,7 @@ function run_unit_test() {
local auto_round_path=$(python -c 'import auto_round; print(auto_round.__path__[0])')
# run unit tests individually with separate logs
- for test_file in $(find . -name "test_*.py" ! -name "test_*vlms.py" | sort); do
+ for test_file in $(find . -name "test_*.py" ! -name "test_*vlms.py" ! -name "test_llmc*.py" | sort); do
local test_basename=$(basename ${test_file} .py)
local ut_log_name=${LOG_DIR}/unittest_cuda_${test_basename}.log
echo "Running ${test_file}..."
@@ -162,8 +162,39 @@ function run_unit_test_vlm() {
fi
}
+function run_unit_test_llmc() {
+ # install unit test dependencies
+ create_conda_env
+
+ cd ${REPO_PATH}/test/test_cuda
+ rm -rf .coverage* *.xml *.html
+
+ uv pip install -r requirements_llmc.txt
+
+ pip list > ${LOG_DIR}/llmc_ut_pip_list.txt
+ export COVERAGE_RCFILE=${REPO_PATH}/.azure-pipelines/scripts/ut/.coverage
+ local auto_round_path=$(python -c 'import auto_round; print(auto_round.__path__[0])')
+
+ # run unit tests individually with separate logs
+ for test_file in $(find . -name "test_llmc*.py" | sort); do
+ local test_basename=$(basename ${test_file} .py)
+ local ut_log_name=${LOG_DIR}/unittest_cuda_llmc_${test_basename}.log
+ echo "Running ${test_file}..."
+
+ python -m pytest --cov="${auto_round_path}" --cov-report term --html=report_llmc.html --self-contained-html --cov-report xml:coverage_llmc.xml --cov-append -vs --disable-warnings ${test_file} 2>&1 | tee ${ut_log_name}
+ done
+
+ mv report_llmc.html ${LOG_DIR}/
+ mv coverage_llmc.xml ${LOG_DIR}/
+ # Print test results table and check for failures
+ if ! print_test_results_table "unittest_cuda_llmc_test_*.log" "CUDA LLMC Tests"; then
+ echo "Some CUDA LLMC tests failed. Please check the individual log files for details."
+ fi
+}
+
function main() {
run_unit_test_vlm
+ run_unit_test_llmc
run_unit_test
cat ${SUMMARY_LOG}
}
diff --git a/.azure-pipelines/unit-test-hpu.yml b/.azure-pipelines/unit-test-hpu.yml
index 490173d50..68fad3fa2 100644
--- a/.azure-pipelines/unit-test-hpu.yml
+++ b/.azure-pipelines/unit-test-hpu.yml
@@ -21,6 +21,8 @@ pr:
- auto_round/export/export_to_awq
- "*.md"
- "**/*.md"
+ - .azure-pipelines/scripts/ut/run_ut_cuda.sh
+ - .azure-pipelines/scripts/ut/run_ut.sh
pool: GAUDI
diff --git a/.azure-pipelines/unit-test.yml b/.azure-pipelines/unit-test.yml
index b958a45e7..d10e47ca7 100644
--- a/.azure-pipelines/unit-test.yml
+++ b/.azure-pipelines/unit-test.yml
@@ -22,6 +22,8 @@ pr:
- test/test*hpu*
- "*.md"
- "**/*.md"
+ - .azure-pipelines/scripts/ut/run_ut_hpu.sh
+ - .azure-pipelines/scripts/ut/run_ut_cuda.sh
pool: ICX-16C
diff --git a/test/test_cuda/requirements.txt b/test/test_cuda/requirements.txt
index 86c0435c7..e7dd4e0d8 100644
--- a/test/test_cuda/requirements.txt
+++ b/test/test_cuda/requirements.txt
@@ -1,8 +1,6 @@
-# autoawq
# pip install -v git+https://github.com/casper-hansen/AutoAWQ.git --no-build-isolation
auto-gptq
einops
-# gptqmodel>=2.0
# pip install -v git+https://github.com/ModelCloud/[email protected] --no-build-isolation
intel-extension-for-pytorch
lm-eval>=0.4.9.1
@@ -12,5 +10,4 @@ parameterized
pillow
torchvision
numba
-vllm>=0.8.5.post1
-llmcompressor @ git+https://github.com/vllm-project/llm-compressor.git@main
\ No newline at end of file
+vllm>=0.8.5.post1,<=0.11.0
diff --git a/test/test_cuda/requirements_llmc.txt b/test/test_cuda/requirements_llmc.txt
new file mode 100644
index 000000000..b11e53b7a
--- /dev/null
+++ b/test/test_cuda/requirements_llmc.txt
@@ -0,0 +1,2 @@
+llmcompressor @ git+https://github.com/vllm-project/llm-compressor.git@main
+parameterized