Search code examples
kerasmlflow

Does mlflow support to save model to .h5?


I can input my Keras data (model, kappa, loss, epoch, ...) into MLflow now. My original model is H5, but the model saved in MLflow under artifacts/model/data/model/saved_model.pb is PB. Is it possible to save .h5 in MLflow?


Solution

  • By default mlflow save_format is tf which will allow the model to save in pb format. I made it work(changing to h5 format) using below code

    mlflow.tensorflow.log_model(model, "models", keras_model_kwargs={"save_format": "h5"})
    

    After this save format will change to h5 enter image description here

    and the model will be saved in model.h5

    enter image description here

    Tested this in mlflow v2.3.0