亚马逊SageMaker - 属性错误:模块 'sagemaker' 没有属性 'LinearLearner'
我正在做使用AWS SageMaker的实验室,但我觉得实验室所针对的版本与当前最新版不兼容。我也不确定它是为哪个版本而设。我一直看到类似这样的错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[36], line 4
1 import sagemaker
3 # Call the LinearLearner estimator object
----> 4 linear_classifier = sagemaker.LinearLearner(role=sagemaker.get_execution_role(),
5 instance_count=1,
6 instance_type='ml.m4.xlarge',
7 predictor_type='binary_classifier')
AttributeError: module 'sagemaker' has no attribute 'LinearLearner'
我想了解如何判断是否是版本不兼容的问题,去哪里可以查看所需的版本或我当前的版本。
即使我尝试查询版本也会出现错误。
import sagemaker
print(sagemaker.__version__)
AttributeError Traceback (most recent call last)
Cell In[48], line 3
1 import sagemaker
----> 3 print(sagemaker.__version__)
AttributeError: module 'sagemaker' has no attribute '__version__'
解决方案
看起来你安装了3.x版本,但你在运行的是2.x版本的代码
你可以用 pip show sagemaker 来检查
你可能需要将它安装为 pip install "sagemaker<3"
你可能会在 SageMaker V3 Release 中看到一些差异
站内所有文章版权归属LeftHeroAI导航站,无授权禁止任何主体转载、抄袭、复制内容,亦不得私自架设镜像站点。一经侵权,本站将通过法律途径追责。