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.
Related
- For setup and usage, see the TensorBoard integration guide.
enable_tensorboard_logging()
#
Logs the tracked metadata to both the tensorboard
directory and the Neptune run.
Parameters
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. |
Examples
import neptune
from neptune_tensorboard import enable_tensorboard_logging
run = neptune.init_run()
enable_tensorboard_logging(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(
api_token="h0dHBzOi8aHR0cHM6Lkc78ghs74kl0jvYh3Kb8", # your token here
project="ml-team/classification", # your full project name here
)
- API token: In the bottom-left corner, expand the user menu and select Get my API token.
- 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!):
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"],
dependencies="infer",
fail_on_exception=True,
)
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. |
Examples
If you've set your Neptune credentials as environment variables, you can use the following command:
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:
- On Windows, the command is
set
instead ofexport
.
- On Windows, the command is
set
instead ofexport
.
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:
Otherwise, you can pass the credentials as options:
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.