Neptune
Logging and visualizing experiments with neptune.ai
The Neptune Experiment Tracker is an Experiment Tracker flavor provided with the Neptune-ZenML integration that uses neptune.ai to log and visualize information from your pipeline steps (e.g. models, parameters, metrics).
When would you want to use it?
Neptune is a popular tool that you would normally use in the iterative ML experimentation phase to track and visualize experiment results or as a model registry for your production-ready models. Neptune can also track and visualize the results produced by your automated pipeline runs, as you make the transition towards a more production-oriented workflow.
You should use the Neptune Experiment Tracker:
if you have already been using neptune.ai to track experiment results for your project and would like to continue doing so as you are incorporating MLOps workflows and best practices in your project through ZenML.
if you are looking for a more visually interactive way of navigating the results produced from your ZenML pipeline runs (e.g. models, metrics, datasets)
if you would like to connect ZenML to neptune.ai to share the artifacts and metrics logged by your pipelines with your team, organization, or external stakeholders
You should consider one of the other Experiment Tracker flavors if you have never worked with neptune.ai before and would rather use another experiment tracking tool that you are more familiar with.
How do you deploy it?
The Neptune Experiment Tracker flavor is provided by the Neptune-ZenML integration. You need to install it on your local machine to be able to register the Neptune Experiment Tracker and add it to your stack:
zenml integration install neptune -yThe Neptune Experiment Tracker needs to be configured with the credentials required to connect to Neptune using an API token.
Authentication Methods
You need to configure the following credentials for authentication to Neptune:
api_token: API key token of your Neptune account. You can create a free Neptune account here. If left blank, Neptune will attempt to retrieve the token from your environment variables.project: The name of the project where you're sending the new run, in the form "workspace-name/project-name". If the project is not specified, Neptune will attempt to retrieve it from your environment variables.
This method requires you to configure a ZenML secret to store the Neptune tracking service credentials securely.
You can create the secret using the zenml secret create command:
Once the secret is created, you can use it to configure the neptune Experiment Tracker:
This option configures the credentials for neptune.ai directly as stack component attributes.
This is not recommended for production settings as the credentials won't be stored securely and will be clearly visible in the stack configuration.
For more, up-to-date information on the Neptune Experiment Tracker implementation and its configuration, you can have a look at the SDK docs .
How do you use it?
To log information from a ZenML pipeline step using the Neptune Experiment Tracker component in the active stack, you need to enable an experiment tracker using the @step decorator. Then fetch the Neptune run object and use logging capabilities as you would normally do. For example:
Logging ZenML pipeline and step metadata to the Neptune run
You can use the get_step_context method to log some ZenML metadata in your Neptune run:
Adding tags to your Neptune run
You can pass a set of tags to the Neptune run by using the NeptuneExperimentTrackerSettings class, like in the example below:
Check out the SDK docs for a full list of available attributes
Neptune UI
Neptune comes with a web-based UI that you can use to find further details about your tracked experiments. You can find the URL of the Neptune run linked to a specific ZenML run printed on the console whenever a Neptune run is initialized. You can also find it in the dashboard in the metadata tab of any step that has used the tracker:

Each pipeline run will be logged as a separate experiment run in Neptune, which you can inspect in the Neptune UI.

Clicking on one run will reveal further metadata logged within the step:

Full Code Example
This section shows an end to end run with the ZenML Neptune integration.
Further reading
Check Neptune's docs for further information on how to use this integration and Neptune in general.
Last updated
Was this helpful?