Skip to content

Commit cb28d94

Browse files
committed
feature: emit estimator transformer tags to model
1 parent 5877a56 commit cb28d94

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/sagemaker/estimator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ def transformer(self, instance_count, instance_type, strategy=None, assemble_wit
10611061
container_def = model.prepare_container_def(instance_type)
10621062
model_name = model.name or name_from_image(container_def['Image'])
10631063
vpc_config = model.vpc_config
1064-
self.sagemaker_session.create_model(model_name, role, container_def, vpc_config)
1064+
self.sagemaker_session.create_model(model_name, role, container_def, vpc_config, tags=tags)
10651065
transform_env = model.env.copy()
10661066
if env is not None:
10671067
transform_env.update(env)

src/sagemaker/session.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ def create_model_from_job(self, training_job_name, name=None, role=None, primary
643643
str: The name of the created ``Model``.
644644
"""
645645
training_job = self.sagemaker_client.describe_training_job(TrainingJobName=training_job_name)
646+
tags = self.sagemaker_client.list_tags(ResourceArn=training_job['TrainingJobArn'])['Tags']
646647
name = name or training_job_name
647648
role = role or training_job['RoleArn']
648649
env = env or {}
@@ -651,7 +652,7 @@ def create_model_from_job(self, training_job_name, name=None, role=None, primary
651652
model_data_url=model_data_url or training_job['ModelArtifacts']['S3ModelArtifacts'],
652653
env=env)
653654
vpc_config = _vpc_config_from_training_job(training_job, vpc_config_override)
654-
return self.create_model(name, role, primary_container, vpc_config=vpc_config)
655+
return self.create_model(name, role, primary_container, vpc_config=vpc_config, tags=tags)
655656

656657
def create_model_package_from_algorithm(self, name, description, algorithm_arn, model_data):
657658
"""Create a SageMaker Model Package from the results of training with an Algorithm Package

0 commit comments

Comments
 (0)