neptune-scale Client Library

0.30.0 · active · verified Sun Apr 12

neptune-scale is the official Python client library for Neptune.ai, an MLOps platform for experiment tracking and model management. It enables users to log, visualize, and compare machine learning metadata such as metrics, parameters, and files at scale, especially designed for foundation model training. The library is actively developed, with the current stable version being 0.30.0 and frequent alpha/beta releases.

Warnings

Install

Imports

Quickstart

This quickstart initializes a Neptune Run, logs a configuration parameter and a series of metric values. It demonstrates the recommended use of environment variables for API token and project name, and the 'main guard' for safe execution.

import os
from neptune_scale import Run

# Set these environment variables before running:
# os.environ['NEPTUNE_API_TOKEN'] = 'YOUR_NEPTUNE_API_TOKEN'
# os.environ['NEPTUNE_PROJECT'] = 'YOUR_WORKSPACE/YOUR_PROJECT'

if __name__ == '__main__':
    try:
        with Run(project=os.environ.get('NEPTUNE_PROJECT', '')) as run:
            run['sys/tags'].add(['quickstart', 'example'])
            run['config/learning_rate'] = 0.001
            for i in range(10):
                run['metrics/loss'].append(0.9 - i * 0.05)
            print(f"Neptune run URL: {run.get_url()}")
    except Exception as e:
        print(f"An error occurred: {e}")
        print("Please ensure NEPTUNE_API_TOKEN and NEPTUNE_PROJECT environment variables are set correctly.")

view raw JSON →