Bug fix: get_code_hash passes str instead of List[str] to get_training_code_has#5581
Open
Christian-kam wants to merge 1 commit intoaws:masterfrom
Open
Bug fix: get_code_hash passes str instead of List[str] to get_training_code_has#5581Christian-kam wants to merge 1 commit intoaws:masterfrom
Christian-kam wants to merge 1 commit intoaws:masterfrom
Conversation
`sagemaker.core.workflow.utilities.get_training_code_hash` expects dependencies to be a list, but `SourceCode.requirements` is passed as a str. The change wrap requirements in a list before passing it: This ensures dependencies is always a List[str] inside get_training_code_hash, so the [source_dir] + dependencies and [entry_point] + dependencies list concatenations work correctly.
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.
sagemaker.core.workflow.utilities.get_training_code_hashexpects dependencies to be a list, butSourceCode.requirementsis passed as a str.The change wrap requirements in a list before passing it: This ensures dependencies is always a List[str] inside get_training_code_hash, so the [source_dir] + dependencies and [entry_point] + dependencies list concatenations work correctly.
Issue #, if available:
N/A
Description of changes:
Bug Fix: Wrap SourceCode.requirements in a list before passing to get_training_code_hash
get_training_code_hash expects its dependencies parameter to be a List[str], but SourceCode.requirements is a str (a path to a requirements.txt file). When passed directly, the list concatenation [source_dir] + dependencies raises a TypeError:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Root cause:
In get_code_hash,theTrainingStepbranch passesrequirementsdirectly:Note that the
ProcessingStepbranch does not have this issue because it normalizes dependencies into a list viaget_processing_dependencies()before passing them.Fix:
Wrap
requirementsin a list before passing:This ensures
dependenciesis always aList[str]insideget_training_code_hash, so[source_dir] + dependenciesand[entry_point] + dependencieswork correctly.