Skip to content

API reference: TensorBoard integration#

The Neptune-TensorBoard integration has the following components:

  • The enable_tensorboard_logging() function, for logging metadata to TensorBoard and Neptune simultaneously.
  • The neptune tensorboard CLI command, for exporting existing TensorBoard logs to Neptune.


Logs the tracked metadata to both the tensorboard directory and the Neptune run.


Name      Type Default     Description
run Run - (required) An existing run reference, as returned by neptune.init_run().
base_namespace str, optional "tensorboard" Namespace under which all metadata logged by the integration will be stored.


import neptune
from neptune_tensorboard import enable_tensorboard_logging

run = neptune.init_run()
If Neptune can't find your project name or API token

As a best practice, you should save your Neptune API token and project name as environment variables:

export NEPTUNE_API_TOKEN="h0dHBzOi8aHR0cHM6Lkc78ghs74kl0jvYh3Kb8"
export NEPTUNE_PROJECT="ml-team/classification"

You can, however, also pass them as arguments when initializing Neptune:

run = neptune.init_run( # (1)!
    api_token="h0dHBzOi8aHR0cHM6Lkc78ghs74kl0jvYh3Kb8",  # your token here
    project="ml-team/classification",  # your full project name here
  1. Also works for init_model(), init_model_version(), and init_project().

  2. API token: In the bottom-left corner, expand the user menu and select Get my API token.

  3. Project name: in the top-right menu: Edit project details.

If you haven't registered, you can also log anonymously to a public project (make sure not to publish sensitive data through your code!):

run = neptune.init_run(

You can also customize the Neptune run with more options at initialization:

run = neptune.init_run(
    name="My TensorBoard run",
    tags=["test", "tensorboard", "fail_on_exception"],

For more, see neptune.init_run().

neptune tensorboard#

Exports TensorBoard logs from the logs directory to Neptune.

Where to enter the command
  • Linux: Command line
  • macOS: Terminal app
  • Windows: PowerShell or Command Prompt
  • Jupyter Notebook: In a cell, prefixed with an exclamation mark: ! your-command-here

Command syntax: neptune tensorboard [--api_token] [--project] logs

Options    Description
--api_token Neptune API token. Copy it from your user menu in the bottom-left corner of the Neptune app.
--project Neptune project name. To copy it, click the menu in the top-right corner and select Edit project details.


If you've set your Neptune credentials as environment variables, you can use the following command:

neptune tensorboard logs
How do I save my credentials as environment variables?

Set your Neptune API token and full project name to the NEPTUNE_API_TOKEN and NEPTUNE_PROJECT environment variables, respectively.

For example:

export NEPTUNE_API_TOKEN="h0dHBzOi8aHR0cHM.4kl0jvYh3Kb8...6Lc" # (1)!
  1. On Windows, the command is set instead of export.
export NEPTUNE_PROJECT="ml-team/classification" # (1)!
  1. On Windows, the command is set instead of export.

Finding your credentials:

  • API token: In the bottom-left corner of the Neptune app, expand your user menu and select Get your API token.
  • Project: Your full project name has the form workspace-name/project-name. To copy the name, click the menu in the top-right corner and select Edit project details.

If you're working in Colab, you can set your credentials with the os and getpass libraries:

import os
from getpass import getpass
os.environ["NEPTUNE_API_TOKEN"] = getpass("Enter your Neptune API token: ")
os.environ["NEPTUNE_PROJECT"] = "workspace-name/project-name"

Otherwise, you can pass the credentials as options:

neptune tensorboard --api_token I2YzgMz1...MifQ== --project ml-team/llm-project logs

neptune-notebooks incompatibility

Currently, the CLI component of the integration does not work together with the Neptune-Jupyter extension (neptune-notebooks).

Until a fix is released, if you have neptune-notebooks installed, you must uninstall it to be able to use the neptune tensorboard command.

See also

neptune-tensorboard repo on GitHub