fix: correct Tag class usage in pipeline creation#5526
Merged
pintaoz-aws merged 2 commits intoaws:masterfrom Feb 4, 2026
Merged
fix: correct Tag class usage in pipeline creation#5526pintaoz-aws merged 2 commits intoaws:masterfrom
pintaoz-aws merged 2 commits intoaws:masterfrom
Conversation
Pipeline creation was failing with Pydantic validation errors when BenchmarkEvaluator attempted to create a new SageMaker Pipeline. This occurred because the code imported Tag from sagemaker.core.resources instead of sagemaker.core.shapes, which is what Pipeline.create() expects for its tags parameter. Root Cause: The SDK has two different Tag classes: - sagemaker.core.resources.Tag: Used for Tag.get_all() operations - sagemaker.core.shapes.Tag: Used for Pipeline.create() parameter Changes: - Import Tag from sagemaker.core.shapes for Pipeline.create() - Import Tag as ResourceTag from sagemaker.core.resources for Tag.get_all() - Create proper Tag objects instead of dicts - Add error handling for tag conversion - Update Tag.get_all() calls to use ResourceTag Impact: This fixes benchmark evaluation failures (MMLU_PRO, BBH, GPQA, etc.) when creating new pipelines. Testing: Verified both creating new pipeline and reusing existing pipeline.
pintaoz-aws
approved these changes
Feb 3, 2026
Contributor
Author
|
no, Modeltrainer accepts dicts, but BenchmarkEvaluator.Pipeline.create()
accepts Tag objects
…On Wed, Feb 4, 2026 at 8:28 AM Adam Ivison ***@***.***> wrote:
*admivsn* left a comment (aws/sagemaker-python-sdk#5526)
<#5526 (comment)>
Is there also a similar issue with ModelTrainer tags?
—
Reply to this email directly, view it on GitHub
<#5526 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACVMWDJYPANTU463WUXQ3D34KHXYPAVCNFSM6AAAAACTN5U54WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNBXGQ2TOOBXHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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