fix: correct Tag class usage in pipeline creation #5526
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Pipeline creation fails with Pydantic validation error due to incorrect Tag class
Issue Description
When
BenchmarkEvaluatorattempts to create a new SageMaker Pipeline (when no existing pipeline is found), it fails with a Pydantic validation error. This prevents MMLU_PRO and other benchmark evaluations from running when the pipeline doesn't already exist.Error Message
Impact
Root Cause
The code in
sagemaker-train/src/sagemaker/train/evaluate/execution.pyhas two issues:Wrong Tag class imported: Imports
Tagfromsagemaker.core.resources, butPipeline.create()expectsTagfromsagemaker.core.shapesWrong tag format: Creates dict
{"key": ..., "value": ...}instead ofTagobjectsThere are two different Tag classes in the SDK:
sagemaker.core.resources.Tag- Used forTag.get_all()to retrieve tagssagemaker.core.shapes.Tag- Used forPipeline.create()to create resourcesChanges Made
1. Fixed imports (lines 16-24)
2. Fixed tag creation (lines 66-99)
Tagobjects fromsagemaker.core.shapes3. Updated Tag.get_all() calls
Tag.get_all()toResourceTag.get_all()(2 occurrences)Testing
Before Fix
After Fix
Tested both scenarios:
Related Issues
This fixes the pipeline creation failure when running benchmark evaluations for the first time or after pipeline deletion.
Contributors