SageMaker 管道实际上是什么?
What are SageMaker pipelines actually?
我不太清楚 Sagemaker 管道,我在 ML 领域没有经验,但我正在努力弄清楚管道定义。
我有几个问题:
sagemaker 管道是独立的吗service/feature?因为我没有看到任何通过控制台创建它们的选项,尽管我确实看到了 CloudFormation 和 CDK 资源。
sagemaker 流水线本质上是代码流水线吗?这些如何整合,它们有何不同?
还有一个 Python SDK,这与 CDK 和 CloudFormation 有何不同?
除了Python SDK的用法,我好像找不到任何例子,怎么回事?
文档和研讨会似乎只正确描述了 Python SDK 的使用,如果有人能帮我解决这个问题,那将非常有帮助!
SageMaker 有两个称为管道的东西:Model Building Pipelines and Serial Inference Pipelines。我相信你指的是前者
模型构建管道定义了机器学习工作流中的步骤,例如预处理、超参数调整、批量转换和设置端点
一个串行推理管道是两个或多个 SageMaker 模型运行一个接一个
模型构建管道在 JSON 中定义,并且 hosted/run SageMaker
以某种专有的无服务器方式
Is sagemaker pipelines a stand-alone service/feature? Because I don't see any option to create them through the console, though I do see CloudFormation and CDK resources.
您可以 create/modify 他们使用 API, which can also be called via the CLI, Python SDK, or CloudFormation。这些都使用了 AWS API under hood
您可以在 SageMaker Studio 中 start/stop/view 它们:
Left-side Navigation bar > SageMaker resources > Drop-down menu > Pipelines
Is a sagemaker pipeline essentially codepipeline? How do these integrate, how do these differ?
不太可能。 CodePipeline 更多用于构建和部署代码,而不是特定于 SageMaker。据我所知,没有直接集成,除了你可以用 CP
启动 SM 管道
There's also a Python SDK, how does this differ from the CDK and CloudFormation?
Python SDK 是一个独立的库,以开发人员友好的方式与 SageMaker 交互。它比 CloudFormation 更具动态性。让我们使用代码构建管道。而 CloudFormation 采用静态 JSON 字符串
Python SageMaker SDK 用法的一个非常简单的示例:
processor = SKLearnProcessor(
framework_version="0.23-1",
instance_count=1,
instance_type="ml.m5.large",
role="role-arn",
)
processing_step = ProcessingStep(
name="processing",
processor=processor,
code="preprocessor.py"
)
pipeline = Pipeline(name="foo", steps=[processing_step])
pipeline.upsert(role_arn = ...)
pipeline.start()
pipeline.definition()
产生相当冗长的 JSON 像这样:
{
"Version": "2020-12-01",
"Metadata": {},
"Parameters": [],
"PipelineExperimentConfig": {
"ExperimentName": {
"Get": "Execution.PipelineName"
},
"TrialName": {
"Get": "Execution.PipelineExecutionId"
}
},
"Steps": [
{
"Name": "processing",
"Type": "Processing",
"Arguments": {
"ProcessingResources": {
"ClusterConfig": {
"InstanceType": "ml.m5.large",
"InstanceCount": 1,
"VolumeSizeInGB": 30
}
},
"AppSpecification": {
"ImageUri": "246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-scikit-learn:0.23-1-cpu-py3",
"ContainerEntrypoint": [
"python3",
"/opt/ml/processing/input/code/preprocessor.py"
]
},
"RoleArn": "arn:aws:iam::123456789012:role/foo",
"ProcessingInputs": [
{
"InputName": "code",
"AppManaged": false,
"S3Input": {
"S3Uri": "s3://bucket/preprocessor.py",
"LocalPath": "/opt/ml/processing/input/code",
"S3DataType": "S3Prefix",
"S3InputMode": "File",
"S3DataDistributionType": "FullyReplicated",
"S3CompressionType": "None"
}
}
]
}
}
]
}
你可以使用上面的JSON和CloudFormation/CDK,但是你构建 JSON 使用 SageMaker SDK
您还可以使用 Step Function 状态机定义模型构建工作流程,使用 Data Science SDK, or Airflow
我不太清楚 Sagemaker 管道,我在 ML 领域没有经验,但我正在努力弄清楚管道定义。
我有几个问题:
sagemaker 管道是独立的吗service/feature?因为我没有看到任何通过控制台创建它们的选项,尽管我确实看到了 CloudFormation 和 CDK 资源。
sagemaker 流水线本质上是代码流水线吗?这些如何整合,它们有何不同?
还有一个 Python SDK,这与 CDK 和 CloudFormation 有何不同?
除了Python SDK的用法,我好像找不到任何例子,怎么回事?
文档和研讨会似乎只正确描述了 Python SDK 的使用,如果有人能帮我解决这个问题,那将非常有帮助!
SageMaker 有两个称为管道的东西:Model Building Pipelines and Serial Inference Pipelines。我相信你指的是前者
模型构建管道定义了机器学习工作流中的步骤,例如预处理、超参数调整、批量转换和设置端点
一个串行推理管道是两个或多个 SageMaker 模型运行一个接一个
模型构建管道在 JSON 中定义,并且 hosted/run SageMaker
以某种专有的无服务器方式Is sagemaker pipelines a stand-alone service/feature? Because I don't see any option to create them through the console, though I do see CloudFormation and CDK resources.
您可以 create/modify 他们使用 API, which can also be called via the CLI, Python SDK, or CloudFormation。这些都使用了 AWS API under hood
您可以在 SageMaker Studio 中 start/stop/view 它们:
Left-side Navigation bar > SageMaker resources > Drop-down menu > Pipelines
Is a sagemaker pipeline essentially codepipeline? How do these integrate, how do these differ?
不太可能。 CodePipeline 更多用于构建和部署代码,而不是特定于 SageMaker。据我所知,没有直接集成,除了你可以用 CP
启动 SM 管道There's also a Python SDK, how does this differ from the CDK and CloudFormation?
Python SDK 是一个独立的库,以开发人员友好的方式与 SageMaker 交互。它比 CloudFormation 更具动态性。让我们使用代码构建管道。而 CloudFormation 采用静态 JSON 字符串
Python SageMaker SDK 用法的一个非常简单的示例:
processor = SKLearnProcessor(
framework_version="0.23-1",
instance_count=1,
instance_type="ml.m5.large",
role="role-arn",
)
processing_step = ProcessingStep(
name="processing",
processor=processor,
code="preprocessor.py"
)
pipeline = Pipeline(name="foo", steps=[processing_step])
pipeline.upsert(role_arn = ...)
pipeline.start()
pipeline.definition()
产生相当冗长的 JSON 像这样:
{
"Version": "2020-12-01",
"Metadata": {},
"Parameters": [],
"PipelineExperimentConfig": {
"ExperimentName": {
"Get": "Execution.PipelineName"
},
"TrialName": {
"Get": "Execution.PipelineExecutionId"
}
},
"Steps": [
{
"Name": "processing",
"Type": "Processing",
"Arguments": {
"ProcessingResources": {
"ClusterConfig": {
"InstanceType": "ml.m5.large",
"InstanceCount": 1,
"VolumeSizeInGB": 30
}
},
"AppSpecification": {
"ImageUri": "246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-scikit-learn:0.23-1-cpu-py3",
"ContainerEntrypoint": [
"python3",
"/opt/ml/processing/input/code/preprocessor.py"
]
},
"RoleArn": "arn:aws:iam::123456789012:role/foo",
"ProcessingInputs": [
{
"InputName": "code",
"AppManaged": false,
"S3Input": {
"S3Uri": "s3://bucket/preprocessor.py",
"LocalPath": "/opt/ml/processing/input/code",
"S3DataType": "S3Prefix",
"S3InputMode": "File",
"S3DataDistributionType": "FullyReplicated",
"S3CompressionType": "None"
}
}
]
}
}
]
}
你可以使用上面的JSON和CloudFormation/CDK,但是你构建 JSON 使用 SageMaker SDK
您还可以使用 Step Function 状态机定义模型构建工作流程,使用 Data Science SDK, or Airflow