Unverified Commit 2d4fdfb2 authored by J-shang's avatar J-shang Committed by GitHub
Browse files

hotfix torchvision mnist (#3422)

parent b2720c9e
...@@ -59,8 +59,8 @@ RUN python3 -m pip --no-cache-dir install Keras==2.1.6 ...@@ -59,8 +59,8 @@ RUN python3 -m pip --no-cache-dir install Keras==2.1.6
# #
# PyTorch # PyTorch
# #
RUN python3 -m pip --no-cache-dir install torch==1.4.0 RUN python3 -m pip --no-cache-dir install torch==1.6.0
RUN python3 -m pip install torchvision==0.5.0 RUN python3 -m pip install torchvision==0.7.0
# #
# sklearn 0.24.1 # sklearn 0.24.1
...@@ -78,6 +78,12 @@ RUN python3 -m pip --no-cache-dir install pandas==0.23.4 lightgbm==2.2.2 ...@@ -78,6 +78,12 @@ RUN python3 -m pip --no-cache-dir install pandas==0.23.4 lightgbm==2.2.2
COPY dist/nni-${NNI_RELEASE}-py3-none-manylinux1_x86_64.whl . 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 RUN python3 -m pip install nni-${NNI_RELEASE}-py3-none-manylinux1_x86_64.whl
#
# Vision patch. Need del later
#
COPY interim_vision_patch.py .
RUN python3 interim_vision_patch.py
# #
# install aml package # install aml package
# #
......
import os
import torchvision.datasets.mnist as mnist
file_name = mnist.__file__
dummy_file_name = os.path.join(os.path.dirname(file_name), 'mnist_dummy.py')
with open(file_name, 'r') as fr:
firstline = fr.readline()
if firstline != 'from six.moves import urllib\n':
with open(dummy_file_name, 'w') as fw:
fw.writelines(['from six.moves import urllib\n',
'opener = urllib.request.build_opener()\n',
'opener.addheaders = [("User-agent", "Mozilla/5.0")]\n',
'urllib.request.install_opener(opener)\n\n'])
fw.write(firstline)
for line in fr:
fw.write(line)
if os.path.exists(dummy_file_name):
os.remove(file_name)
os.rename(dummy_file_name, file_name)
...@@ -164,6 +164,12 @@ stages: ...@@ -164,6 +164,12 @@ stages:
python -m pip install -e .[SMAC,BOHB,PPOTuner] python -m pip install -e .[SMAC,BOHB,PPOTuner]
displayName: Install extra dependencies displayName: Install extra dependencies
# Need del later
- script: |
set -e
python interim_vision_patch.py
displayName: Vision MNIST Patch
- script: | - script: |
set -e set -e
cd test cd test
...@@ -243,6 +249,13 @@ stages: ...@@ -243,6 +249,13 @@ stages:
python -m pip install -e .[SMAC,BOHB,PPOTuner] python -m pip install -e .[SMAC,BOHB,PPOTuner]
displayName: Install extra dependencies displayName: Install extra dependencies
# Need del later
- script: |
set -e
python interim_vision_patch.py
displayName: Vision MNIST Patch
- script: | - script: |
cd test cd test
python nni_test/nnitest/run_tests.py --config config/pr_tests.yml python nni_test/nnitest/run_tests.py --config config/pr_tests.yml
...@@ -325,6 +338,12 @@ stages: ...@@ -325,6 +338,12 @@ stages:
python -m pip install -e .[SMAC,BOHB,PPOTuner] python -m pip install -e .[SMAC,BOHB,PPOTuner]
displayName: Install extra dependencies displayName: Install extra dependencies
# Need del later
- script: |
set -e
python interim_vision_patch.py
displayName: Vision MNIST Patch
- script: | - script: |
cd test cd test
python -m pytest ut python -m pytest ut
...@@ -381,6 +400,12 @@ stages: ...@@ -381,6 +400,12 @@ stages:
python -m pip install -r dependencies/recommended.txt python -m pip install -r dependencies/recommended.txt
displayName: Install extra dependencies displayName: Install extra dependencies
# Need del later
- script: |
set -e
python interim_vision_patch.py
displayName: Vision MNIST Patch
- script: | - script: |
cd test cd test
python -m pytest ut python -m pytest ut
......
...@@ -38,6 +38,12 @@ jobs: ...@@ -38,6 +38,12 @@ jobs:
sudo apt-get install swig -y sudo apt-get install swig -y
displayName: Install extra dependencies displayName: Install extra dependencies
# Need del later
- script: |
set -e
python3 interim_vision_patch.py
displayName: Vision MNIST Patch
- script: | - script: |
set -e set -e
cd examples/tuners/customized_tuner cd examples/tuners/customized_tuner
......
...@@ -32,6 +32,12 @@ jobs: ...@@ -32,6 +32,12 @@ jobs:
python -m pip install tensorflow==2.3.1 tensorflow-estimator==2.3.0 python -m pip install tensorflow==2.3.1 tensorflow-estimator==2.3.0
displayName: Install extra dependencies displayName: Install extra dependencies
# Need del later
- script: |
set -e
python interim_vision_patch.py
displayName: Vision MNIST Patch
- script: | - script: |
cd examples/tuners/customized_tuner cd examples/tuners/customized_tuner
python setup.py develop --user python setup.py develop --user
......
...@@ -79,7 +79,7 @@ jobs: ...@@ -79,7 +79,7 @@ jobs:
--pai_reuse true \ --pai_reuse true \
--pai_host https://ne.openpai.org \ --pai_host https://ne.openpai.org \
--pai_user $(pai_user) \ --pai_user $(pai_user) \
--nni_docker_image nnidev/nni-it-pai:latest \ --nni_docker_image nnidev/nni-nightly \
--pai_storage_config_name confignfs-data \ --pai_storage_config_name confignfs-data \
--pai_token $(pai_token) \ --pai_token $(pai_token) \
--nni_manager_nfs_mount_path /home/quzha/mnt-pai-ne/shinyang3 \ --nni_manager_nfs_mount_path /home/quzha/mnt-pai-ne/shinyang3 \
......
...@@ -66,6 +66,16 @@ jobs: ...@@ -66,6 +66,16 @@ jobs:
displayName: Copy test scripts to remote machine displayName: Copy test scripts to remote machine
timeoutInMinutes: 10 timeoutInMinutes: 10
# Need del later
- task: CopyFilesOverSSH@0
inputs:
sshEndpoint: $(worker)
contents: interim_vision_patch.py
targetFolder: /tmp/nnitest/$(Build.BuildId)
overwrite: true
displayName: Copy vision patch to remote machine
timeoutInMinutes: 10
- task: SSH@0 - task: SSH@0
inputs: inputs:
sshEndpoint: $(worker) sshEndpoint: $(worker)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment