Skip to content

Commit 99345d8

Browse files
grenmesterJacky Lee
and
Jacky Lee
authored
fix: training arn support (aws#1494)
* fix: training job ARN * pylint --------- Co-authored-by: Jacky Lee <[email protected]>
1 parent 262a5eb commit 99345d8

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/sagemaker/serve/builder/jumpstart_builder.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,24 +546,29 @@ def _update_model_data_for_fine_tuned_model(self, pysdk_model: Type[Model]) -> T
546546
pysdk_model.add_tags(
547547
{"key": Tag.FINE_TUNING_MODEL_PATH, "value": fine_tuning_model_path}
548548
)
549+
logger.info(
550+
"FINE_TUNING_MODEL_PATH detected. Using fine-tuned model found in %s.",
551+
fine_tuning_model_path,
552+
)
549553
return pysdk_model
550554

551555
if fine_tuning_job_name := self.model_metadata.get("FINE_TUNING_JOB_NAME"):
552556
try:
553557
response = self.sagemaker_session.sagemaker_client.describe_training_job(
554558
TrainingJobName=fine_tuning_job_name
555559
)
556-
fine_tuning_model_path = response["OutputDataConfig"]["S3OutputPath"]
560+
fine_tuning_model_path = response["ModelArtifacts"]["S3ModelArtifacts"]
557561
pysdk_model.model_data["S3DataSource"]["S3Uri"] = fine_tuning_model_path
558-
pysdk_model.model_data["S3DataSource"]["CompressionType"] = response[
559-
"OutputDataConfig"
560-
]["CompressionType"]
561562
pysdk_model.add_tags(
562563
[
563564
{"key": Tag.FINE_TUNING_JOB_NAME, "value": fine_tuning_job_name},
564565
{"key": Tag.FINE_TUNING_MODEL_PATH, "value": fine_tuning_model_path},
565566
]
566567
)
568+
logger.info(
569+
"FINE_TUNING_JOB_NAME detected. Using fine-tuned model found in %s.",
570+
fine_tuning_model_path,
571+
)
567572
return pysdk_model
568573
except ClientError:
569574
raise ValueError(

tests/unit/sagemaker/serve/builder/test_js_builder.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,9 +1039,8 @@ def test_fine_tuned_model_with_fine_tuning_job_name(
10391039
mock_fine_tuning_model_path = "s3://test"
10401040
mock_sagemaker_session = Mock()
10411041
mock_sagemaker_session.sagemaker_client.describe_training_job.return_value = {
1042-
"OutputDataConfig": {
1043-
"S3OutputPath": mock_fine_tuning_model_path,
1044-
"CompressionType": "None",
1042+
"ModelArtifacts": {
1043+
"S3ModelArtifacts": mock_fine_tuning_model_path,
10451044
}
10461045
}
10471046
mock_pre_trained_model.return_value.image_uri = mock_djl_image_uri

0 commit comments

Comments
 (0)