Archive MLFlow artifacts
All checks were successful
s444409-evaluation/pipeline/head This commit looks good
s444409-training/pipeline/head This commit looks good

This commit is contained in:
Marcin Kostrzewski 2022-05-09 18:23:12 +02:00
parent 60a565098c
commit 858e9ec215
2 changed files with 9 additions and 5 deletions

View File

@ -41,7 +41,7 @@ pipeline {
stage('Archive model and evaluate it') { stage('Archive model and evaluate it') {
steps { steps {
archiveArtifacts artifacts: 'model_out', onlyIfSuccessful: true archiveArtifacts artifacts: 'model_out', onlyIfSuccessful: true
archiveArtifacts artifacts: 'sacred_runs/**', onlyIfSuccessful: true archiveArtifacts artifacts: 'mlruns/**', onlyIfSuccessful: true
build job: "s444409-evaluation/${params.BRANCH}/", parameters: [string(name: 'BRANCH', value: "${params.BRANCH}")] build job: "s444409-evaluation/${params.BRANCH}/", parameters: [string(name: 'BRANCH', value: "${params.BRANCH}")]
} }
} }

View File

@ -1,6 +1,7 @@
import torch import torch
import mlflow import mlflow
import argparse import argparse
import numpy as np
from torch import nn from torch import nn
from torch.utils.data import DataLoader from torch.utils.data import DataLoader
from urllib.parse import urlparse from urllib.parse import urlparse
@ -34,6 +35,8 @@ if __name__ == "__main__":
plant_test = PlantsDataset('data/Plant_1_Generation_Data.csv.test') plant_test = PlantsDataset('data/Plant_1_Generation_Data.csv.test')
plant_train = PlantsDataset('data/Plant_1_Generation_Data.csv.train') plant_train = PlantsDataset('data/Plant_1_Generation_Data.csv.train')
input_example = np.array([plant_test.x_train.numpy()[0]])
train_dataloader = DataLoader(plant_train, batch_size=batch_size) train_dataloader = DataLoader(plant_train, batch_size=batch_size)
test_dataloader = DataLoader(plant_test, batch_size=batch_size) test_dataloader = DataLoader(plant_test, batch_size=batch_size)
@ -71,9 +74,10 @@ if __name__ == "__main__":
if tracking_url_type_store != "file": if tracking_url_type_store != "file":
mlflow.pytorch.log_model( mlflow.pytorch.log_model(
model, model,
"s444409-power-plant-model", "s444409",
registered_model_name="s444409PowerPlant", registered_model_name="s444409",
signature=signature signature=signature,
input_example=input_example
) )
else: else:
mlflow.pytorch.log_model(model, "s444409-power-plant-model", signature=signature) mlflow.pytorch.log_model(model, "s444409", signature=signature, input_example=input_example)