This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Integration test #3088
Merged
Merged
Integration test #3088
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,15 @@ | |
|
||
FROM nvidia/cuda:9.2-cudnn7-runtime-ubuntu18.04 | ||
|
||
ARG NNI_RELEASE | ||
|
||
LABEL maintainer='Microsoft NNI Team<[email protected]>' | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get -y update && \ | ||
apt-get -y install sudo \ | ||
RUN apt-get -y update | ||
RUN apt-get -y install \ | ||
sudo \ | ||
apt-utils \ | ||
git \ | ||
curl \ | ||
|
@@ -26,28 +29,27 @@ RUN apt-get -y update && \ | |
python3-dev \ | ||
python3-pip \ | ||
python3-tk \ | ||
libcupti-dev && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
libcupti-dev | ||
RUN apt-get clean | ||
RUN rm -rf /var/lib/apt/lists/* | ||
|
||
# | ||
# generate python script | ||
# | ||
RUN cp /usr/bin/python3 /usr/bin/python | ||
RUN ln -s python3 /usr/bin/python | ||
|
||
# | ||
# update pip | ||
# | ||
RUN python3 -m pip install --upgrade pip==20.0.2 setuptools==41.0.0 | ||
RUN python3 -m pip install --upgrade pip==20.2.4 setuptools==50.3.2 | ||
|
||
# numpy 1.14.3 scipy 1.1.0 | ||
RUN python3 -m pip --no-cache-dir install \ | ||
numpy==1.14.3 scipy==1.1.0 | ||
RUN python3 -m pip --no-cache-dir install numpy==1.14.3 scipy==1.1.0 | ||
|
||
# | ||
# Tensorflow 1.15 | ||
# TensorFlow | ||
# | ||
RUN python3 -m pip --no-cache-dir install tensorflow-gpu==1.15.0 | ||
RUN python3 -m pip --no-cache-dir install tensorflow==2.3.1 | ||
|
||
# | ||
# Keras 2.1.6 | ||
|
@@ -73,15 +75,15 @@ RUN python3 -m pip --no-cache-dir install pandas==0.23.4 lightgbm==2.2.2 | |
# | ||
# Install NNI | ||
# | ||
RUN python3 -m pip --no-cache-dir install nni | ||
COPY dist/nni-${NNI_RELEASE}-py3-none-manylinux1_x86_64.whl . | ||
RUN python3 -m pip install nni-${NNI_RELEASE}-py3-none-manylinux1_x86_64.whl | ||
|
||
# | ||
# install aml package | ||
# | ||
RUN python3 -m pip --no-cache-dir install azureml | ||
RUN python3 -m pip --no-cache-dir install azureml-sdk | ||
|
||
|
||
ENV PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/root/.local/bin:/usr/bin:/bin:/sbin | ||
|
||
WORKDIR /root |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
|
||
from .apply_compression import apply_compression_results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
|
||
import logging | ||
import torch | ||
|
||
logger = logging.getLogger('torch apply compression') | ||
|
||
def apply_compression_results(model, masks_file, map_location=None): | ||
""" | ||
Apply the masks from ```masks_file``` to the model | ||
Note: this API is for inference, because it simply multiplies weights with | ||
corresponding masks when this API is called. | ||
|
||
Parameters | ||
---------- | ||
model : torch.nn.Module | ||
The model to be compressed | ||
masks_file : str | ||
The path of the mask file | ||
map_location : str | ||
the device on which masks are placed, same to map_location in ```torch.load``` | ||
""" | ||
masks = torch.load(masks_file, map_location) | ||
for name, module in model.named_modules(): | ||
if name in masks: | ||
module.weight.data = module.weight.data.mul_(masks[name]['weight']) | ||
if hasattr(module, 'bias') and module.bias is not None and 'bias' in masks[name]: | ||
module.bias.data = module.bias.data.mul_(masks[name]['bias']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
trigger: none | ||
pr: none | ||
schedules: | ||
- cron: 0 16 * * * | ||
branches: | ||
include: [ master ] | ||
|
||
jobs: | ||
- job: linux | ||
pool: NNI CI GPU3 | ||
timeoutInMinutes: 120 | ||
|
||
steps: | ||
- script: | | ||
echo "##vso[task.setvariable variable=PATH]${PATH}:${HOME}/.local/bin" | ||
echo "##vso[task.setvariable variable=NNI_RELEASE]999.$(date -u +%Y%m%d%H%M%S)" | ||
|
||
python3 -m pip install -U --upgrade pip setuptools | ||
python3 -m pip install -U pytest | ||
displayName: Prepare | ||
|
||
- script: | | ||
set -e | ||
python3 setup.py build_ts | ||
python3 setup.py bdist_wheel -p manylinux1_x86_64 | ||
python3 -m pip install dist/nni-${NNI_RELEASE}-py3-none-manylinux1_x86_64.whl | ||
displayName: Install NNI | ||
|
||
- script: | | ||
set -e | ||
python3 -m pip install -U scikit-learn==0.23.2 | ||
python3 -m pip install -U torchvision==0.4.2 | ||
python3 -m pip install -U torch==1.3.1 | ||
python3 -m pip install -U keras==2.1.6 | ||
python3 -m pip install -U tensorflow==2.3.1 tensorflow-estimator==2.3.0 | ||
python3 -m pip install -U thop | ||
sudo apt-get install swig -y | ||
nnictl package install --name=SMAC | ||
nnictl package install --name=BOHB | ||
nnictl package install --name=PPOTuner | ||
displayName: Install extra dependencies | ||
|
||
- script: | | ||
set -e | ||
cd examples/tuners/customized_tuner | ||
python3 setup.py develop --user | ||
nnictl package install . | ||
displayName: Install customized tuner | ||
|
||
- script: | | ||
set -e | ||
(cd test && python3 -m pytest ut) | ||
export PATH=$PATH:$PWD/toolchain/yarn/bin | ||
export CI=true | ||
(cd ts/nni_manager && yarn test) | ||
(cd ts/nasui && yarn test) | ||
displayName: Unit test | ||
continueOnError: true | ||
|
||
- script: | | ||
cd test | ||
python3 nni_test/nnitest/run_tests.py --config config/integration_tests.yml --ts local | ||
displayName: Integration test | ||
continueOnError: true | ||
|
||
- script: | | ||
cd test | ||
source scripts/nas.sh | ||
displayName: NAS test | ||
continueOnError: true | ||
|
||
- script: | | ||
cd test | ||
source scripts/model_compression.sh | ||
displayName: Model compression test |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change the install method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Dockerfile might be used by two category of users:
For customers, if they want NNI image of latest release version, they can simply pull from docker hub. So if a customer uses Dockerfile, they are most likely using a modified NNI package, in which case they won't want latest NNI from pypi.
For us, we use pipelines to build and upload docker images. The release pipeline always builds docker image together with wheel, so there is no benefit to push then pull. It can use the same wheel file for pypi and docker.