Skip to content

Instantly share code, notes, and snippets.

@ResidentMario
Last active January 19, 2019 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ResidentMario/835a68d536645c0d04897aef8bea088d to your computer and use it in GitHub Desktop.
Save ResidentMario/835a68d536645c0d04897aef8bea088d to your computer and use it in GitHub Desktop.
import sagemaker as sage
sess = sage.Session()
transformer = sagemaker.transformer.Transformer(
base_transform_job_name='Batch-Transform',
model_name='sagemaker-demo-[...]', # insert model name here
instance_count=1,
instance_type='ml.c4.xlarge',
output_path='s3://quilt-example/quilt_sagemaker_demo/outputs',
sagemaker_session=sess
)
# start an example prediction job
transformer.transform(
's3://quilt-example/quilt/fashion_mnist/fashion-mnist_train.csv',
content_type='text/csv',
split_type='Line'
)
# wait until prediction job is completed
transformer.wait()
# get the data in the read the resulting file
import boto3
s3_client = boto3.resource('s3')
s3_client.download_file('s3://quilt-example/', 'quilt_sagemaker_demo/model/[...]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment