-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Describe the bug
The ModelPackage.create
method is not using the provided tags
.
To reproduce
import sagemaker
from sagemaker import ModelPackage
from sagemaker.serverless import ServerlessInferenceConfig
model_package_arn = "...."
model_package_name = "something"
tags = [{'Key': 'tagname', 'Value':'tagvalue'}]
# define the model package
model_package = ModelPackage(
role=role,
model_package_arn=model_package_arn,
sagemaker_session=sagemaker.Session(),
name=model_package_name,
)
# call create passing tags
model_package.create(
instance_type="aa",
serverless_inference_config=ServerlessInferenceConfig(memory_size_in_mb=1024),
tags=tags
)
Expected behavior
The Model should be created with the provided tags.
Screenshots or logs
Here are the logs generated when calling create
.
Creating model with name: something
CreateModel request: {
"ModelName": "something",
"ExecutionRoleArn": "arn:aws:iam::REDACTED:role/service-role/REDACTED",
"Containers": [
{
"ModelPackageName": "arn:aws:sagemaker:us-east-1:REDACTED:model-package/something/8"
}
]
}
System information
sagemaker==2.107.0
Additional context
After looking at the source code, it's clear the problem is in the _create_sagemaker_model
implementation of the ModelPackage class (code here). While the same method in the Model class passes the tags to create_model
(code here), the ModelPackage does not.
gustavovaliati and RaulGhizzi