有关如何使用 SageMaker 估算器的文档分散在各处,有时甚至过时、不正确。是否有一站式位置可以全面介绍如何使用 SageMaker SDK Estimator 训练和保存模型?
我刚刚开始尝试使用AWS SageMaker,并希望将来自S3存储桶的数据加载到我的SageMaker python jupyter笔记本中的pandas数据帧中进行分析.
我可以使用boto从S3获取数据,但我想知道是否有更优雅的方法作为SageMaker框架的一部分在我的python代码中执行此操作?
提前感谢任何建议.
python machine-learning amazon-s3 amazon-web-services amazon-sagemaker
我需要从不同的 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_dir
code
ScriptProcessor
SKLearnProcessor
Processor
Q2。
您还可以展示一些使用我们的Processor
assagemaker.workflow.steps.ProcessingStep
然后使用 in …
我正在使用 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 库,但这没有帮助。
我已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
向 sage-maker 发出 POST 请求并接收 ML 推理的 curl 命令是什么?
我正在致力于为时间序列数据构建机器学习管道,其目标是经常重新训练和更新模型以进行预测。
我对如何使用相同的预处理代码进行训练和推理感到困惑?我应该编写一个 lambda 函数来预处理我的数据还是有其他方法
消息来源调查:
aws sagemaker 团队给出的两个示例使用 AWS Glue 进行 ETL 转换。
inference_pipeline_sparkml_xgboost_abalone
inference_pipeline_sparkml_blazingtext_dbpedia
我是 aws sagemaker 的新手,试图学习、理解和构建流程。任何帮助表示赞赏!
我有一个 sagemaker 实例启动并运行,我有一些我经常使用的库,但每次我重新启动实例时,它们都会被擦除,我必须重新安装它们。是否可以将我的库安装到 anaconda 环境之一并保留更改?
我正在尝试为 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) 背景:我是 Python 世界的新手,正在使用 Plotly 在 Python 中创建基本图形。我使用 AWS Sagemaker 的 JupyterLab 来创建 python 脚本。
问题:我一直在尝试运行 Plotly 网站上提到的基本代码,但即使这些代码也返回空白图表。
我自己尝试的问题解决:
pip安装plotly版本4.6.0
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
amazon-sagemaker ×10
python ×4
jupyter-lab ×2
amazon-ecr ×1
amazon-s3 ×1
conda ×1
docker ×1
plotly ×1
pydantic ×1
scikit-learn ×1
vaex ×1