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

Commit

Permalink
Fix windows pipeline timeout (#2050)
Browse files Browse the repository at this point in the history
  • Loading branch information
chicm-ms authored Feb 12, 2020
1 parent 73a6990 commit 1958adb
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
11 changes: 9 additions & 2 deletions examples/trials/cifar10_pytorch/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def prepare(args):


# Training
def train(epoch):
def train(epoch, batches=-1):
global trainloader
global testloader
global net
Expand Down Expand Up @@ -129,6 +129,9 @@ def train(epoch):
progress_bar(batch_idx, len(trainloader), 'Loss: %.3f | Acc: %.3f%% (%d/%d)'
% (train_loss/(batch_idx+1), 100.*correct/total, correct, total))

if batches > 0 and (batch_idx+1) >= batches:
return

def test(epoch):
global best_acc
global trainloader
Expand Down Expand Up @@ -176,6 +179,10 @@ def test(epoch):
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--epochs", type=int, default=200)

# Maximum mini-batches per epoch, for code testing purpose
parser.add_argument("--batches", type=int, default=-1)

args, _ = parser.parse_known_args()

try:
Expand All @@ -187,7 +194,7 @@ def test(epoch):
acc = 0.0
best_acc = 0.0
for epoch in range(start_epoch, start_epoch+args.epochs):
train(epoch)
train(epoch, args.batches)
acc, best_acc = test(epoch)
nni.report_intermediate_result(acc)

Expand Down
2 changes: 1 addition & 1 deletion test/config_test/examples/cifar10-pytorch.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ assessor:
optimize_mode: maximize
trial:
codeDir: ../../../examples/trials/cifar10_pytorch
command: python3 main.py --epochs 2
command: python3 main.py --epochs 1 --batches 1
gpuNum: 1

useAnnotation: false
Expand Down
4 changes: 2 additions & 2 deletions test/pipelines-it-local-windows.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
jobs:
- job: 'Test'
- job: 'integration_test_local_windows'
timeoutInMinutes: 0

steps:
- script: |
Expand All @@ -9,7 +10,6 @@ jobs:
python -m pip install scikit-learn==0.20.0 --user
python -m pip install keras==2.1.6 --user
python -m pip install torch===1.2.0 torchvision===0.4.1 -f https://download.pytorch.org/whl/torch_stable.html --user
python -m pip install torchvision --user
python -m pip install tensorflow-gpu==1.11.0 --user
displayName: 'Install dependencies for integration tests'
- script: |
Expand Down
1 change: 1 addition & 0 deletions test/pipelines-it-local.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
jobs:
- job: 'integration_test_local_ubuntu'
timeoutInMinutes: 0

steps:
- script: python3 -m pip install --upgrade pip setuptools --user
Expand Down
1 change: 1 addition & 0 deletions test/pipelines-it-remote-windows.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
jobs:
- job: 'integration_test_remote_windows'
timeoutInMinutes: 0

steps:
- script: python -m pip install --upgrade pip setuptools
Expand Down
1 change: 1 addition & 0 deletions test/pipelines-it-remote.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
jobs:
- job: 'integration_test_remote'
timeoutInMinutes: 0

steps:
- script: python3 -m pip install --upgrade pip setuptools --user
Expand Down

0 comments on commit 1958adb

Please sign in to comment.