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:
1
import neptune.new as neptune
2
3
# Start 1st run
4
my_run1 = neptune.init(project='common/showroom',
5
name='logging-to-multipe-runs',
6
tags=['do-not-remove', 'multiple'])
7
my_run1['params'] = {'lr': 0.007}
8
9
# Start 2nd run
10
my_run2 = neptune.init(project='common/showroom',
11
name='logging-to-multipe-runs',
12
tags=['do-not-remove', 'multiple'])
13
my_run2['params'] = {'lr': 0.0034}
14
15
# Start 3rd run
16
my_run3 = neptune.init(project='common/showroom',
17
name='logging-to-multipe-runs',
18
tags=['do-not-remove', 'multiple'])
19
my_run3['params'] = {'lr': 0.005}
20
21
22
# Log metric to my_run1
23
for j in range(1, 101):
24
my_run1['train/loss'].log(0.7/j**0.5)
25
26
# Log metric to my_run2
27
for j in range(1, 101):
28
my_run2['train/loss'].log(0.8/j**0.5)
29
30
# Log metric to my_run3
31
for j in range(1, 101):
32
my_run3['train/loss'].log(0.9/j**0.5)
33
34
# Stop tracking (only for notebooks)
35
my_run1.stop()
36
my_run2.stop()
37
my_run3.stop()
Copied!
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.
Last modified 1mo ago
Export as PDF
Copy link