Getting started with Vertex TensorBoard

Vertex TensorBoard is an enterprise ready, managed version of TensorBoard, which is a Google open source project for Machine Learning experimental visualization.

TensorBoard provides a variety of detailed visualizations, which includes:

  • Tracking and visualizing metrics such as loss and accuracy over time
  • Visualizing a model computational graph (ops and layers)
  • Viewing histograms of weights, biases, or other tensors as they change over time
  • Projecting embeddings to a lower dimensional space
  • Displaying image, text, and audio samples
  • Profiling TensorFlow programs

With Vertex TensorBoard you can track, visualize, and compare ML experiments and share them with your team. In addition to the powerful visualizations from open source TensorBoard, Vertex TensorBoard provides:

  • A persistent, shareable link to your experiment's dashboard

  • A searchable list of all experiments in a project

  • Tight integrations with Vertex AI services for model training

  • Enterprise-grade security, privacy, and compliance

Getting Started

Before using Vertex TensorBoard, you need to create a managed TensorBoard instance. A TensorBoard instance is a regionalized resource which stores your Vertex TensorBoard experiments. You can create multiple TensorBoard instances in a project.

Create a Vertex TensorBoard instance

You can create a TensorBoard instance from the Cloud Console by following these steps.

  1. If you are new to Vertex AI or starting a new project, set up your project and development environment.
  2. In the Vertex AI section of the Google Cloud Console, go to the Experiments page.

    Go to the Experiments page
  3. Navigate to the TensorBoard Instances tab.
  4. Click Create at the top of the page.
  5. Modify the TensorBoard instance name field to create a descriptive display name.
  6. Select a region from the Region drop-down list and optionally add a description.
  7. Click Create to create your TensorBoard instance.

Alternatively, you can create a TensorBoard instance from the gcloud CLI.

  1. Install the gcloud CLI.

  2. Initialize the Cloud SDK by running gcloud init.

  3. Install the gcloud beta component, as Vertex TensorBoard is in Preview.

    gcloud components install beta
    gcloud components update
    
  4. Commands for Vertex TensorBoard are now accessible. Explore the commands to confirm installation.

    gcloud beta ai tensorboards --help
    

    The commands include create, describe, list, and delete. If needed, you can follow these steps to set default values for your project and region before proceeding.

    Now, you can create a TensorBoard instance.

  5. Authenticate to gcloud.

    gcloud auth application-default login
    
  6. Create a TensorBoard instance by providing a project name and a display name. This step might take a few minutes to complete for the first time in a project. Make note of the TensorBoard instance name (for example: projects/123/locations/us-central1/tensorboards/456) that will be printed at the end of the following command; it will be required in the later steps.

    gcloud beta ai tensorboards create --display-name DISPLAY_NAME \
      --project PROJECT_NAME
    

    Replace the following:

    • DISPLAY_NAME: a descriptive name for the TensorBoard instance

    • PROJECT_NAME: the project you wish to create the TensorBoard instance in

Using Vertex TensorBoard

TensorBoard is an open source visualization and analysis toolkit. In order to visualize experiments using Vertex TensorBoard you need to use TensorBoard APIs to prepare your TensorBoard logs. These logs can then be uploaded or streamed into your Vertex TensorBoard instance.

For more information on TensorBoard APIs, visit the TensorBoard open source docs.

Uploading TensorBoard logs with the Vertex TensorBoard Uploader

Vertex TensorBoard offers a Python CLI for uploading TensorBoard logs. You can use this to upload logs from any environment which can connect to Google Cloud.

Creating a virtual environment (optional)

Optional, but recommended first step: create a dedicated virtual environment to install the Vertex TensorBoard Uploader Python CLI.

python3 -m venv PATH/TO/VIRTUAL/ENVIRONMENT
source PATH/TO/VIRTUAL/ENVIRONMENT/bin/activate

Replace PATH/TO/VIRTUAL/ENVIRONMENT with the path to your dedicated virtual environment.

Install the Vertex TensorBoard Uploader through Vertex AI SDK

The uploader needs the latest version of pip in order to get installed properly.

pip install -U pip
pip install google-cloud-aiplatform[tensorboard]

Uploading TensorBoard logs

tb-gcp-uploader --tensorboard_resource_name TENSORBOARD_INSTANCE_NAME \
  --logdir=LOG_DIR \
  --experiment_name=TB_EXPERIMENT_NAME --one_shot=True

Replace the following:

  • LOG_DIR: the location of the event logs, which can reside either in the local file system or Cloud Storage

  • TENSORBOARD_INSTANCE_NAME: the name of the previously created TensorBoard resource that is printed at the end of the gcloud beta ai tensorboards create command.

  • TB_EXPERIMENT_NAME: the name of the experiment; for example test-experiment. The experiment name should be unique within a TensorBoard resource

The uploader CLI by default runs indefinitely, monitoring changes in the LOG_DIR, and uploads newly added logs. --one_shot=True disables the behavior. You can run tb-gcp-uploader --help for more information.

The CLI will output a link to the Vertex TensorBoard in the first few lines of the log where you can view your experiment. For example: View your Tensorboard at https://us-central1.tensorboard.googleusercontent.com/experiment/projects+123+locations+us-central1+tensorboards+4567+experiments+my-experiment-name

Viewing a Vertex TensorBoard experiment

You can view your Vertex TensorBoard experiment from the Google Cloud Console with the following steps.

  1. In the Vertex AI section of the Google Cloud Console, go to the Experiments page.

    Go to the Experiments page

  2. From the experiments tab, scroll or filter the experiments list to find your experiment.

  3. Click Open TensorBoard next to your experiment to open the Vertex TensorBoard UI.

If you use Vertex TensorBoard with custom training, an Open TensorBoard button appears on the top of the Training Job details page after selecting the training job from the Training page.

What's next