Querying and downloading metadata

Almost all ML metadata that is logged to Runs in the Project can be downloaded to the local machine. You may want to do it for a variety of reasons:

  • Build custom analysis or visualizations using Runs data

  • Use saved model checkpoint elsewhere

  • Get the source code of a run and execute it again

  • Build a report that uses data across projects

  • Archive old project

There are two ways to download ML metadata from Neptune:

  1. Programmatically, by using neptune-client: for example downloading runs dashboard as pandas DataFrame.

  2. Directly from the UI: for example, downloading notebook checkpoint or runs dashboard as CSV.

Querying ML metadata via Neptune API

Download the Runs table as a Pandas DataFrame

To download runs table as pandas DataFrame use .fetch_runs_table().

import neptune.new as neptune
project = neptune.get_project(
# Get dashboard with runs contributed by 'sophia' tagged 'cycleLR'
run_table_df = project.fetch_runs_table(

run_table_df is a Pandas DataFrame, where each row is a Run and columns represent logged metadata such as metrics, text logs, and parameters.

To download only runs that you want, you can filter them by: id, state, owner, tag

Example data frame will look like this:

.fetch_runs_table()returns shallow information about the Runs. You can think of it as a data frame version of the Runs Table that you see in the web application. If you want to access all values of a series or download files logged to a Run read section Downloading single run data.

Downloading single Run data

You can fetch the Run metadata in a similar way you logged it. First, instantiate an existing run:

import neptune.new as neptune
run = neptune.init(
run='<RUN_ID>' # for example 'SAN-123'
# query a field
epoch_nr = run['epoch_nr'].fetch()

If you are only fetching the Run metadata you may instantiate the existing run in Read-only mode. This way no accidental modification of the metadata will be possible.

Querying single value Fields

You can access most of the single value Fields by using .fetch():

# Numerical fields
batch_size = run['parameters/batch_size'].fetch()
# Strings
username = run['sys/owner'].fetch()
# Datetime
last_updated = run['sys/modification_time'].fetch()

Tags Fields can be accessed by using .fetch()method that returns a set of str objects:

run_tags = run['sys/tags'].fetch()
if 'exploration' in run_tags:

Querying Series Fields

You can access numerical and text Series by using .fetch_last():

# Accessing FloatSeries
final_loss = run['train/loss'].fetch_last()
# Accessing StringSeries
last_stderr_line = run['sys/stderr'].fetch_last()

You can also retrieve all the values and their indexes as a Pandas DataFrame by using .fetch_values():

# Accessing all values and their indexes as a Pandas DataFrame
loss_df = run['train/loss'].fetch_values()
# Don't include timestampe
loss_df = run['train/loss'].fetch_values(include_timestamp=False)

Querying Artifact hash

You can get a hash of an Artifact field by using .fetch_hash():

# Query Artifact Hash (md5)
md5 = run['dataset/train'].fetch_hash()

To use artifacts you need at least 0.10.10 version of neptune client.

pip install neptune-client>=0.10.10

Downloading from single File Fields

Download files stored in File fields by using .download():

# Download example_image to the current directory
# Download model to the specified directory

Downloading from FileSeries Fields

Similarly, for FileSeries fields you can download the last file to the disk with .download_last() or download all files with .download():

# Download last file in the FileSeries
# Download all files in the FileSeries

You can query a Run namespace the same way you would access any other Field by specifying its path:

# Instead of using full path
batch_size = run['parameters/batch_size'].fetch()
# You can access a namespace and then a specific field within that namespace
parameters = run['parameters']
batch_size = parameters['batch_size'].fetch()

Downloading Artifacts

You can download files from artifact fields by using the .download() method:

# Download all files from the artifact

You can only download all files that were saved as a Neptune artifact. To use artifacts you need at least 0.10.10 version of neptune client.

pip install neptune-client>=0.10.10

Downloading ML metadata from Neptune UI

When in Neptune, simply look for the download icon. It’s located in multiple places in the application and allows you to download various parts of the runs or notebooks. Below are some examples:

Model checkpoints

Export Runs table as CSV

Notebook checkpoint

Run source code

Images in full size

What's next?