signature + input_example added
All checks were successful
s434742-training/pipeline/head This commit looks good
s434742-evaluation/pipeline/head This commit looks good

This commit is contained in:
patrycjalazna 2021-05-23 14:31:27 +02:00
parent 3261254835
commit e1b7f01f83

View File

@ -1,5 +1,6 @@
import sys
from keras.backend import batch_dot, mean
from mlflow.models.signature import infer_signature
import pandas as pd
import numpy as np
from six import int2byte
@ -53,7 +54,8 @@ def my_main(epochs, batch_size):
# zapisanie modelu
model.save('avocado_model.h5')
return rmse, model
return rmse, model, X_train, y_train
@ -63,9 +65,10 @@ batch_size = int(sys.argv[2]) if len(sys.argv) > 2 else 16
with mlflow.start_run():
rmse, model = my_main(epochs, batch_size)
rmse, model, X_train, y_train = my_main(epochs, batch_size)
mlflow.log_param("epochs", epochs)
mlflow.log_param("batch_size", batch_size)
mlflow.log_metric("rmse", rmse)
mlflow.keras.log_model(model, 'avocado_model.h5')
#mlflow.keras.log_model(model, 'avocado_model.h5')
mlflow.keras.log_model(keras_model=model, path='avocado_model', signature=infer_signature(X_train, y_train), input_example=X_train.iloc[0])