From 2b3bfc70e4d5fb5cb6158038ee6f01eadc4ad471 Mon Sep 17 00:00:00 2001 From: piotr6789 Date: Mon, 24 May 2021 12:21:39 +0200 Subject: [PATCH] add multipieline project --- lab06/jenkinsfile-train | 5 ++--- pytorch-example.py | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lab06/jenkinsfile-train b/lab06/jenkinsfile-train index 442e2d7..e215a61 100644 --- a/lab06/jenkinsfile-train +++ b/lab06/jenkinsfile-train @@ -28,13 +28,12 @@ pipeline { } stage('Docker'){ steps{ - sh 'python3 "./pytorch-example.py" ${BATCH_SIZE} ${EPOCHS} > pred.txt' + sh 'python3 "./pytorch-example.py" ${BATCH_SIZE} ${EPOCHS} > model.txt' } } stage('archiveArtifacts') { steps{ - archiveArtifacts 'ium_s440058/**' - archiveArtifacts 'pred.txt' + archiveArtifacts 'model.txt' archiveArtifacts 'diabetes.pkl' } } diff --git a/pytorch-example.py b/pytorch-example.py index 75c8ab7..042d45c 100644 --- a/pytorch-example.py +++ b/pytorch-example.py @@ -6,6 +6,7 @@ import numpy as np import torch.nn.functional as F from torch.utils.data import DataLoader, TensorDataset, random_split from sklearn import preprocessing +import sys class LogisticRegressionModel(torch.nn.Module): def __init__(self, input_dim, output_dim): @@ -35,9 +36,9 @@ tTrain = torch.from_numpy(y_train.values.reshape(460,1)) fTest= torch.from_numpy(x_test.values) tTest = torch.from_numpy(y_test.values) -batch_size = 95 +batch_size = int(sys.argv[1]) if len(sys.argv) > 1 else 20 n_iters = 900 -num_epochs = int(n_iters / (len(x_train) / batch_size)) +num_epochs = int(sys.argv[2]) if len(sys.argv) > 2 else 10 learning_rate = 0.005 input_dim = 4 output_dim = 1