Pass run object between functions#
Once you've created a run with the init_run()
function, you can pass it to functions from other files. This way, you can work with a larger codebase.
Example#
# Import from "utils.py" file
from utils import log_images_epoch
# Create run in project
run = neptune.init_run() # (1)!
# Log metrics in the same file
run["train/acc"] = 0.95
run["train/f1"] = 0.65
# Log by using an imported function, passing "run" as the argument
log_images_epoch(run=run)
-
We recommend saving your API token and project name as environment variables.
If needed, you can pass them as arguments when initializing Neptune: