除了亚马逊官网的文章
https://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/ex1-model-deployment.html
https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/machinelearning-pattern-list.html,还有这些:
Pytorch学习
https://sagemaker.readthedocs.io/en/stable/frameworks/pytorch/using_pytorch.html
推理容器
https://docs.aws.amazon.com/sagemaker/latest/dg/adapt-inference-container.html
https://docs.aws.amazon.com/sagemaker/latest/dg/prebuilt-containers-extend.html
ML 模型容器
https://github.com/aws/deep-learning-containers/tree/master/pytorch
异步推理
https://docs.aws.amazon.com/sagemaker/latest/dg/async-inference.html
在线部署AWS服务的话,还需要了解存储/权限等其他基础设施服务:
存储
https://docs.aws.amazon.com/AmazonS3/latest/userguide/add-bucket-policy.html
权限
https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-service.html#roles-creatingrole-service-console
镜像
https://github.com/aws/deep-learning-containers/blob/master/available_images.md
自用账号别忘了注销服务:永久关闭亚马逊云AmazonAWS并解除信用卡绑定防止被扣费
权限问题
使用时有遇到在notebook里无法使用S3的文件,首先,bucket的根目录的名字需要以"sagemaker-"开头。见:Unable to access data from S3 bucket to jupyter notebook of aws sagemaker
如果还不行的话,就设置一下相关的权限,对应文章:
https://docs.aws.amazon.com/sagemaker/latest/dg/data-wrangler-security.html
Block public access (bucket settings) 也设置成off, 以s3的bucket配置:
https://us-east-1.console.aws.amazon.com/iamv2/home?region=us-east-1#/users/details/xxx?section=permissions
IAM->Users->xxx的permissions的tab下增加权限
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:ListAccessPointsForObjectLambda",
"s3:GetAccessPoint",
"s3:PutAccountPublicAccessBlock",
"s3:ListAccessPoints",
"s3:CreateStorageLensGroup",
"s3:ListJobs",
"s3:PutStorageLensConfiguration",
"s3:ListMultiRegionAccessPoints",
"s3:ListStorageLensGroups",
"s3:ListStorageLensConfigurations",
"s3:GetAccountPublicAccessBlock",
"s3:ListAllMyBuckets",
"s3:ListAccessGrantsInstances",
"s3:PutAccessPointPublicAccessBlock",
"s3:CreateJob"
],
"Resource": "*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": "s3:*",
"Resource": "arn:aws:s3:::*"
}
]
}
https://us-east-1.console.aws.amazon.com/iamv2/home?region=us-east-1#/policies/details/arn%3Aaws%3Aiam%3A%3A931637612418%3Apolicy%2Fservice-role%2FAmazonSageMaker-ExecutionPolicy-xxx/edit/v1/
IAM
Policies
AmazonSageMaker-ExecutionPolicy-20250416T160340
Edit policy
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::SageMaker"
]
},
{
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:DeleteObject"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::SageMaker/*"
]
}
]
}