Neptune client for Python
Python client is the main way of logging things to Neptune and there are way more materials on how to use it. Go here to read them.
To log metadata to Neptune you just need to install neptune-client and add a snippet to your code. See how to do that in 3 steps.

Step 1: Install Neptune client

Depending on your operating system open a terminal or CMD and run this command:
pip
conda
1
pip install neptune-client
Copied!
1
conda install -c conda-forge neptune-client
Copied!
For more help see installing neptune-client.
This integration is tested with neptune-client==0.9.16

Step 2: Add logging snippet to your scripts

my_script.py
1
import neptune.new as neptune
2
3
run = neptune.init(project='common/quickstarts',
4
api_token='ANONYMOUS')
5
6
# Track metadata and hyperparameters of your run
7
run["JIRA"] = "NPT-952"
8
run["algorithm"] = "ConvNet"
9
10
params = {
11
"batch_size": 64,
12
"dropout": 0.2,
13
"learning_rate": 0.001,
14
"optimizer": "Adam"
15
}
16
run["parameters"] = params
17
18
19
# Track the training process by logging your training metrics
20
for epoch in range(100):
21
run["train/accuracy"].log(epoch * 0.6)
22
run["train/loss"].log(epoch * 0.4)
23
24
# Log the final results
25
run["f1_score"] = 0.66
26
27
# Stop logging
28
run.stop()
Copied!

Step 3: Stop logging

Once you are done logging, you should stop tracking the run using the stop() method. This is needed only while logging from a notebook environment. While logging through a script, Neptune automatically stops tracking once the script has completed execution.
1
run.stop()
Copied!

Step 4: Execute your run normally

1
python my_script.py
Copied!
Last modified 1mo ago