From 6f485d6db1dc0417e5862be40269d7075200ad57 Mon Sep 17 00:00:00 2001 From: Jan Nowak Date: Sat, 24 Apr 2021 20:24:02 +0200 Subject: [PATCH] Dodano do dockerfile i jenkinsa obsluge skryptu z pytorchem. --- Dockerfile | 12 +++++++++--- Jenkinsfile | 6 +++--- dlgssdpytorch.py | 2 +- requirments.txt | 3 --- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 97fd44e..93fcc7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,12 +8,18 @@ RUN pip3 install kaggle RUN apt install -y unzip RUN mkdir /.kaggle RUN chmod -R 777 /.kaggle +#RUN export KAGGLE_CONFIG_DIR=~/.kaggle +COPY ./requirments.txt ./ +RUN pip3 install -r requirments.txt +RUN pip3 install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html # Stwórzmy w kontenerze (jeśli nie istnieje) katalog /app i przejdźmy do niego (wszystkie kolejne polecenia RUN, CMD, ENTRYPOINT, COPY i ADD będą w nim wykonywane) WORKDIR /app # Skopiujmy nasz skrypt do katalogu /app w kontenerze -COPY ./skrypt.sh ./ -RUN chmod +x skrypt.sh -RUN dos2unix skrypt.sh +# COPY ./skrypt.sh ./ +# RUN chmod +x skrypt.sh +# RUN dos2unix skrypt.sh +COPY ./dlgssdpytorch.py ./ +RUN chmod +x dlgssdpytorch.py diff --git a/Jenkinsfile b/Jenkinsfile index 26ab535..bafc034 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,8 +33,8 @@ pipeline { script { def img = docker.build('rokoch/ium:01') img.inside { - sh 'chmod +x skrypt.sh' - sh './skrypt.sh $CUTOFF' + sh 'chmod +x dlgssdpytorch.py' + sh 'python3 ./dlgssdpytorch.py | tee output.txt' } } } @@ -44,7 +44,7 @@ pipeline { stage('end') { steps { //Zarchiwizuj wynik - archiveArtifacts 'output.txt,Global_Superstore22.csv,Global_Superstore2.csv.dev,Global_Superstore2.csv.test,Global_Superstore2.csv.train' + archiveArtifacts 'output.txt' } } } diff --git a/dlgssdpytorch.py b/dlgssdpytorch.py index 7e709bf..6ba529b 100644 --- a/dlgssdpytorch.py +++ b/dlgssdpytorch.py @@ -149,4 +149,4 @@ for epoch in range(n_epochs): # Checks model's parameters print(model.state_dict()) print("Mean squared error for training: ", np.mean(losses)) -print("Mean squared error for valid: ", np.mean(val_losses)) \ No newline at end of file +print("Mean squared error for validating: ", np.mean(val_losses)) \ No newline at end of file diff --git a/requirments.txt b/requirments.txt index 3d7d79f..5b50b97 100644 --- a/requirments.txt +++ b/requirments.txt @@ -21,9 +21,6 @@ six==1.15.0 sklearn==0.0 text-unidecode==1.3 threadpoolctl==2.1.0 -torch==1.8.1+cpu -torchaudio==0.8.1 -torchvision==0.9.1+cpu torchviz==0.0.2 tqdm==4.60.0 typing-extensions==3.7.4.3