fix(model-trainer): force LF endings for generated train script - #6146
Open
saisharan0103 wants to merge 1 commit into
Open
Conversation
…line endings on Windows causing training job failure Closes aws#5904
saisharan0103
requested a deployment
to
manual-approval
August 2, 2026 04:42 — with
GitHub Actions
Waiting
saisharan0103
requested a deployment
to
manual-approval
August 2, 2026 04:42 — with
GitHub Actions
Waiting
saisharan0103
requested a deployment
to
manual-approval
August 2, 2026 04:42 — with
GitHub Actions
Waiting
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.
ModelTrainer generated
sm_train.shusing Python text-mode defaults viaopen(..., "w"). On Windows, that translated the\nline endings inTRAIN_SCRIPT_TEMPLATEto\r\n; the uploaded script then ran inside a Linux training container, where CRLF line endings broke bash parsing before user code started.This updates
ModelTrainer._prepare_train_scriptto writesm_train.shwithnewline="\n", so the SDK-generated script uses LF line endings regardless of the client OS.A focused regression assertion was added to the existing generated-driver-script unit test. It reads
sm_train.shas bytes and verifies that no CRLF bytes are present while keeping the existing content assertions.Fixes #5904
ruff check sagemaker-train/src/sagemaker/train/model_trainer.py sagemaker-train/tests/unit/train/test_model_trainer.pyreports no new findings on the changed files.Ran
pytest -xlocally with no new failures.