Skip to content

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

Fix UT coverage report (#180)

Sun, Xuehao8d08400f0917
diff --git a/.azure-pipelines/scripts/ut/.coverage b/.azure-pipelines/scripts/ut/.coverage
index 86487a1ba..659652406 100644
--- a/.azure-pipelines/scripts/ut/.coverage
+++ b/.azure-pipelines/scripts/ut/.coverage
@@ -9,7 +9,5 @@ exclude_lines =
pragma: no cover
raise NotImplementedError
raise TypeError
- if self.device == "gpu":
- if device == "gpu":
except ImportError:
except Exception as e:
\ No newline at end of file
diff --git a/.azure-pipelines/scripts/ut/collect_log.sh b/.azure-pipelines/scripts/ut/collect_log.sh
index 8d93dd835..2bb74ea1c 100644
--- a/.azure-pipelines/scripts/ut/collect_log.sh
+++ b/.azure-pipelines/scripts/ut/collect_log.sh
@@ -26,7 +26,7 @@ git fetch
git checkout main
rm -rf build dist *egg-info
echo y | pip uninstall auto_round
-pip install -r requirements.txt && python setup.py install
+python setup.py bdist_wheel && rm -rf build && pip install dist/auto_round*.whl
coverage erase
cd /auto-round/log_dir
diff --git a/.azure-pipelines/scripts/ut/run_ut.sh b/.azure-pipelines/scripts/ut/run_ut.sh
index 9f66b8f8a..3641b7d3d 100644
--- a/.azure-pipelines/scripts/ut/run_ut.sh
+++ b/.azure-pipelines/scripts/ut/run_ut.sh
@@ -18,6 +18,7 @@ mkdir -p ${LOG_DIR}
ut_log_name=${LOG_DIR}/ut.log
find . -name "test*.py" | sed "s,\.\/,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 ,g" > run.sh
+cat run.sh
bash run.sh 2>&1 | tee ${ut_log_name}
cp report.html ${LOG_DIR}/
diff --git a/.azure-pipelines/template/ut-template.yml b/.azure-pipelines/template/ut-template.yml
index 6a03a3a41..46addafa8 100644
--- a/.azure-pipelines/template/ut-template.yml
+++ b/.azure-pipelines/template/ut-template.yml
@@ -45,7 +45,7 @@ steps:
condition: succeededOrFailed()
inputs:
targetPath: ${{ parameters.uploadPath }}
- artifact: $(System.JobAttempt)_${{ parameters.utArtifact }}_coverage
+ artifact: ${{ parameters.utArtifact }}_coverage
publishLocation: "pipeline"
- task: Bash@3
diff --git a/.azure-pipelines/unit-test.yml b/.azure-pipelines/unit-test.yml
index 9c6098c68..eff997208 100644
--- a/.azure-pipelines/unit-test.yml
+++ b/.azure-pipelines/unit-test.yml
@@ -38,8 +38,7 @@ stages:
dockerConfigName: "commonDockerConfig"
utScriptFileName: "run_ut"
uploadPath: $(UPLOAD_PATH)
- utArtifact: "unit-test"
-
+ utArtifact: "ut"
- stage: Unit_test_baseline
displayName: Unit Test Baseline
@@ -53,7 +52,7 @@ stages:
dockerConfigName: "gitCloneDockerConfig"
utScriptFileName: "run_ut"
uploadPath: $(UPLOAD_PATH)
- utArtifact: "unit-test-baseline"
+ utArtifact: "ut_baseline"
repo: $(REPO)
- stage: Coverage
@@ -78,7 +77,7 @@ stages:
- task: DownloadPipelineArtifact@2
inputs:
artifact:
- patterns: '*_coverage/.coverage'
+ patterns: "*_coverage/.coverage"
path: $(DOWNLOAD_PATH)
- script: |
@@ -87,8 +86,13 @@ stages:
echo "--- docker ps ---"
docker ps
echo "--- collect logs ---"
+ docker exec collectLogs bash -c "cd /auto-round \
+ && pip install -r requirements.txt \
+ && python setup.py bdist_wheel && rm -rf build \
+ && pip install dist/auto_round*.whl \
+ && pip list"
docker exec collectLogs /bin/bash +x -c "cd /auto-round/.azure-pipelines/scripts \
- && bash ut/collect_log.sh"
+ && bash ut/collect_log.sh"
displayName: "Collect UT Coverage"
- task: PublishPipelineArtifact@1