Skip to content

Instantly share code, notes, and snippets.

@siakon89
Created October 7, 2020 10:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siakon89/174db31aae03d6af077a9ce01de8e029 to your computer and use it in GitHub Desktop.
Save siakon89/174db31aae03d6af077a9ce01de8e029 to your computer and use it in GitHub Desktop.
estimator = TensorFlow(
entry_point='model.py', # Script that has the model
train_instance_type='ml.p3.2xlarge', # The instance type for training
train_instance_count=1, # The number of instances to be spawned
model_dir='/opt/ml/model', # The location for the trained model
hyperparameters={ # Hyperparameters for the model
'epochs': 250,
'batch_size': 128,
'learning_rate': 0.001
},
role=sagemaker.get_execution_role(), # SageMaker's execution role
base_job_name='spot-training-test', # Name of the training job
framework_version='1.15', # Tensorflow version
py_version='py3', # Python version
script_mode=True, # Script mode enabled
train_use_spot_instances=True, # Use spot instance
train_max_run=600, # Max training time
train_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