[UT] mv compression ut to full test (#4936)

This commit is contained in:
J-shang 2022-06-20 14:39:43 +08:00 коммит произвёл GitHub
Родитель 8978659625
Коммит 45af1d6b79
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
20 изменённых файлов: 17 добавлений и 15 удалений

Просмотреть файл

@ -111,6 +111,7 @@ linkcheck_ignore = [
r'https://1drv\.ms/', # OneDrive (shortcut)
r'https://onedrive\.live\.com/', # OneDrive
r'https://www\.openml\.org/', # OpenML
r'https://ml\.informatik\.uni-freiburg\.de/'
]
# Ignore all links located in release.rst

Просмотреть файл

@ -13,7 +13,7 @@ resources:
endpoint: github-filter-connection
variables:
filter.modified.globs: '!.github/**,!docs/**,!examples/**'
filter.modified.globs: 'pipelines/fast-test.yml,!.github/**,!docs/**,!examples/**'
filter.prbody.heading: '#### Test Options'
filter.prbody.optionIndex: 0
@ -150,15 +150,7 @@ stages:
set -e
mkdir -p coverage
cd test
python -m pytest ut --cov-config=.coveragerc \
--ignore=ut/compression/v1/test_pruners.py \
--ignore=ut/compression/v1/test_compressor_tf.py \
--ignore=ut/compression/v1/test_compressor_torch.py \
--ignore=ut/compression/v1/test_model_speedup.py
python -m pytest ut/compression/v1/test_pruners.py --cov-config=.coveragerc --cov-append
python -m pytest ut/compression/v1/test_compressor_tf.py --cov-config=.coveragerc --cov-append
python -m pytest ut/compression/v1/test_compressor_torch.py --cov-config=.coveragerc --cov-append
python -m pytest ut/compression/v1/test_model_speedup.py --cov-config=.coveragerc --cov-append
python -m pytest ut --cov-config=.coveragerc
cp coverage.xml ../coverage/python.xml
displayName: Python unit test

Просмотреть файл

@ -13,7 +13,7 @@ resources:
endpoint: github-filter-connection
variables:
filter.modified.globs: 'examples/model_compress/**,nni/algorithms/compression/**,nni/compression/**'
filter.modified.globs: 'examples/model_compress/**,nni/algorithms/compression/**,nni/compression/**,pipelines/full-test-compression.yml,test/algo/compression/**'
filter.prbody.heading: '#### Test Options'
filter.prbody.optionIndex: 3
@ -44,6 +44,11 @@ stages:
- template: templates/download-test-data.yml
- script: |
cd test/algo
python -m pytest compression
displayName: compression unit test
- script: |
cd test
source scripts/model_compression.sh

Просмотреть файл

Просмотреть файл

@ -15,8 +15,8 @@ from nni.algorithms.compression.pytorch.pruning import LevelPruner, SlimPruner,
TaylorFOWeightFilterPruner, NetAdaptPruner, SimulatedAnnealingPruner, ADMMPruner, \
AutoCompressPruner, AMCPruner
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
from sdk.models.pytorch_models.mobilenet import MobileNet
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))))
from ut.sdk.models.pytorch_models.mobilenet import MobileNet
def validate_sparsity(wrapper, sparsity, bias=False):
masks = [wrapper.weight_mask]

Просмотреть файл

@ -13,8 +13,8 @@ from unittest import TestCase, main
from nni.algorithms.compression.pytorch.pruning import TransformerHeadPruner
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
from sdk.models.pytorch_models.transformer import TransformerEncoder
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))))
from ut.sdk.models.pytorch_models.transformer import TransformerEncoder
def validate_sparsity(wrapper, sparsity, bias=False):

4
test/ut/conftest.py Normal file
Просмотреть файл

@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# NOTE: Don't remove this file. This file ensures that `../ut/__init__.py` is loaded first.