Skip to content

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

Update dependencies in CI and installation scripts for cuda compatibility (#1825)

Sun, Xuehaobd0a1f1e393c
diff --git a/.azure-pipelines/scripts/cuda_unit_test/run_cuda_ut.sh b/.azure-pipelines/scripts/cuda_unit_test/run_cuda_ut.sh
index 11cacae23..dd38a18c4 100644
--- a/.azure-pipelines/scripts/cuda_unit_test/run_cuda_ut.sh
+++ b/.azure-pipelines/scripts/cuda_unit_test/run_cuda_ut.sh
@@ -62,14 +62,14 @@ function run_unit_test() {
# install unit test dependencies
echo "##[group]set up UT env..."
cd "${BUILD_SOURCESDIRECTORY}" || exit 1
- uv pip install torch==2.11.0 torchvision --index-url https://download.pytorch.org/whl/cu128
- uv pip install https://github.com/XuehaoSun/llama-cpp-python/releases/download/v0.3.16/llama_cpp_python-0.3.16-cp312-cp312-linux_x86_64.whl
+ uv pip install torch==2.12.0 torchvision torchao --index-url https://download.pytorch.org/whl/cu130
+ uv pip install https://github.com/XuehaoSun/llama-cpp-python/releases/download/v0.3.23/llama_cpp_python-0.3.23-py3-none-linux_x86_64.whl
uv pip install 'git+https://github.com/ggml-org/llama.cpp.git#subdirectory=gguf-py'
uv pip install -r test/test_cuda/requirements.txt
uv pip install -r test/test_cuda/requirements_diffusion.txt
uv pip install -U transformers
uv pip uninstall torch torchvision
- uv pip install torch==2.11.0 torchvision --index-url https://download.pytorch.org/whl/cu128
+ uv pip install torch==2.12.0 torchvision torchao --index-url https://download.pytorch.org/whl/cu130
uv pip install .
echo "##[endgroup]"
diff --git a/.azure-pipelines/scripts/cuda_unit_test/runpod_manager.py b/.azure-pipelines/scripts/cuda_unit_test/runpod_manager.py
index 21aa866c7..5e9ce69df 100644
--- a/.azure-pipelines/scripts/cuda_unit_test/runpod_manager.py
+++ b/.azure-pipelines/scripts/cuda_unit_test/runpod_manager.py
@@ -12,6 +12,10 @@ TARGET_GPUS = [
"NVIDIA L40S",
"NVIDIA RTX PRO 6000 Blackwell Server Edition",
"NVIDIA RTX PRO 6000 Blackwell Workstation Edition",
+ "NVIDIA L40",
+ "NVIDIA A100-SXM4-80GB",
+ "NVIDIA H100 80GB HBM3",
+ "NVIDIA H200",
]
DATA_CENTER_IDS = [
"AP-JP-1",
@@ -41,11 +45,11 @@ DATA_CENTER_IDS = [
"US-TX-4",
"US-WA-1",
]
-DATA_CENTER_BAN_LIST = ["EUR-IS-1", "EUR-IS-2", "US-IL-1"]
+DATA_CENTER_BAN_LIST = ["EUR-IS-1", "EUR-IS-2", "US-IL-1", "EU-CZ-1"]
DATA_CENTER_SELECT_LIST = [dc for dc in DATA_CENTER_IDS if dc not in DATA_CENTER_BAN_LIST]
REQUIRED_COUNT = 1
-IMAGES_NAME = "xuehaosu/azure-agent:v0.1"
-CUDA_VERSIONS = ["13.0", "12.9", "12.8", "12.7", "12.6", "12.5", "12.4", "12.3", "12.2", "12.1", "12.0", "11.8"]
+CU130_IMAGES_NAME = "ghcr.io/xuehaosun/azure-agent:13.0"
+CUDA_VERSIONS = ["13.0"]
def run_create_pod(api_key, payload):
@@ -102,15 +106,16 @@ def create_pod(args):
"gpuTypePriority": "custom",
"name": args.name,
"volumeInGb": 0,
- "imageName": IMAGES_NAME,
+ "imageName": CU130_IMAGES_NAME,
}
print(f"🚀 Creating pod: {args.name}...")
data = run_create_pod(args.api_key, payload)
if data:
pod_id = data.get("id")
+ location = data.get("machine", {}).get("location", "unknown")
if pod_id:
- print(f"✅ Pod created successfully! Pod ID: {pod_id}")
+ print(f"✅ Pod created successfully! Pod ID: {pod_id}, Location: {location}")
print(f" Status is: {data.get('desiredStatus')}")
else:
print("❌ Failed to create pod (no data returned).")
diff --git a/.azure-pipelines/scripts/ut/constraints.txt b/.azure-pipelines/scripts/ut/constraints.txt
index 33092d9a8..6a7778a58 100644
--- a/.azure-pipelines/scripts/ut/constraints.txt
+++ b/.azure-pipelines/scripts/ut/constraints.txt
@@ -1,2 +1,2 @@
-torch==2.11.0
-torchvision==0.26.0
+torch==2.12.0
+torchvision==0.27.0
diff --git a/.azure-pipelines/scripts/ut/run_ut_cuda.sh b/.azure-pipelines/scripts/ut/run_ut_cuda.sh
index e5fa7a245..976a5ea0f 100644
--- a/.azure-pipelines/scripts/ut/run_ut_cuda.sh
+++ b/.azure-pipelines/scripts/ut/run_ut_cuda.sh
@@ -31,7 +31,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 pytest-cov pytest-html cmake
+ uv pip install pytest-cov pytest-html cmake requests
}
function print_test_results_table() {
@@ -91,14 +91,14 @@ function run_unit_test() {
cd ${REPO_PATH}/test
rm -rf .coverage* *.xml *.html
- uv pip install torch==2.11.0 torchvision --index-url https://download.pytorch.org/whl/cu128
- uv pip install https://github.com/XuehaoSun/llama-cpp-python/releases/download/v0.3.16/llama_cpp_python-0.3.16-cp312-cp312-linux_x86_64.whl
+ uv pip install torch==2.12.0 torchvision torchao --index-url https://download.pytorch.org/whl/cu126
+ uv pip install https://github.com/XuehaoSun/llama-cpp-python/releases/download/v0.3.23/llama_cpp_python-0.3.23+cu128-py3-none-linux_x86_64.whl
uv pip install 'git+https://github.com/ggml-org/llama.cpp.git#subdirectory=gguf-py'
uv pip install -r test_cuda/requirements.txt
uv pip install -r test_cuda/requirements_diffusion.txt
uv pip install -U transformers
uv pip uninstall torch torchvision
- uv pip install torch==2.11.0 torchvision --index-url https://download.pytorch.org/whl/cu128
+ uv pip install torch==2.12.0 torchvision torchao --index-url https://download.pytorch.org/whl/cu126
cd ${REPO_PATH} && uv pip install . && cd ${REPO_PATH}/test
pip list > ${LOG_DIR}/ut_pip_list.txt
@@ -131,11 +131,13 @@ function run_unit_test_vlm() {
cd ${REPO_PATH}/test
rm -rf .coverage* *.xml *.html
- uv pip install torch==2.11.0 torchvision --index-url https://download.pytorch.org/whl/cu128
+ uv pip install torch==2.12.0 torchvision --index-url https://download.pytorch.org/whl/cu126
uv pip install git+https://github.com/haotian-liu/[email protected] --no-deps
uv pip install -v git+https://github.com/casper-hansen/[email protected] --no-build-isolation
uv pip install flash-attn==2.8.3 --no-build-isolation
- uv pip install -r test_cuda/requirements_vlm.txt --extra-index-url https://download.pytorch.org/whl/cu128
+ uv pip install -r test_cuda/requirements_vlm.txt \
+ --extra-index-url https://download.pytorch.org/whl/cu126 \
+ --index-strategy unsafe-best-match
cd ${REPO_PATH} && uv pip install . && cd ${REPO_PATH}/test
pip list > ${LOG_DIR}/vlm_ut_pip_list.txt
@@ -168,7 +170,7 @@ function run_unit_test_llmc() {
cd ${REPO_PATH}/test
rm -rf .coverage* *.xml *.html
- BUILD_TYPE="nightly" uv pip install -r test_cuda/requirements_llmc.txt --extra-index-url https://download.pytorch.org/whl/cu128 --index-strategy unsafe-best-match
+ BUILD_TYPE="nightly" uv pip install -r test_cuda/requirements_llmc.txt --extra-index-url https://download.pytorch.org/whl/cu126 --index-strategy unsafe-best-match
cd ${REPO_PATH} && uv pip install . && cd ${REPO_PATH}/test
pip list > ${LOG_DIR}/llmc_ut_pip_list.txt
@@ -200,7 +202,7 @@ function run_unit_test_sglang() {
cd ${REPO_PATH}/test
rm -rf .coverage* *.xml *.html
- uv pip install -r test_cuda/requirements_sglang.txt --prerelease=allow
+ uv pip install "sglang<0.5.11" --prerelease=allow
cd ${REPO_PATH} && uv pip install . && cd ${REPO_PATH}/test
pip list > ${LOG_DIR}/sglang_ut_pip_list.txt
@@ -236,7 +238,7 @@ function run_unit_test_vllm() {
vllm_version=$(curl -s https://api.github.com/repos/vllm-project/vllm/releases/latest | jq -r .tag_name | sed 's/^v//')
uv pip install -r test_cuda/requirements_vllm.txt \
--extra-index-url https://wheels.vllm.ai/${vllm_version}/cu129 \
- --extra-index-url https://download.pytorch.org/whl/cu128 \
+ --extra-index-url https://download.pytorch.org/whl/cu126 \
--index-strategy unsafe-best-match
cd ${REPO_PATH} && uv pip install . && cd ${REPO_PATH}/test
diff --git a/test/test_cuda/integrations/test_sglang.py b/test/test_cuda/integrations/test_sglang.py
index 65329d335..44aaf3af5 100644
--- a/test/test_cuda/integrations/test_sglang.py
+++ b/test/test_cuda/integrations/test_sglang.py
@@ -1,5 +1,6 @@
import gc
import json
+import multiprocessing.resource_tracker
import shutil
import sys
from pathlib import Path
@@ -12,6 +13,20 @@ from auto_round import AutoRound
from ...helpers import get_model_path, qwen_name_or_path
+# A patch to fix the Python `multiprocessing.ResourceTracker` [Errno 10] error.
+_original_stop = multiprocessing.resource_tracker.ResourceTracker._stop
+
+
+def _patched_stop(self, *args, _orig=_original_stop, **kwargs):
+ if _orig is not None:
+ try:
+ _orig(self, *args, **kwargs)
+ except ChildProcessError:
+ pass
+
+
+multiprocessing.resource_tracker.ResourceTracker._stop = _patched_stop
+
class TestAutoRound:
model_name = qwen_name_or_path
diff --git a/test/test_cuda/requirements_sglang.txt b/test/test_cuda/requirements_sglang.txt
index cfb861600..e21e7647e 100644
--- a/test/test_cuda/requirements_sglang.txt
+++ b/test/test_cuda/requirements_sglang.txt
@@ -1 +1 @@
-sglang < 0.5.11 # due to not support cu128
\ No newline at end of file
+sglang >= 0.5.11 # due to not support cu128
\ No newline at end of file