This guide will show you how to:
  • Install the Neptune client library for Python
  • Connect Neptune to your script and create a run
  • Log metrics and view the results in the app
By the end of it, you'll see metadata tracked to your first run in Neptune!
If you're using R, see the R setup guide.

Before you start

If you'd rather not install anything, you can follow the guide in Google Colab with zero setup.

Step 1: Install the Neptune client library

pip install neptune-client
conda install -c conda-forge neptune-client
For more help, see Installation and setup.

Step 2: Create hello_neptune.py

Create a Python script called hello_neptune.py and copy-paste the following code to it:
import neptune.new as neptune
# Start a run
run = neptune.init(
project="common/quickstarts", # anyone can log to this public project
api_token="ANONYMOUS", # enables logging without registration
# Track metadata and hyperparameters of your run
run["JIRA"] = "NPT-952"
run["algorithm"] = "ConvNet"
params = {
"batch_size": 64,
"dropout": 0.2,
"learning_rate": 0.001,
"optimizer": "Adam",
run["parameters"] = params
# Track the training process by logging your training metrics
for epoch in range(100):
run["train/accuracy"].log(epoch * 0.6)
run["train/loss"].log(epoch * 0.4)
# this just creates a couple of series so we can view them as charts
# Log the final results
run["f1_score"] = 0.66
# Stop the connection and sync the data with Neptune

Step 3: Run your script and explore the results

Now that you have your Hello Neptune script ready, run it from your terminal, Jupyter Lab, or other environments.
python hello_neptune.py
Click on the link in the console output to open the run.
In the left pane, check out the following sections:
  • All metadata - the logged metadata displayed in a folder-like structure.
  • Charts - metrics visualized as charts.
  • Monitoring - hardware consumption during the run execution.
  • Source code - the script that was used for the run.
Viewing all metadata of a run


Congrats! You've learned how to track some model-building metadata with Neptune.

What’s next?

  • Rerun the script with different parameters to track a few more runs, then click Compare runs in the very left pane to compare and visualize them.
  • When you move on from Hello Neptune, complete the authentication part of installation and setup:
    • Save your API token as an environment variable and omit the api_token parameter from the code. You can then log metadata to any Neptune project you have access to and your API token is kept secure.
    • Set the project argument to your own project name, or export that as an environment variable too.
Other resources to check out: