Skip to content

Fix output data config in HyperparameterTuner#5791

Merged
zhaoqizqwang merged 5 commits intoaws:masterfrom
zhaoqizqwang:master
Apr 23, 2026
Merged

Fix output data config in HyperparameterTuner#5791
zhaoqizqwang merged 5 commits intoaws:masterfrom
zhaoqizqwang:master

Conversation

@zhaoqizqwang
Copy link
Copy Markdown
Collaborator

fix(tuner): pass through full OutputDataConfig from ModelTrainer
HyperparameterTuner._build_training_job_definition was reconstructing a new
OutputDataConfig with only s3_output_path, silently dropping kms_key_id,
compression_type, and other fields set on the ModelTrainer.

Pass model_trainer.output_data_config directly to preserve all fields.

Also update _create_mock_model_trainer in tests to use a real OutputDataConfig
instead of MagicMock, and add a test verifying kms_key_id and compression_type
are preserved through the tuning job definition.

HyperparameterTuner._build_training_job_definition was reconstructing a new
OutputDataConfig with only s3_output_path, silently dropping kms_key_id,
compression_type, and other fields set on the ModelTrainer.

Pass model_trainer.output_data_config directly to preserve all fields.

Also update _create_mock_model_trainer in tests to use a real OutputDataConfig
instead of MagicMock, and add a test verifying kms_key_id and compression_type
are preserved through the tuning job definition.

X-AI-Prompt: Check if HyperparameterTuner passes OutputDataConfig.kms_key_id from ModelTrainer and fix the gap
X-AI-Tool: Kiro
# Pass through the full OutputDataConfig from ModelTrainer so that
# kms_key_id, compression_type, and any other fields are preserved.
output_config = model_trainer.output_data_config or OutputDataConfig(
s3_output_path=None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to set this to None.

Copy link
Copy Markdown
Collaborator Author

@zhaoqizqwang zhaoqizqwang Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OutputDataConfig is a required field in create_hyperparameter_tuning_job. We use an empty object when we don't get the config from ModelTrainer, which is what the old code does

@@ -1,172 +0,0 @@
Resolved template parameters: {'role_arn': base_evaluator.py:757
'arn:aws:iam::634683118556:role/service-role/AmazonSageMaker-Exe
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this file? Looks like it is committed accidentally

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this file is not used

@zhaoqizqwang zhaoqizqwang merged commit 64c3591 into aws:master Apr 23, 2026
13 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants