How to run python script locally?

Problem

How should I adjust a python script to run it locally with Neptune?

Solution

You don’t have to adjust at all!

Say your main.py script looks like this:

1
2
3
4
5
6
7
8
import torch

def train_model():
    for i in range(1, 11, 1):
        print('Hello world for the {} time'.format(i))

if __name__ == '__main__':
    train_model()

All you need to do is run:

1
neptune run main.py

See also