Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import sagemaker
from sagemaker.tensorflow import TensorFlow
from sagemaker import Session
sess = sagemaker.Session()
role = sagemaker.get_execution_role()
# Create the apropriate folder struture, no need to be the same as I use
train_dir = 'data/train'
test_dir = 'data/test'
np.save(os.path.join(train_dir, 'train_images.npy'), train_images)
np.save(os.path.join(train_dir, 'train_labels.npy'), train_labels)
np.save(os.path.join(test_dir, 'test_images.npy'), test_images)
np.save(os.path.join(test_dir, 'test_labels.npy'), test_labels)
print(f"Sagemaker bucket: {sess.default_bucket()}")
s3_prefix = 'fashion-mnist'
traindata_s3_prefix = '{}/data/train'.format(s3_prefix)
testdata_s3_prefix = '{}/data/test'.format(s3_prefix)
train_s3 = sagemaker.Session().upload_data(path='./data/train/', key_prefix=traindata_s3_prefix)
test_s3 = sagemaker.Session().upload_data(path='./data/test/', key_prefix=testdata_s3_prefix)
inputs = {'train':train_s3, 'test': test_s3}
print(inputs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.