Log to multiple runs in one script

Logging to multiple runs in one script

You can freely create multiple runs in the single script and log to them separately. A general recipe is very straightforward, as you simply create multiple run objects.

Create three runs and log metric to each separately:

import neptune.new as neptune
# Start 1st run
my_run1 = neptune.init(project='common/showroom',
name='logging-to-multipe-runs',
tags=['do-not-remove', 'multiple'])
my_run1['params'] = {'lr': 0.007}
# Start 2nd run
my_run2 = neptune.init(project='common/showroom',
name='logging-to-multipe-runs',
tags=['do-not-remove', 'multiple'])
my_run2['params'] = {'lr': 0.0034}
# Start 3rd run
my_run3 = neptune.init(project='common/showroom',
name='logging-to-multipe-runs',
tags=['do-not-remove', 'multiple'])
my_run3['params'] = {'lr': 0.005}
# Log metric to my_run1
for j in range(1, 101):
my_run1['train/loss'].log(0.7/j**0.5)
# Log metric to my_run2
for j in range(1, 101):
my_run2['train/loss'].log(0.8/j**0.5)
# Log metric to my_run3
for j in range(1, 101):
my_run3['train/loss'].log(0.9/j**0.5)

We log loss, by using the my_run1, my_run2 and my_run3. In this way you can log to many runs from the same Python script.