How to run python script in the cloud?

Problem

How should I adjust a python script to run it in the cloud 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()

What you should do is choose a cloud worker and an environment that suits your needs. Go here to see what is available. Since you are using pytorch you would probably want to choose something like this:

1
2
3
4
neptune send \
--worker s-k80 \
--environment pytorch-0.4.0-gpu-py3 \
main.py

See also