A collection of notes and resources
<!-- ParametersでEnvironmentTypeがDevelopmentかProductionの2通りだと定義 -->
<!-- ConditionsでIsProductionを定義して、Resources > SagemakerModel > Conditionで条件付きリソース生成を定義 -->
AWSTemplateFormatVersion: "2010-09-09"
Description: SageMaker Model with Conditional Creation Example
Parameters:
EnvironmentType:
Type: String
Description: Type of environment
AllowedValues:
- Production
- Development
Default: Development
Conditions:
IsProduction:
Fn::Equals: [!Ref EnvironmentType, Production]
Resources:
SageMakerModel:
Type: "AWS::SageMaker::Model"
Condition: IsProduction
Properties:
ExecutionRoleArn: !Sub "arn:aws:iam::${AWS::AccountId}:role/service-role/AmazonSageMaker-ExecutionRole-20200101T123456"
PrimaryContainer:
Image: "123456789012.dkr.ecr.us-west-2.amazonaws.com/my-sagemaker-image:latest"
ModelDataUrl: "s3://my-bucket/model.tar.gz"
ModelName: "MySageMakerModel"
{"input": "<input text>"}
- {"image-ref": "s3://bucket/path/to/image001.png", "caption": "<prompt text>"}
- 画像に対するキャプション=ラベルを提供しています。
- {"prompt": "<prompt1>", "completion": "<expected generated text>"}
- プロンプトに対する正答例(ラベル)を付与しているデータの形式です。
- {"system": "<system message>","messages":[{"role": "user", "content": "<user query>"},{"role": "assistant", "content": "<expected generated text>"}]}
- messages のやり取りをしているようなデータの形式となっています。
/invocationsエンドポイントをポート8080でリッスンする/opu/ml/modelにモデルアーティファクトを配置して、読み取り専用とする/pingエンドポイントでヘルスチェックをリッスンし、GETリクエストに200ステータスコードを返す