Fix #5632: HyperparameterTuner drops content_type when converting Inp...#5703
Open
JiwaniZakir wants to merge 1 commit intoaws:masterfrom
Open
Fix #5632: HyperparameterTuner drops content_type when converting Inp...#5703JiwaniZakir wants to merge 1 commit intoaws:masterfrom
JiwaniZakir wants to merge 1 commit intoaws:masterfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Closes #5632
Motivation
HyperparameterTuner._build_training_job_definition()convertsInputDataobjects toChannelobjects but omitscontent_typeduring that conversion, causing built-in algorithms (e.g., XGBoost) to fail withvalidate_data_file_patherrors because the training container cannot determine the data format.Changes
sagemaker-train/src/sagemaker/train/tuner.pycontent_type=inp.content_typeto theChannel(...)constructor call inside theisinstance(inp, InputData)branch of_build_training_job_definition(). This is the sole change required to propagate the field that was silently dropped.sagemaker-train/tests/unit/train/test_tuner.pytest_build_training_job_definition_preserves_content_type()toTestHyperparameterTunerStaticMethods. The test constructs anInputDatawithcontent_type="text/csv", callstuner._build_training_job_definition(), and asserts that the resultingChannelfor the"train"channel carriescontent_type == "text/csv". This directly exercises the previously broken code path.Testing
The new unit test covers the regression:
Manually verified against XGBoost 1.7-1 using the reproduction case from the issue report: training jobs now complete successfully when
InputData(content_type="csv")is passed totuner.tune(), without requiring theChannel-based workaround.