我可以将参数传递给 SageMaker 估算器的入口点吗?

Can I pass arguments to the entrypoint of a SageMaker estimator?

我正在使用 SageMaker python sdk 并希望传递一些参数供我的入口点使用,但我不知道该怎么做。

from sagemaker.sklearn.estimator import SKLearn  # sagemaker python sdk

entrypoint = 'entrypoint_script.py'

sklearn = SKLearn(entry_point=entrypoint,  # <-- need to pass args to this
                  train_instance_type=instance_class,
                  role=role,
                  sagemaker_session=sm)

此处的 entry_point 参数用于脚本文件,其中包含您想要 运行 训练和预测的代码。

可以参考example here

而上面示例中的 entry_point 脚本使用的是 here

答案是否定的,因为在 Estimator 基础 class 或 fit 方法上没有接受参数传递给入口点的参数。

我通过将参数作为超参数字典的一部分传递来解决这个问题。这将作为参数传递给入口点。