Last active
April 5, 2021 13:35
-
-
Save sengstacken/e2ab7044d143b611d584e683350df3c4 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
# get default bucket | |
bucket_name = sagemaker.Session().default_bucket() | |
# upload data to s3 | |
# training data for sagemaker | |
s3_input_train = sagemaker.inputs.TrainingInput(s3_data='s3://{}/{}/data/train'.format(bucket_name, prefix), content_type='csv') | |
s3_input_validation = sagemaker.inputs.TrainingInput(s3_data='s3://{}/{}/data/val'.format(bucket_name, prefix), content_type='csv') | |
# generic estimator | |
xgb = sagemaker.estimator.Estimator(container, | |
role, | |
instance_count=1, | |
instance_type='ml.m4.xlarge', | |
output_path=f's3://{bucket}/{prefix}/output', | |
sagemaker_session=sess, | |
use_spot_instances=True, # Use spot instance | |
max_run=600, # Max training time | |
max_wait=3600) # Max training time + spot waiting time |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
initial commit