标签: amazon-sagemaker

如何使用 SageMaker Estimator 进行模型训练和保存

有关如何使用 SageMaker 估算器的文档分散在各处,有时甚至过时、不正确。是否有一站式位置可以全面介绍如何使用 SageMaker SDK Estimator 训练和保存模型?

amazon-web-services amazon-sagemaker

34
推荐指数
1
解决办法
2万
查看次数

将S3数据加载到AWS SageMaker Notebook中

我刚刚开始尝试使用AWS SageMaker,并希望将来自S3存储桶的数据加载到我的SageMaker python jupyter笔记本中的pandas数据帧中进行分析.

我可以使用boto从S3获取数据,但我想知道是否有更优雅的方法作为SageMaker框架的一部分在我的python代码中执行此操作?

提前感谢任何建议.

python machine-learning amazon-s3 amazon-web-services amazon-sagemaker

15
推荐指数
5
解决办法
2万
查看次数

如何将依赖文件传递给 sagemaker SKLearnProcessor 并在 Pipeline 中使用它?

我需要从不同的 python 脚本导入函数,该函数将在preprocessing.py文件内部使用。我无法找到将依赖文件传递给SKLearnProcessor对象的方法,因此我得到了ModuleNotFoundError.

代码:

from sagemaker.sklearn.processing import SKLearnProcessor
from sagemaker.processing import ProcessingInput, ProcessingOutput

sklearn_processor = SKLearnProcessor(framework_version='0.20.0',
                                     role=role,
                                     instance_type='ml.m5.xlarge',
                                     instance_count=1)


sklearn_processor.run(code='preprocessing.py',
                      inputs=[ProcessingInput(
                        source=input_data,
                        destination='/opt/ml/processing/input')],
                      outputs=[ProcessingOutput(output_name='train_data',
                                                source='/opt/ml/processing/train'),
                               ProcessingOutput(output_name='test_data',
                                                source='/opt/ml/processing/test')],
                      arguments=['--train-test-split-ratio', '0.2']
                     )
Run Code Online (Sandbox Code Playgroud)

我想通过, dependent_files = ['file1.py', 'file2.py', 'requirements.txt']. 因此,preprocessing.py可以访问所有依赖模块。

并且还需要从requirements.txt文件安装库。

您能分享任何解决方法或正确的方法吗?

2021 年 11 月 25 日更新:

Q1. (已回答,但希望使用 来解决FrameworkProcessor

这里,函数是使用FrameworkProcessorget_run_args处理dependencies和参数。有什么方法可以从或或任何其他方式设置这些参数吗?source_dircodeScriptProcessorSKLearnProcessorProcessor

Q2。

您还可以展示一些使用我们的Processorassagemaker.workflow.steps.ProcessingStep然后使用 in …

python amazon-web-services scikit-learn amazon-sagemaker

15
推荐指数
1
解决办法
6691
查看次数

导入 vaex 错误:PydanticImportError:“BaseSettings”已移至“pydantic-settings”包

我正在使用 Sagemaker 笔记本,在导入 vaex 时,出现以下错误。我使用的vaex版本是4.16.0

PydanticImportError:BaseSettings已移至pydantic-settings包中。有关更多详细信息,请参阅https://docs.pydantic.dev/2.0.2/migration/#basesettings-has-moved-to-pydantic-settings

有关更多信息,请访问https://errors.pydantic.dev/2.0.2/u/import-error

有人知道如何解决这个问题吗?

我尝试在安装 vaex 时降级 pydantic 库,但这没有帮助。

python amazon-sagemaker pydantic vaex

15
推荐指数
2
解决办法
3万
查看次数

加载自定义 conda env 在 SageMaker 中不起作用

我已miniconda在我的 AWS SageMaker 持久 EBS 实例上安装。这是我的起始脚本:

#!/bin/bash

set -e

# OVERVIEW
# This script installs a custom, persistent installation of conda on the Notebook Instance's EBS volume, and ensures
# that these custom environments are available as kernels in Jupyter.
# 
# The on-start script uses the custom conda environment created in the on-create script and uses the ipykernel package
# to add that as a kernel in Jupyter.
#
# For another example, see:
# https://docs.aws.amazon.com/sagemaker/latest/dg/nbi-add-external.html#nbi-isolated-environment

sudo …
Run Code Online (Sandbox Code Playgroud)

python amazon-web-services conda jupyter-lab amazon-sagemaker

12
推荐指数
1
解决办法
7960
查看次数

如何卷曲 Amazon Sagemaker 终端节点

向 sage-maker 发出 POST 请求并接收 ML 推理的 curl 命令是什么?

amazon-web-services amazon-sagemaker

11
推荐指数
2
解决办法
5290
查看次数

在 sagemaker 中使用相同的预处理代码进行训练和推理

我正在致力于为时间序列数据构建机器学习管道,其目标是经常重新训练和更新模型以进行预测。

  • 我编写了一个预处理代码来处理时间序列变量并转换它们。

我对如何使用相同的预处理代码进行训练和推理感到困惑?我应该编写一个 lambda 函数来预处理我的数据还是有其他方法

消息来源调查:

aws sagemaker 团队给出的两个示例使用 AWS Glue 进行 ETL 转换。

inference_pipeline_sparkml_xgboost_abalone

inference_pipeline_sparkml_blazingtext_dbpedia

我是 aws sagemaker 的新手,试图学习、理解和构建流程。任何帮助表示赞赏!

machine-learning amazon-machine-learning amazon-sagemaker

11
推荐指数
1
解决办法
2521
查看次数

AWS Sagemaker - 安装外部库并使其持久化

我有一个 sagemaker 实例启动并运行,我有一些我经常使用的库,但每次我重新启动实例时,它们都会被擦除,我必须重新安装它们。是否可以将我的库安装到 anaconda 环境之一并保留更改?

amazon-web-services amazon-sagemaker

10
推荐指数
1
解决办法
8155
查看次数

如何为 SageMaker 提取预构建的 docker 镜像?

我正在尝试为 SageMaker 提取预构建的 docker 映像。我能够成功docker login获取 ECR(我的 AWS 凭证)。当我尝试拉取图像时,我得到了标准no basic auth credentials

也许我误解了...我认为这些 ECR URL 是公开的。

$(aws ecr get-login --region us-west-2 --no-include-email)

docker pull 246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-scikit-learn
Run Code Online (Sandbox Code Playgroud)

amazon-web-services docker amazon-ecr amazon-sagemaker

10
推荐指数
2
解决办法
5867
查看次数

Plotly 在 AWS Sagemaker JupyterLab 中显示空白图表

背景:我是 Python 世界的新手,正在使用 Plotly 在 Python 中创建基本图形。我使用 AWS Sagemaker 的 JupyterLab 来创建 python 脚本。

问题:我一直在尝试运行 Plotly 网站上提到的基本代码,但即使这些代码也返回空白图表。

我自己尝试的问题解决:

  1. pip安装plotly版本4.6.0

  2. https://plotly.com/python/getting-started/上提到的 JupyterLab 支持步骤已经执行

代码示例:

import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
fig.show()
Run Code Online (Sandbox Code Playgroud)

machine-learning plotly jupyter-lab amazon-sagemaker plotly-python

10
推荐指数
1
解决办法
6197
查看次数