Python client library overview#
The Neptune client library (Neptune API) is an open-source suite of libraries to help you log, query, and download model-building metadata. You can also use the Neptune API to manage projects, users, and model stages.
The API is lightweight and designed to integrate with your MLOps tech stack in a flexible manner. It's up to you to define what to log for each run and in what kind of structure.
Neptune supports the R language with a separate client library. The R package uses Python underneath the hood.
To start using the library, install it via pip or conda:
Installing through Anaconda Navigator
To find neptune-client, you may need to update your channels and index.
- In the Navigator, select Environments.
- In the package view, click Channels.
- Click Add..., enter
conda-forge, and click Update channels.
- In the package view, click Update index... and wait until the update is complete. This can take several minutes.
You should now be able to search for neptune-client.
Note: The displayed version may be outdated. The latest version of the package will be installed.
then import Neptune in your model-training script:
and initialize a run, model, or project object that you'll log metadata to:
- You can omit your credentials from the init functions once you've saved them as environment variables. For details, see Setting your API token.
Assign metadata or files to your object, and execute the script as you normally would.
# Log metrics or other values inside loops for epoch in range(n_epochs): ... # Your training loop run["train/epoch/loss"].log(loss) # Each log() appends a value run["train/epoch/accuracy"].log(acc) # Track and version artifacts run["train/images"].track_files("./datasets/images") # Upload entire files run["test/preds"].upload("path/to/test_preds.csv") # Record text or other metadata, in a structure of your choosing run["tokenizer"] = "regexp_tokenize"
The Neptune API is also available to use integrated with various machine-learning tools, which lets you log typical metadata with less manual setup.
To learn more, see Integrations.
The Neptune client library comes with a command-line interface (CLI) tool.
You can use Neptune CLI to locally manage the synchronization of your data with Neptune servers, which comes in handy if you have data that's only stored locally (for example, if you experience connectivity issues).
To learn more, see the Neptune CLI overview.