Almost all ML metadata that is logged to Runs in the Projectcan 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:
Programmatically, by using neptune-client: for example downloading runs dashboard as pandas DataFrame.
Directly from the UI: for example, downloading notebook checkpoint or runs dashboard as CSV.
To download runs table as pandas DataFrame use
import neptune.new as neptuneyour_project = neptune.get_project(project='<YOUR_WORKSPACE/YOUR_PROJECT>',api_token='<YOUR_API_TOKEN>')# Get dashboard with runs contributed by 'sophia' tagged 'cycleLR'run_table_df = my_project.fetch_runs_table(owner='sophia',tag='cycleLR').to_pandas()run_table_df.head()
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.
Example data frame will look like this:
You can fetch the Run metadata in a similar way you logged it.
run['parameters/batch_size'].fetch() # returns single value e.g. 5
You can access most of the single value Fields by using
# Numerical fieldsbatch_size = run['parameters/batch_size'].fetch()# Stringsusername = run['sys/owner'].fetch()# Datetimelast_updated = run['sys/modification_time'].fetch()
You can access numerical and text Series by using
# Accessing FloatSeriesfinal_loss = run['train/loss'].fetch_last()# Accessing StringSerieslast_stderr_line = run['sys/stderr'].fetch_last()
You cal also retrieve all the values and their indexes as a Pandas DataFrame by using
# Accessing all values and their indexes as a Pandas DataFrameloss_df = run['train/loss'].fetch_values()# Don't include timestampeloss_df = run['train/loss'].fetch_values(include_timestamp=False)
Download files stored in
File fields by using
# Download example_image to the current directoryrun["data/example_image"].download()# Download model to the specified directoryrun["trained_model"].download(destination_path)
Similarly, for FileSeries fields you can download the last file to the disk with
.download_last() or download all files with
# Download last file in the FileSeriesrun['train/epoch/histogram'].download_last()# Download all files in the FileSeriesrun['train/epoch/histogram'].download()
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:
Runs table as csv
Run source code
Images in full size