-
-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy pathneptune.py
38 lines (31 loc) · 948 Bytes
/
neptune.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# TO START:
# pip install neptune, livelossplot
# export environment variables
# enjoy results
import os
from time import sleep
import numpy as np
from livelossplot.outputs import NeptuneLogger
from livelossplot import PlotLosses
def main():
api_token = os.environ.get("NEPTUNE_API_TOKEN")
project_qualified_name = os.environ.get("NEPTUNE_PROJECT")
logger = NeptuneLogger(
api_token=api_token,
project_qualified_name=project_qualified_name,
tags=["example", "livelossplot"],
)
liveplot = PlotLosses(outputs=[logger])
for i in range(20):
liveplot.update(
{
"accuracy": 1 - np.random.rand() / (i + 2.0),
"val_accuracy": 1 - np.random.rand() / (i + 0.5),
"mse": 1.0 / (i + 2.0),
"val_mse": 1.0 / (i + 0.5),
}
)
liveplot.send()
sleep(0.5)
if __name__ == "__main__":
main()