fix mlflow directory mlruns

This commit is contained in:
Dawid 2021-05-28 21:48:35 +02:00
parent 3a8116d6a9
commit 611f1199e0
2 changed files with 15 additions and 4 deletions

View File

@ -1,7 +1,12 @@
pipeline {
agent {dockerfile true}
agent {
docker {
image 's430804/ium:0.5'
args '-v /tmp/mlruns:/tmp/mlruns -v /mlruns:/mlruns '
}
}
stages {
stage('training') {
stage('Predict model from partner mlflow') {
steps {
sh 'chmod +x pred_from_mlflow_model.py'
sh 'python3 pred_from_mlflow_model.py'

View File

@ -1,14 +1,20 @@
import json
import mlflow as mlf
from mlflow.tracking import MlflowClient
import pandas as pd
model_name = "s430705"
model_version = 8
model_version = 30
mlf.set_tracking_uri("http://172.17.0.1:5000")
model = mlf.pyfunc.load_model(
model_uri=f"models:/{model_name}/{model_version}"
)
with open('movies_imdb2/input_example.json', 'r') as datafile:
client = MlflowClient()
models_version = client.search_model_versions("name='s430705'")
input_path = models_version[-1].source
with open(f'{input_path}/input_example.json', 'r') as datafile:
data = json.load(datafile)['inputs']
input_dictionary = {idx:x for idx, x in enumerate(data)}