From 39e30e9691cc6a6b356832b52b3cc509a3a7927b Mon Sep 17 00:00:00 2001 From: Jan Nowak Date: Sun, 23 May 2021 12:59:52 +0200 Subject: [PATCH] MLmodel file --- .gitignore | 1 + Jenkinsfile_train | 4 ++-- train_mlflow.py | 10 +++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index a8d64ed..26aacea 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ metrics.tsv plot.png my_runs mlruns +my_model \ No newline at end of file diff --git a/Jenkinsfile_train b/Jenkinsfile_train index 892d0b2..69724b6 100644 --- a/Jenkinsfile_train +++ b/Jenkinsfile_train @@ -34,11 +34,11 @@ pipeline { sh 'rm -rf my_model' sh 'chmod +x dlgssdpytorch.py' sh 'python3 ./dlgssdpytorch.py $PARAMETRY' - //sh 'chmod +x train_mlflow.py' + sh 'chmod +x train_mlflow.py' //sh 'chmod +x generate_MLmodel.py' //sh 'python3 ./generate_MLmodel.py' //sh 'mlflow ./train_mlflow.py' - //sh 'mlflow run .' + sh 'mlflow run .' } } } diff --git a/train_mlflow.py b/train_mlflow.py index 75fb2c0..3b7b4a2 100644 --- a/train_mlflow.py +++ b/train_mlflow.py @@ -20,13 +20,13 @@ class LayerLinearRegression(nn.Module): # Now it only takes a call to the layer to make predictions return self.linear(x) -parser = argparse.ArgumentParser(description='Program do uczenia modelu') -parser.add_argument('-l', '--lr', type=float, default=1e-3, help="Współczynik uczenia (lr)", required=False) -parser.add_argument('-e', '--epochs', type=int, default=100, help="Liczba epok", required=False) -args = parser.parse_args() - if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Program do uczenia modelu') + parser.add_argument('-l', '--lr', type=float, default=1e-3, help="Współczynik uczenia (lr)", required=False) + parser.add_argument('-e', '--epochs', type=int, default=100, help="Liczba epok", required=False) + args = parser.parse_args() + lr = args.lr n_epochs = args.epochs mlflow.set_experiment("s426206")