predict from registry
This commit is contained in:
parent
4e1160e7f8
commit
fad30cde27
16
Jenkinsfile_predict_registry
Normal file
16
Jenkinsfile_predict_registry
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 's444507-create-dataset'
|
||||||
|
args '-v /mlruns:/mlruns'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Predict values using model from artifact') {
|
||||||
|
steps {
|
||||||
|
sh "python3 predict_from_registry.py"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -20,7 +20,7 @@ import mlflow.pytorch
|
|||||||
logging.basicConfig(level=logging.WARN)
|
logging.basicConfig(level=logging.WARN)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# mlflow.set_tracking_uri("http://localhost:5000/")
|
mlflow.set_tracking_uri("http://172.17.0.1:5000")
|
||||||
mlflow.set_experiment("s444507")
|
mlflow.set_experiment("s444507")
|
||||||
|
|
||||||
|
|
||||||
|
14
lab08_predict_from_registry.py
Normal file
14
lab08_predict_from_registry.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import json
|
||||||
|
import mlflow
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
logged_model = '/mlruns/13/da5c6167bb45403fa35569849a1fbc13/artifacts/model'
|
||||||
|
loaded_model = mlflow.pyfunc.load_model(logged_model)
|
||||||
|
|
||||||
|
|
||||||
|
with open(f'{logged_model}/input_example.json') as f:
|
||||||
|
data = json.load(f)
|
||||||
|
input_example = np.array([data['inputs'][0]], dtype=np.float64).reshape(-1, 2)
|
||||||
|
|
||||||
|
|
||||||
|
print(f'Prediction: {loaded_model.predict(input_example)}')
|
Loading…
Reference in New Issue
Block a user