Skip to content

fix(train): load Nova hyperparameters file in ModelTrainer - #6144

Open
saisharan0103 wants to merge 1 commit into
aws:masterfrom
saisharan0103:mergepath/issue-5770-modeltrainer-bug-with-method-to-load
Open

fix(train): load Nova hyperparameters file in ModelTrainer#6144
saisharan0103 wants to merge 1 commit into
aws:masterfrom
saisharan0103:mergepath/issue-5770-modeltrainer-bug-with-method-to-load

Conversation

@saisharan0103

Copy link
Copy Markdown

Fixes #5770.

ModelTrainer.from_recipe has a Nova-specific path that handles string hyperparameters values as file paths. That branch called cls._validate_and_load_hyperparameters_file(...), but ModelTrainer only defines _validate_and_fetch_hyperparameters_file(...). As a result, Nova recipes using a hyperparameters file path raised AttributeError before the file could be validated, parsed, and merged with recipe-derived hyperparameters.

This replaces the erroneous call with the existing _validate_and_fetch_hyperparameters_file helper.

A focused unit regression test now creates a temporary Nova recipe and temporary hyperparameters file, calls ModelTrainer.from_recipe with hyperparameters set to that file path, and asserts the parsed values are present in trainer.hyperparameters without raising AttributeError.

Existing dict-hyperparameters and non-Nova behavior are unchanged.

ruff check sagemaker-train/src/sagemaker/train/model_trainer.py sagemaker-train/tests/unit/train/test_model_trainer.py reports no new findings on the changed files.
Ran pytest -x locally with no new failures.

…arameters from file for Amazon Nova Recipe

Closes aws#5770
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.

ModelTrainer bug with method to load hyperparameters from file for Amazon Nova Recipe

1 participant