Fairly new to mlflow. I am using the dagshub free mlflow server for my experiments. I stumbled across a strange behavior. When I am running a simple keras model fit with mlflow autolog like this:
mlflow.tensorflow.autolog()
dagshub.init('my_experiment_name',
'my_user_name',
mlflow=True)
# Define the parameters.
num_epochs = 10
batch_size = 256
# Train the model.
history = model.fit(X_train,
y_train,
epochs=num_epochs,
batch_size=batch_size,
validation_data=(X_test, y_test))
mlflow.end_run()
This produces the expected behavior. I can see the model in artifacts and metrics.
However, when I try to add a figure containing the training accuracy and loss , the artifacts contain only the images.
mlflow.tensorflow.autolog()
dagshub.init('my_experiment_name',
'my_user_name',
mlflow=True)
# Define the parameters.
num_epochs = 10
batch_size = 256
# Train the model.
history = model.fit(X_train,
y_train,
epochs=num_epochs,
batch_size=batch_size,
validation_data=(X_test, y_test))
##_________ Problematic Part
fig, ax = plt.subplots(1,2,figsize=(10,4))
ax[0].plot(history.history['accuracy'], label='Accuracy' )
ax[0].plot(history.history['val_accuracy'], label='Val Accuracy' )
ax[0].set_title('Accuracy')
ax[0].legend(loc='best')
ax[1].plot(history.history['loss'], label='Loss' )
ax[1].plot(history.history['val_loss'], label='Val Loss' )
ax[1].set_title('Loss')
ax[1].legend(loc='best')
mlflow.log_figure(fig,'training_history.png')
# _________
mlflow.end_run()
The model artifacts aren’t there. The metrics also aren’t recorded.
Am I missing something straightforward.
Please help.