Is there a way to run a Deep Learning model locally with the data on AWS S3?

Viewed 172

I am trying to implement a Neutral Network using Tensorflow with the dataset categorized into different folders (Each folders represent each class). I would like to know if there's a way to use the data from S3 and run the Deep Learning model in the local machine.

I have all the files on S3 but am unable to bring it to the local machine.

P.S I'm using Python version 3.5

2 Answers

Tensorflow supports this (but I think not in the nightly builds), see documentation. Assuming you have configured the credentials as described (e.g. $HOME/.aws/credentials or with environment variables), you have to use URLs with s3 as protocol like

s3://mybucket/some/path/words.tsv

If you read or write files in your own code, be sure not to use any python IO but Tensorflow's tf.io.gfile.GFile. Similar, to list directories use e.g. tf.io.gfile.walk or tf.io.gfile.listdir

From the environment variables in the documentation, we only set AWS_REGION, but in addition the following ones are useful to control logging and avoid timeouts:

export AWS_LOG_LEVEL=3
export S3_REQUEST_TIMEOUT_MSEC=600000

Still, reading training data from s3 is usually only a good idea if you run your training on AWS. For running locally, it is usually better to copy the data to your local drive, e.g. with AWS CLI's sync command.

Related