Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
[UT] mv compression ut to full test (#4936)
Browse files Browse the repository at this point in the history
  • Loading branch information
J-shang authored Jun 20, 2022
1 parent 8978659 commit 45af1d6
Show file tree
Hide file tree
Showing 20 changed files with 17 additions and 15 deletions.
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
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
Expand Down
12 changes: 2 additions & 10 deletions pipelines/fast-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion pipelines/full-test-compression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

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):
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions test/ut/conftest.py
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 45af1d6

Please sign in to comment.