pythontensorflowgoogle-colaboratorytensorflow2.0tensorboard

Tensorboard in Colab: No dashboards are active for the current data set


I am trying to display a Tensorboard in Google Colab. I import tensorboard: %load_ext tensorboard, then create a log_dir, and fit it as follows:

log_dir = '/gdrive/My Drive/project/' + "logs/fit/" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1)

history = model.fit_generator(
    train_generator,
    steps_per_epoch=nb_train_samples // batch_size,
    epochs=epochs,
    validation_data=validation_generator,
    validation_steps=nb_validation_samples // batch_size,
    callbacks=[tensorboard_callback])

But when I call it with %tensorboard --logdir logs/fit it doesn't display. Instead, it throws the following message:

No dashboards are active for the current data set.

Is there a solution for this? is the problem in the fixed path I passed in log_dir?


Solution

  • Please try the below code

    log_dir = '/gdrive/My Drive/project/' + "logs/fit/"
    tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1)
    
    history = model.fit_generator(
        train_generator,
        steps_per_epoch=nb_train_samples // batch_size,
        epochs=epochs,
        validation_data=validation_generator,
        validation_steps=nb_validation_samples // batch_size,
        callbacks=[tensorboard_callback])
    
        %load_ext tensorboard
        %tensorboard --logdir /gdrive/My Drive/project/logs/fit/