Last active
January 18, 2019 21:29
-
-
Save ResidentMario/abec5b3b55de48390b9835c8fd145a63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sagemaker as sage | |
# this line of code requires iam:GetRole permissions | |
role = sage.get_execution_role() | |
# initialize a SageMaker session and use it to get account and region info | |
# you can also do this using boto3 if you so prefer | |
# use that to get your home ECR registry, and from there your training image | |
sess = sage.Session() | |
account = sess.boto_session.client('sts').get_caller_identity()['Account'] | |
region = sess.boto_session.region_name | |
image = '{}.dkr.ecr.{}.amazonaws.com/quiltdata/sagemaker-demo'.format(account, region) | |
# create an estimator and fit it | |
# replace "s3://quilt-example" in `output_path` with a path into bucket you have access to | |
clf = sage.estimator.Estimator(image, | |
role, 1, 'ml.c4.2xlarge', | |
output_path="s3://quilt-example/quilt/quilt_sagemaker_demo/model", | |
sagemaker_session=sess) | |
clf.fit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment