Neptune

neptune

neptune is a global object that you can use to start new tracked runs or re-connect to already existing ones. It also provides some convenience functionalities like obtaining the last created run.

.init()

Starts a new tracked run, and append it to the top of the Runs table view. All parameters are optional, hence minimal invocation: run = neptune.init().

Parameters

project

(str, optional, default is None) – Name of a project in a form of namespace/project_name. If None, the value of NEPTUNE_PROJECT environment variable will be taken.

api_token

(str, optional, default is None) – User’s API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.

Note: It is strongly recommended to use NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

run

(str, optional, default is None) – An existing run's identifier like'SAN-1' in case of resuming a tracked run. A run with such identifier must exist. If None is passed, starts a new tracked run. See Resume run guide.

custom_run_id

(str, optional, default is None) – A unique identifier that can be used to log metadata to a single run from multiple files or processes. Make sure you are using the same identifier everywhere. See Pipelines guide.

If None and the NEPTUNE_CUSTOM_RUN_ID environment variable is set Neptune will use its value as custom_run_id.

mode

(str, optional, default is 'async') – Connection mode in which the tracking will work. Possible values "async", "sync", "offline", and "debug", "read-only". See Connection modes guide.

name

(str, optional, default is 'Untitled') – Editable name of the run. Name is displayed in the run's Details and in Runs table as a column.

description

(str, optional, default is '') – Editable description of the run. Description is displayed in the run's Details and can be displayed in the runs view as a column.

tags

(list, optional, default is []) – Must be a list of str. Tags of the run. They are editable after run is created. Tags are displayed in the run's Details and can be viewed in Runs table view as a column.

source_files

(list or str, optional, default is None) – List of source files to be uploaded. Must be list of str or single str. Uploaded sources are displayed in the run’s Source code tab.

If None is passed, the Python file from which the run was created will be uploaded. In case of resuming the run no file will be uploaded by default.

Pass empty list ([]) to upload no files.

Unix style pathname pattern expansion is supported. For example, you can pass '*.py' to upload all python source files from the current directory. For Python 3.5 or later, paths of uploaded files on server are resolved as relative to the calculated common root of all uploaded source files. For older Python versions, paths on server are resolved always as relative to the current directory. For recursion lookup use '**/*.py' (for Python 3.5 and later). For more information see glob library.

capture_stdout

(Boolean, optional, default is True) – Whether to send run's stdout. Tracked metadata will be stored inside monitoring_namespace.

capture_stderr

(Boolean, optional, default is True) – Whether to send run’s stderr. Tracked metadata will be stored inside monitoring_namespace.

capture_hardware_metrics

(Boolean, optional, default is True) – Whether to send hardware monitoring logs (CPU, GPU, Memory utilization). Tracked metadata will be stored inside monitoring_namespace.

monitoring_namespace

(str, optional, default is 'monitoring') - Namespace inside which all monitoring logs be stored.

fail_on_exception

(Boolean, optional, default is True) – Whether to set run's Failed state as True, if an uncaught exception happens.

flush_period

(float, optional, default is 5) - In an asynchronous (default) connection mode how often asynchronous thread should synchronize data with Neptune servers.

proxies

(dict, optional, default is None) - Argument passed to HTTP calls made via the Requests library. For more information see their proxies section.

Returns

Run object that is used to manage the tracked run and log metadata to it.

Examples

import neptune.new as neptune
# minimal invoke
run = neptune.init()
# create a tracked run with a name
run = neptune.init(name='first-pytorch-ever')
# create a tracked run with a name and a description, and no sources files uploaded
run = neptune.init(name='neural-net-mnist',
description='neural net trained on MNIST',
source_files=[])
# Send all py files in cwd (excluding hidden files with names beginning with a dot)
run = neptune.init(source_files='*.py')
# Send all py files from all subdirectories (excluding hidden files with names beginning with a dot)
# Supported on Python 3.5 and later.
run = neptune.init(source_files='**/*.py')
# Send all files and directories in cwd (excluding hidden files with names beginning with a dot)
run = neptune.init(source_files='*')
# Send all files and directories in cwd including hidden files
run = neptune.init(source_files=['*', '.*'])
# Send files with names being a single character followed by '.py' extension.
run = neptune.init(source_files='?.py')
# larger example
run = neptune.init(name='first-pytorch-ever',
description='write longer description here',
tags=['list-of', 'tags', 'goes-here', 'as-list-of-strings'],
source_files=['training_with_pytorch.py', 'net.py'])

.get_last_run()

Returns last created Run object.

Returns

Run object last created by neptune global object.

Examples

import neptune.new as neptune
# Crate a new tracked run
neptune.init(name='A new approach', source_files='**/*.py')
# Oops! We didn't capture the reference to the Run object
# Not a problem! We've got you covered.
run = neptune.get_last_run()

.get_project()

Get a project with given name.

Parameters

name

(str, optional, default is None) – Name of a project in the form of namespace/project_name. If None, the value of NEPTUNE_PROJECT environment variable will be taken.

api_token

(str, optional, default is None) – User’s API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.

Note: It is strongly recommended to use NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

Returns

Project object that can be used to interact with the project as a whole like fetching data from Runs table.

Examples

import neptune.new as neptune
# Fetch project 'jack/sandbox'
project = neptune.get_project(name='jack/sandbox')
# Fetch all Runs metadata as Pandas DataFrame
runs_table_df = project.fetch_runs_table().to_pandas()

.ANONYMOUS

Anonymous user API token. See ANONYMOUS_API_TOKEN.

.ANONYMOUS_API_TOKEN

Anonymous user API token. You can use this value as an api_token during .init() call both as a method parameter or by setting it as an environment variable.