Sagemaker管道创建中的ValidationException

3

我是Sagemaker的新手。我正在创建一个管道,在其中将epoch数初始化为管道参数。但是当我执行upsert时,出现了以下错误。请参考下面的代码。

epoch_count = ParameterInteger(name="EpochCount", default_value=1)
pipeline = Pipeline(
name=f"a_name",
parameters=[
    training_instance_type,
    training_instance_count,
    epoch_count,
    hugging_face_model_name,
    endpoint_instance_type,
    endpoint_instance_type_alternate,
],
steps=[step_train, step_register, step_deploy_lambda],
sagemaker_session=sagemaker_session,

)

错误 - ---
---------------------------------------------------------------------------
ClientError                               Traceback (most recent call last)
<ipython-input-54-138a517611f0> in <module>
----> 1 pipeline.upsert(role_arn=role)

/opt/conda/lib/python3.7/site-packages/sagemaker/workflow/pipeline.py in upsert(self, role_arn, description, tags, parallelism_config)
    217         """
    218         try:
--> 219             response = self.create(role_arn, description, tags, parallelism_config)
    220         except ClientError as e:
    221             error = e.response["Error"]

/opt/conda/lib/python3.7/site-packages/sagemaker/workflow/pipeline.py in create(self, role_arn, description, tags, parallelism_config)
    119             Tags=tags,
    120         )
--> 121         return self.sagemaker_session.sagemaker_client.create_pipeline(**kwargs)
    122 
    123     def _create_args(

/opt/conda/lib/python3.7/site-packages/botocore/client.py in _api_call(self, *args, **kwargs)
    389                     "%s() only accepts keyword arguments." % py_operation_name)
    390             # The "self" in this scope is referring to the BaseClient.
--> 391             return self._make_api_call(operation_name, kwargs)
    392 
    393         _api_call.__name__ = str(py_operation_name)

/opt/conda/lib/python3.7/site-packages/botocore/client.py in _make_api_call(self, operation_name, api_params)
    717             error_code = parsed_response.get("Error", {}).get("Code")
    718             error_class = self.exceptions.from_code(error_code)
--> 719             raise error_class(parsed_response, operation_name)
    720         else:
    721             return parsed_response

ClientError: An error occurred (ValidationException) when calling the CreatePipeline operation: Cannot assign property reference [Parameters.EpochCount] to argument of type [String]
1个回答

2

我替换

epoch_count = ParameterInteger(name="EpochCount", default_value=1)

使用

epoch_count = ParameterString(name="EpochCount", default_value="1")

它可以工作。也许我们只能在Sagemaker笔记本中的管道参数中使用整数。但是epoch_count在Docker容器中使用,这不是直接属于Sagemaker的东西,那就是我的理解。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接