How can i use Pytorch in submitting?

I have trained a DDQN policy model on my local computer by using Pytorch. When i submitting, i want to import Pytorch in the cloud enviroment. So i write the flollowing code:

import os
try:
import torch
except:
os.system(“pip install torch torchvision”)

but there is a bug in the cloud enviroment (from agent-logs) :

2020-08-04T10:08:18.232383425Z Collecting torch
2020-08-04T10:09:18.333863161Z WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fda93adb6d8>: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /simple/torch/
2020-08-04T10:10:18.896505036Z WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fda93adb630>: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /simple/torch/

So i wonder how can i use third-party packages like Pytorch in submitting?
Thanks!

Hi @pf1,

You wouldn’t have internet access during the evaluation. This is how you can specify the runtime for your submission:

Given above have lot of options to do same thing.
I will suggest adding pytorch via conda (it take care of dependencies better) here: https://gitlab.aicrowd.com/flatland/neurips2020-flatland-starter-kit/blob/master/environment.yml#L7

1 Like

Thanks a lot! I have add Pytorch via conda successfully.