PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度
Fix CUDA UT and HPU UT (#1514)
Sun, Xuehao89f99ae0beb5
diff --git a/.azure-pipelines/scripts/ut/run_ut_cuda.sh b/.azure-pipelines/scripts/ut/run_ut_cuda.shindex ba823a8bf..bab846abb 100644--- a/.azure-pipelines/scripts/ut/run_ut_cuda.sh+++ b/.azure-pipelines/scripts/ut/run_ut_cuda.sh@@ -27,13 +27,10 @@ function create_conda_env() {# install AutoRoundcd ${REPO_PATH}- uv pip install torch==2.10.0 torchvision- uv pip install -r requirements.txtif [ -d "/proc/driver/nvidia" ]; thenexport PATH=/usr/local/cuda/bin${PATH:+:${PATH}}export LD_LIBRARY_PATH=$(python -c "import site; print(site.getsitepackages()[0])")/nvidia/nvjitlink/lib:$LD_LIBRARY_PATHfi- uv pip install --no-build-isolation .uv pip install pytest-cov pytest-html cmake}@@ -94,6 +91,7 @@ function run_unit_test() {cd ${REPO_PATH}/testrm -rf .coverage* *.xml *.html+ uv pip install torch==2.10.0 torchvisionuv pip install -v git+https://github.com/casper-hansen/AutoAWQ.git --no-build-isolationuv pip install gptqmodel --no-build-isolationuv pip install -r https://raw.githubusercontent.com/ModelCloud/GPTQModel/refs/heads/main/requirements.txt@@ -101,8 +99,8 @@ function run_unit_test() {uv pip install 'git+https://github.com/ggml-org/llama.cpp.git#subdirectory=gguf-py'uv pip install -r test_cuda/requirements.txtuv pip install -r test_cuda/requirements_diffusion.txt- uv pip install torch==2.10.0 torchvisionuv pip install -U transformers+ cd ${REPO_PATH} && uv pip install . && cd ${REPO_PATH}/testpip list > ${LOG_DIR}/ut_pip_list.txtexport COVERAGE_RCFILE=${REPO_PATH}/.azure-pipelines/scripts/ut/.coverage@@ -117,8 +115,10 @@ function run_unit_test() {python -m pytest --cov="${auto_round_path}" --cov-report term --html=report.html --self-contained-html --cov-report xml:coverage.xml --cov-append -vs --disable-warnings ${test_file} 2>&1 | tee ${ut_log_name}done- mv report.html ${LOG_DIR}/- mv coverage.xml ${LOG_DIR}/+ if [ -f "report.html" ] && [ -f "coverage.xml" ]; then+ mv report.html ${LOG_DIR}/+ mv coverage.xml ${LOG_DIR}/+ fi# Print test results table and check for failuresif ! print_test_results_table "unittest_cuda_test_*.log" "CUDA Unit Tests"; then@@ -132,6 +132,7 @@ function run_unit_test_vlm() {cd ${REPO_PATH}/testrm -rf .coverage* *.xml *.html+ uv pip install torch==2.10.0 torchvisionuv pip install git+https://github.com/haotian-liu/[email protected] --no-depslocal site_path=$(python -c "import site; print(site.getsitepackages()[0])")# reference https://github.com/haotian-liu/LLaVA/issues/1448#issuecomment-2119845242@@ -140,6 +141,7 @@ function run_unit_test_vlm() {uv pip install -v git+https://github.com/casper-hansen/[email protected] --no-build-isolationuv pip install flash-attn==2.7.4.post1 --no-build-isolationuv pip install -r test_cuda/requirements_vlm.txt+ cd ${REPO_PATH} && uv pip install . && cd ${REPO_PATH}/testpip list > ${LOG_DIR}/vlm_ut_pip_list.txtexport COVERAGE_RCFILE=${REPO_PATH}/.azure-pipelines/scripts/ut/.coverage@@ -154,8 +156,10 @@ function run_unit_test_vlm() {python -m pytest --cov="${auto_round_path}" --cov-report term --html=report_vlms.html --self-contained-html --cov-report xml:coverage_vlms.xml --cov-append -vs --disable-warnings ${test_file} 2>&1 | tee ${ut_log_name}done- mv report_vlms.html ${LOG_DIR}/- mv coverage_vlms.xml ${LOG_DIR}/+ if [ -f "report_vlms.html" ] && [ -f "coverage_vlms.xml" ]; then+ mv report_vlms.html ${LOG_DIR}/+ mv coverage_vlms.xml ${LOG_DIR}/+ fi# Print test results table and check for failuresif ! print_test_results_table "unittest_cuda_vlm_test*.log" "CUDA VLM Tests"; then@@ -170,6 +174,7 @@ function run_unit_test_llmc() {cd ${REPO_PATH}/testrm -rf .coverage* *.xml *.htmluv pip install -r test_cuda/requirements_llmc.txt+ cd ${REPO_PATH} && uv pip install . && cd ${REPO_PATH}/testpip list > ${LOG_DIR}/llmc_ut_pip_list.txtexport COVERAGE_RCFILE=${REPO_PATH}/.azure-pipelines/scripts/ut/.coverage@@ -184,8 +189,10 @@ function run_unit_test_llmc() {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}/+ if [ -f "report_llmc.html" ] && [ -f "coverage_llmc.xml" ]; then+ mv report_llmc.html ${LOG_DIR}/+ mv coverage_llmc.xml ${LOG_DIR}/+ fi# Print test results table and check for failuresif ! print_test_results_table "unittest_cuda_llmc_test_*.log" "CUDA LLMC Tests"; thenecho "Some CUDA LLMC tests failed. Please check the individual log files for details."@@ -198,8 +205,8 @@ function run_unit_test_sglang() {cd ${REPO_PATH}/testrm -rf .coverage* *.xml *.html- uv pip install torch==2.9.1 torchvisionuv pip install -r test_cuda/requirements_sglang.txt+ cd ${REPO_PATH} && uv pip install . && cd ${REPO_PATH}/testpip list > ${LOG_DIR}/sglang_ut_pip_list.txtexport COVERAGE_RCFILE=${REPO_PATH}/.azure-pipelines/scripts/ut/.coverage@@ -214,8 +221,10 @@ function run_unit_test_sglang() {python -m pytest --cov="${auto_round_path}" --cov-report term --html=report_sglang.html --self-contained-html --cov-report xml:coverage_sglang.xml --cov-append -vs --disable-warnings ${test_file} 2>&1 | tee ${ut_log_name}done- mv report_sglang.html ${LOG_DIR}/- mv coverage_sglang.xml ${LOG_DIR}/+ if [ -f "report_sglang.html" ] && [ -f "coverage_sglang.xml" ]; then+ mv report_sglang.html ${LOG_DIR}/+ mv coverage_sglang.xml ${LOG_DIR}/+ fi# Print test results table and check for failuresif ! print_test_results_table "unittest_cuda_sglang_test*.log" "CUDA SGLang Unit Tests"; thenecho "Some CUDA SGLang unit tests failed. Please check the individual log files for details."diff --git a/test/test_cuda/requirements.txt b/test/test_cuda/requirements.txtindex 3b2f3efd6..47c3968ec 100644--- a/test/test_cuda/requirements.txt+++ b/test/test_cuda/requirements.txt@@ -1,5 +1,4 @@# pip install -v git+https://github.com/casper-hansen/AutoAWQ.git --no-build-isolation---extra-index-url https://wheels.vllm.ai/nightlyauto-gptqeinops# pip install -v git+https://github.com/ModelCloud/GPTQModel.git --no-build-isolationdiff --git a/test/test_hpu/requirements.txt b/test/test_hpu/requirements.txtindex 6bb53e76d..8a05844b9 100644--- a/test/test_hpu/requirements.txt+++ b/test/test_hpu/requirements.txt@@ -1 +1 @@-compressed_tensors<0.14 # Temporary restrictions+compressed_tensors