Add Sacred FileStorageObserver
Some checks failed
s444409-training/pipeline/head There was a failure building this commit

This commit is contained in:
Marcin Kostrzewski 2022-05-06 21:37:04 +02:00
parent f716e52cbf
commit d794e390aa
3 changed files with 13 additions and 1 deletions

1
.gitignore vendored
View File

@ -19,3 +19,4 @@ __pycache__
evaluation_results.txt
model_out
trend.png
sacred_runs

View File

@ -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}/"
}
}

View File

@ -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.")
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')