OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

mlflow doesn't autolog artifacts while logging images

  • Thread starter Thread starter Arindam
  • Start date Start date
A

Arindam

Guest
I am using the Dagshub free MLFlow server for my experiments. I stumbled across some strange behavior. When I am running a simple Keras model fit with MLFlow Autolog like this:

Code:
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.

enter image description here

However, when I try to add a figure containing the training accuracy and loss , the artifacts contain only the images.

Code:
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?

enter image description here Please help.
<p>I am using the Dagshub free MLFlow server for my experiments. I stumbled across some strange behavior. When I am running a simple Keras model fit with MLFlow Autolog like this:</p>
<pre><code>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()
</code></pre>
<p>This produces the expected behavior. I can see the model in artifacts and metrics.</p>
<p><a href="https://i.sstatic.net/oTlcS9WA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oTlcS9WA.png" alt="enter image description here" /></a></p>
<p>However, when I try to add a figure containing the training accuracy and loss , the artifacts contain only the images.</p>
<pre><code>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()
</code></pre>
<p>The model artifacts aren't there. The metrics also aren't recorded.</p>
<p>Am I missing something straightforward?</p>
<p><a href="https://i.sstatic.net/2oRZZfM6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2oRZZfM6.png" alt="enter image description here" /></a>
Please help.</p>
 

Latest posts

Top