You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When deploying a model, we create a pipeline consisting of three steps:
Get latest model version (LambdaStep). Depending on the environment we are in, we select different models from the model registry. For instance in dev we select the latest registered model, but in prod we select the latest approved model.
Create model (CreteModelStep).
Deploy model (LambdaStep).
We create a new model with the following code (step 2):
This was working fine in version 2.72.2 but in versions 2.82.2 and 2.89.0 (did not test more versions) it is giving the following error when we upsert the pipeline:
Traceback (most recent call last):
File ".../sagemaker_bug.py", line 45, in <module>
response = pipeline.upsert(role_arn=...,
File "...\lib\site-packages\sagemaker\workflow\pipeline.py", line 219, in upsert
response = self.create(role_arn, description, tags, parallelism_config)
File "...\lib\site-packages\sagemaker\workflow\pipeline.py", line 116, in create
kwargs = self._create_args(role_arn, description, parallelism_config)
File "...\lib\site-packages\sagemaker\workflow\pipeline.py", line 138, in _create_args
pipeline_definition = self.definition()
File "...\lib\site-packages\sagemaker\workflow\pipeline.py", line 301, in definition
request_dict = self.to_request()
File "...\lib\site-packages\sagemaker\workflow\pipeline.py", line 91, in to_request
"Steps": list_to_request(self.steps),
File "...\lib\site-packages\sagemaker\workflow\utilities.py", line 42, in list_to_request
request_dicts.append(entity.to_request())
File "...\lib\site-packages\sagemaker\workflow\steps.py", line 213, in to_request
step_dict = super().to_request()
File "...\lib\site-packages\sagemaker\workflow\steps.py", line 102, in to_request
"Arguments": self.arguments,
File "...\lib\site-packages\sagemaker\workflow\steps.py", line 435, in arguments
container_defs=self.model.prepare_container_def(
File "...\lib\site-packages\sagemaker\model.py", line 414, in prepare_container_def
deploy_key_prefix = fw_utils.model_code_key_prefix(
File "...\lib\site-packages\sagemaker\fw_utils.py", line 398, in model_code_key_prefix
training_job_name = sagemaker.utils.name_from_image(image)
File "...\lib\site-packages\sagemaker\utils.py", line 60, in name_from_image
return name_from_base(base_name_from_image(image), max_length=max_length)
File "...\lib\site-packages\sagemaker\utils.py", line 102, in base_name_from_image
m = re.match("^(.+/)?([^:/]+)(:[^:]+)?$", image)
File "...\lib\re.py", line 191, in match
return _compile(pattern, flags).match(string)
TypeError: expected string or bytes-like object
The reason for this is that image is equal to a Sagemaker Properties object and not a string. This makes sense because we set image_uri to step_latest_model_version.properties.Outputs["model_image"].
Personally I think you should be able to provide a Properties object as image_uri when you would like to deploy a model from the model registry inside a Sagemaker pipeline, like in version 2.72.2.
To reproduce
I reproduced the error with the following code:
Expected behavior
The pipeline should work with a Sagemaker Property object as input for the image_uri parameter of the CreateModelStep class, like in version 2.72.2
Screenshots or logs
see error message above.
System information
A description of your system. Please provide:
SageMaker Python SDK version: 2.82.2 and 2.89.0
Framework name (eg. PyTorch) or algorithm (eg. KMeans): -
Framework version: -
Python version: 3.8
CPU or GPU: CPU
Custom Docker image (Y/N): N
Additional context
The text was updated successfully, but these errors were encountered:
Describe the bug
When deploying a model, we create a pipeline consisting of three steps:
We create a new model with the following code (step 2):
This was working fine in version 2.72.2 but in versions 2.82.2 and 2.89.0 (did not test more versions) it is giving the following error when we upsert the pipeline:
The reason for this is that image is equal to a Sagemaker Properties object and not a string. This makes sense because we set
image_uri
tostep_latest_model_version.properties.Outputs["model_image"]
.Personally I think you should be able to provide a Properties object as
image_uri
when you would like to deploy a model from the model registry inside a Sagemaker pipeline, like in version 2.72.2.To reproduce
I reproduced the error with the following code:
Expected behavior
The pipeline should work with a Sagemaker Property object as input for the
image_uri
parameter of theCreateModelStep
class, like in version 2.72.2Screenshots or logs
see error message above.
System information
A description of your system. Please provide:
Additional context
The text was updated successfully, but these errors were encountered: