From 3033b4db863f030137131b1a1557108038b16757 Mon Sep 17 00:00:00 2001 From: Adrian Charkiewicz Date: Sat, 7 May 2022 12:19:39 +0200 Subject: [PATCH] parametrization of number of epochs --- Jenkinsfile3 | 12 ++++++++---- pytorch/pytorch.py | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile3 b/Jenkinsfile3 index 8c72cba..350b2ad 100644 --- a/Jenkinsfile3 +++ b/Jenkinsfile3 @@ -2,15 +2,19 @@ pipeline { agent { dockerfile true } - - - + parameters{ + string( + defaultValue: '1500', + description: 'Epoch number', + name: 'EPOCH_NUMBER' + ) + } stages { stage('Copy') { steps { copyArtifacts projectName: 's444354-create-dataset' - sh 'python3 ./pytorch/pytorch.py' + sh 'python3 ./pytorch/pytorch.py $EPOCH_NUMBER' } } stage('Archive') { diff --git a/pytorch/pytorch.py b/pytorch/pytorch.py index 3c2e037..bde8aab 100644 --- a/pytorch/pytorch.py +++ b/pytorch/pytorch.py @@ -149,7 +149,7 @@ def fit(epochs, lr, model, train_loader, val_loader, opt_func=torch.optim.SGD): # In[12]: -epochs = 1500 +epochs = sys.argv[1] lr = 1e-6 history5 = fit(epochs, lr, model, train_loader, val_loader)