首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从AWS运行SKLearnProcessor

从AWS运行SKLearnProcessor
EN

Stack Overflow用户
提问于 2022-02-06 16:19:46
回答 2查看 349关注 0票数 0

我下面的代码是用AWS Sagmake木星笔记本编写的。但我希望从AWS (或AWS步骤函数)运行它,以支持自动执行。

在Step函数中有一个CreateProcessingJob,在sagemaker API中有一个https://sagemaker.readthedocs.io/en/stable/api/training/processing.html?highlight=frameworkprocessor#sagemaker.processing.ProcessingJob,在boto3中有一个create_processing_job --这是我能找到的最接近的.

这是可能的吗?如果必须手动从笔记本中执行所有这些Sagemaker功能,那么创建这些功能有什么意义呢..?

代码语言:javascript
复制
import boto3
import sagemaker
from sagemaker import get_execution_role
from sagemaker.sklearn.processing import SKLearnProcessor
from sagemaker.processing import FrameworkProcessor
from sagemaker.processing import ProcessingOutput

region = boto3.session.Session().region_name    
role = get_execution_role()

est_cls = sagemaker.sklearn.estimator.SKLearn
framework_version_str="0.23-1"

script_processor = FrameworkProcessor(
    role=role,
    instance_count=8,
    instance_type="ml.r5.8xlarge",
    volume_size_in_gb=120,
    max_runtime_in_seconds=432000,
    estimator_cls=est_cls,
    framework_version=framework_version_str
)

output_folder = 's3://bucket/out'

script_processor.run(
    code="preprocessing.py",
    source_dir = "code",
    outputs=[
        ProcessingOutput(output_name='preprocessed_data', source="/opt/ml/processing/train"),
    ],
    arguments=["--bucket", "bucket", "--subfolder", "Training_data/"],
)

script_processor_job_description = script_processor.jobs[-1].describe()
print(script_processor_job_description)
EN

回答 2

Stack Overflow用户

发布于 2022-02-07 05:44:05

您的代码似乎是为了在Sagemaker中触发数据预处理而编写的,这可以通过调用方法从Lambda中处理。其次,SageMaker为管理机器学习工作流的各个方面提供了一个健壮的工具集,像这样的预处理活动并不局限于从木星笔记本中手动运行。如果您的目标是自动化,我建议您签出SageMaker管道,以便在机器学习过程的每一个步骤中编排和自动化工作流。

票数 0
EN

Stack Overflow用户

发布于 2022-06-16 09:09:54

我不知道你的最终目标是什么,所以我列出了我的两个答案

选项1:只需在博客下面运行Sagemaker笔记本就提供了一种实现https://medium.com/analytics-vidhya/a-guide-to-schedule-sagemaker-notebooks-a7a09eb641f6的方法

选项2:创建和编排Sagemaker管道您需要在sagemaker中创建工作流管道,例如运行一次,以后的管道可以使用AWS事件桥触发。

https://github.com/aws-samples/scheduling-sagemaker-processing-with-sagemaker-pipelines

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71009191

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档