Skip to content

Integrate with Tensorboard

TensorBoard is a visualization toolkit for machine learning experimentation. TensorBoard allows tracking and visualizing metrics such as loss and accuracy, visualizing the model graph, viewing histograms, displaying images and much more.

Instrument your Tensorboard scripts with Comet to quickly see what Comet can offer you.

Comet integrates with several implementations of Tensorboard:

  • Tensorflow Tensorboard, the initial implementation used in the Tensorflow ecosystem.
  • TensorboardX, a community implementation of Tensorboard format for the Pytorch ecosystem.
  • Pytorch Tensorboard, an officially supported implementation of Tensorboard by the Pytorch project.

Start logging

Connect Comet to your existing code by adding in a simple Comet Experiment.

import comet_ml
import tensorflow as tf

experiment = comet_ml.Experiment(
    api_key="<Your API Key>",
    project_name="<Your Project Name>"
)
writer = tf.summary.create_file_writer("./mylogs")
# Your code here
import comet_ml
from tensorboardX import SummaryWriter

# Initialize the SummaryWriter
writer = SummaryWriter(
    comet_config={
        "api_key": "<Your API Key>",
        "project_name": "<Your Project Name>",
        "disabled": False,
    }
)
# Your code here
import comet_ml
from torch.utils.tensorboard import SummaryWriter

experiment = comet_ml.Experiment(
    api_key="<Your API Key>",
    project_name="<Your Project Name>"
)
writer = SummaryWriter()
# Your code here

Note

There are other ways to configure Comet. See more here.

Log automatically

After you have configured the Comet tensorboard integration, Comet automatically logs the following Tensorboard items, by default, with no additional configuration:

ItemTensorflow TensorboardTensorboardXPytorch Tensorboard
MetricsYesYesYes
ParametersYesYesNo
Histograms AssetsYesYesNo
Text AssetsYesYesNo
Audio AssetsYesYesNo
Image AssetsYesYesYes
Video Assets-NoNo
CurveNoYesNo
EmbeddingNoYesNo
Model GraphNoNoNo
MeshNoNoNo

Note

Don't see what you need to log here? We have your back. You can manually log any kind of data to Comet using the Experiment object. For example, use experiment.log_image to log images, or experiment.log_audio to log audio.

End-to-end example

Try out one of these example Colab Notebooks for using Comet with TensorBoard.

  • Tensorflow Tensorboard: Open In Colab
  • Pytorch TensorboardX: Open In Colab
  • Pytorch Tensorboard: Open In Colab

Configure Comet for Tensorboard

You can control which items are logged automatically. Use any of the following methods:

experiment = comet_ml.Experiment(
    auto_metric_logging=True, # Can be True or False.
    auto_param_logging=True, # Can be True or False
    auto_histogram_tensorboard_logging=True, # Can be True or False
)

Add or remove these fields from your .comet.config file under the [comet_auto_log] section to enable or disable logging.

[comet_auto_log]
metrics=true # can be true or false
parameters=true # can be true or false
histogram_tensorboard=true # can be true or false
export COMET_AUTO_LOG_METRICS=true # Can be true or false
export COMET_AUTO_LOG_PARAMETERS=true # Can be true or false
export COMET_AUTO_LOG_HISTOGRAM_TENSORBOARD=true # Can be true or false

For more information about configuring Comet, see Configure Comet.

Apr. 25, 2024