forked from aws/sagemaker-python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Amazon Q development agentGenerate new features or iterate code based on issue descriptions and comments.Generate new features or iterate code based on issue descriptions and comments.bugSomething isn't workingSomething isn't working
Description
Describe the bug
When calling a model.register() method with model_life_cycle param, a TypeError: Object of type ModelLifeCycle is not JSON serializable is encountered.
To reproduce
Create a new model
model = Model(
image_uri="account.dkr.ecr.region.amazonaws.com/repo:tag",
role="arn:aws:iam::account:role/name",
sagemaker_session=PipelineSession
)
Call model.register()
model.register(
content_types="application/json",
response_types="application/json",
model_package_group_name="somePackageGroupName",
model_life_cycle=ModelLifeCycle(
stage="someStage",
stage_status="someStatus",
stage_description="someDescription"
)
)
Expected behavior
model.register() should not throw TypeError when called with model_life_cycle params.
Screenshots or logs
System information
A description of your system. Please provide:
- SageMaker Python SDK version: 2.244.2
- Framework name (eg. PyTorch) or algorithm (eg. KMeans): N/A
- Framework version: N/A
- Python version: 3.11
- CPU or GPU: N/A
- Custom Docker image (Y/N): N
Suggested fix
Issue could be due to not converting the ModelLifeCycle class object into dict first since json.dumps() accepts a dict.
Replace model_package_args["model_life_cycle"] = model_life_cycle with model_package_args["model_life_cycle"] = model_life_cycle._to_request_dict()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Amazon Q development agentGenerate new features or iterate code based on issue descriptions and comments.Generate new features or iterate code based on issue descriptions and comments.bugSomething isn't workingSomething isn't working