From 60c251ae33aa49373f9a0c4fa124d525413456db Mon Sep 17 00:00:00 2001 From: Jan Nowak Date: Sun, 23 May 2021 16:39:59 +0200 Subject: [PATCH] train parametr modify --- Dockerfile | 2 ++ Jenkinsfile_train | 6 ++++-- dlgssdpytorch.py | 2 +- start_dlgssdpytorch.sh | 43 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 start_dlgssdpytorch.sh diff --git a/Dockerfile b/Dockerfile index 090a36d..e153154 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,8 @@ WORKDIR /app # RUN chmod +x skrypt.sh # RUN dos2unix skrypt.sh +COPY ./start_dlgssdpytorch.sh ./ +RUN chmod +x start_dlgssdpytorch.sh COPY ./dlgssdpytorch.py ./ RUN chmod +x dlgssdpytorch.py COPY ./create_dataset.py ./ diff --git a/Jenkinsfile_train b/Jenkinsfile_train index eef275b..678dfd9 100644 --- a/Jenkinsfile_train +++ b/Jenkinsfile_train @@ -32,8 +32,10 @@ pipeline { def img = docker.build('rokoch/ium:01') img.inside { sh 'rm -rf my_model' - sh 'chmod +x dlgssdpytorch.py' - sh 'python3 ./dlgssdpytorch.py $PARAMETRY' + //sh 'chmod +x dlgssdpytorch.py' + //sh 'python3 ./dlgssdpytorch.py $PARAMETRY' + sh 'chmod +x start_dlgssdpytorch.sh' + sh './start_dlgssdpytorch.sh $PARAMETRY' sh 'chmod +x train_mlflow.py' sh 'python3 ./train_mlflow.py $PARAMETRY' //sh 'mlflow run --experiment-name s426206 .' //Uruchamiany projekt nie moze znajdowac sie w katalogach z wielkimi literami. diff --git a/dlgssdpytorch.py b/dlgssdpytorch.py index 5edb142..d6ee4f5 100644 --- a/dlgssdpytorch.py +++ b/dlgssdpytorch.py @@ -11,7 +11,7 @@ from sacred.observers import MongoObserver, FileStorageObserver ex = Experiment("426206", interactive=False, save_git_info=False) ex.observers.append(FileStorageObserver('my_runs')) -ex.observers.append(MongoObserver(url='mongodb://mongo_user:mongo_password_IUM_2021@172.17.0.1:27017', db_name='sacred')) +#ex.observers.append(MongoObserver(url='mongodb://mongo_user:mongo_password_IUM_2021@172.17.0.1:27017', db_name='sacred')) class LayerLinearRegression(nn.Module): def __init__(self): super().__init__() diff --git a/start_dlgssdpytorch.sh b/start_dlgssdpytorch.sh new file mode 100644 index 0000000..402ea18 --- /dev/null +++ b/start_dlgssdpytorch.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +POSITIONAL=() +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -e|--epochs) + EPOCHS="$2" + shift # past argument + shift # past value + ;; + -l|--lr) + LR="$2" + shift # past argument + shift # past value + ;; + --default) + DEFAULT=YES + shift # past argument + ;; + *) # unknown option + POSITIONAL+=("$1") # save it in an array for later + shift # past argument + ;; +esac +done +set -- "${POSITIONAL[@]}" # restore positional parameters + + +if ! [ -z ${EPOCHS} ] && ! [ -z ${LR} ]; +then + python3 dlgssdpytorch.py with n_epochs=${EPOCHS} lr=${LR} +elif ! [ -z ${EPOCHS} ]; +then + python3 dlgssdpytorch.py with n_epochs=${EPOCHS} +elif ! [ -z ${LR} ]; +then + python3 dlgssdpytorch.py with lr=${LR} +else + python3 dlgssdpytorch.py +fi \ No newline at end of file