Skip to content

Commit e23559a

Browse files
authored
Adding example notebooks for AWS Batch for SageMaker Training jobs. (#4852)
1 parent a9ad51b commit e23559a

File tree

7 files changed

+2638
-0
lines changed

7 files changed

+2638
-0
lines changed

build_and_train_models/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ The example notebooks within this folder showcase the capabilities of Amazon Sag
4444
- [Tabular classification with Amazon SageMaker LightGBM and CatBoost algorithm](sm-lightgbm_catboost_tabular_classification.ipynb)
4545
- [An Introduction to Linear Learner with MNIST](sm-linear_learner_mnist.ipynb)
4646
- [Tabular classification with Amazon SageMaker TabTransformer algorithm](sm-tabtransformer_tabular_classification.ipynb)
47+
- [AWS Batch for SageMaker Training jobs](sm-training-queues/sm-training-queues_getting_started_with_model_trainer.ipynb)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# AWS Batch for SageMaker Training jobs
2+
3+
These example notebooks demonstrate how to use AWS Batch for SageMaker Training jobs. SageMaker training queues allow you to efficiently manage and prioritize your training jobs, optimizing resource utilization and reducing wait times.
4+
5+
## IAM Permissions
6+
7+
The example notebooks require permissions to invoke AWS Batch APIs. Below is a sample IAM policy granting these permissions - this should be added to the role being used to execute the notebooks (which the notebooks use as both the role to invoke AWS Batch and the role passed to SageMaker for training execution).
8+
9+
```json
10+
{
11+
"Version": "2012-10-17",
12+
"Statement": [
13+
{
14+
"Effect": "Allow",
15+
"Action": [
16+
"batch:*"
17+
],
18+
"Resource": "*"
19+
},
20+
{
21+
"Effect": "Allow",
22+
"Action": [
23+
"iam:CreateServiceLinkedRole"
24+
],
25+
"Resource": "arn:aws:iam::*:role/*AWSServiceRoleForAWSBatchWithSagemaker",
26+
"Condition": {
27+
"StringEquals": {
28+
"iam:AWSServiceName": "sagemaker-queuing.batch.amazonaws.com"
29+
}
30+
}
31+
},
32+
{
33+
"Effect": "Allow",
34+
"Action": "iam:PassRole",
35+
"Resource": "*",
36+
"Condition": {
37+
"StringEquals": {
38+
"iam:PassedToService": [
39+
"sagemaker.amazonaws.com"
40+
]
41+
}
42+
}
43+
}
44+
]
45+
}
46+
```
47+
48+
**Note**: if you would like to create separate IAM roles for AWS Batch invocation and SageMaker training execution, there is sample code in the [utils/aws_batch_resource_management.py](utils/aws_batch_resource_management.py) module.
49+
50+
## Examples
51+
52+
The following notebooks provide hands-on examples for getting started with SageMaker training queues:
53+
54+
* [Getting Started with Training Queues using Estimator](training_queue_getting_started_with_estimator.ipynb) - Learn how to use SageMaker training queues with the an Estimator to queue and manage your training jobs.
55+
56+
* [Getting Started with Training Queues using ModelTrainer](training_queue_getting_started_with_model_trainer.ipynb) - Learn how to use SageMaker training queues with the a ModelTrainer to queue and manage your training jobs.
47.1 KB
Loading

0 commit comments

Comments
 (0)