diff --git a/.gitignore b/.gitignore index 680c817..a483171 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ __pycache__ evaluation_results.txt model_out trend.png +sacred_runs diff --git a/Jenkinsfile-train b/Jenkinsfile-train index e75d67c..122b928 100644 --- a/Jenkinsfile-train +++ b/Jenkinsfile-train @@ -35,6 +35,7 @@ pipeline { stage('Archive model and evaluate it') { steps { archiveArtifacts artifacts: 'model_out', onlyIfSuccessful: true + archiveArtifacts artifacts: 'sacred_runs', onlyIfSuccessful: true build job: "s444409-evaluation/${params.BRANCH}/" } } diff --git a/train_model.py b/train_model.py index 8695f6d..18b290b 100644 --- a/train_model.py +++ b/train_model.py @@ -3,6 +3,7 @@ import argparse import numpy as np import pandas as pd import torch +from sacred.observers import FileStorageObserver from torch import nn from torch.utils.data import DataLoader, Dataset from sacred import Experiment @@ -120,7 +121,13 @@ def main(batch_size, epochs): print("Model saved in ./model_out file.") -ex = Experiment('Predict power output for a given time') +def setup_experiment(): + ex = Experiment('Predict power output for a given time') + ex.observers.append(FileStorageObserver('sacred_runs')) + return ex + + +ex = setup_experiment() @ex.config @@ -132,3 +139,6 @@ def experiment_config(): @ex.automain def run(batch_size, epochs): main(batch_size, epochs) + + +ex.add_artifact('model_out')