Instance type validation fix for serverful training jobs - #6118
Instance type validation fix for serverful training jobs#6118mujtaba1747 wants to merge 10 commits into
Conversation
|
Claude finished @mujtaba1747's task in 2m 16s —— View job PR Review — Instance type validation fix for serverful training jobs
Overall the instance-type validation change is well structured and mirrors the existing
Correctness1. 2. 3.
Minor4. Redundant double warning on fetch failure. In Tests5. No unit coverage for the new logic. The two new files add only integ tests, which require live AWS resources and won't run in normal CI. The new pure/near-pure functions — Nothing here is a hard blocker except confirming the policy behavior in #1. The validation flow itself looks correct and consistent with existing conventions. |
Add instance_type validation for SMTJ training flow
Description
Adds
instance_typevalidation to the training flow so that unsupported instance types are rejected client-side, before a training job is submitted.SMTJ (SageMaker Training Job) hub content does not include an
instance_typeenum in its override spec, but the SMHP (SageMaker HyperPod) recipe for the same model/technique does. This change reuses the SMHP override spec to source the allowed instance types and applies them to SMTJ recipe validation, closing a gap where invalid instance types would only fail later at job launch.Changes
common_utils/finetune_utils.py: Add_get_smhp_instance_type_enum(...), which fetches theinstance_typeenum from the SMHP override spec for a given model/technique/training type. ReturnsNone(with a warning) when the enum is unavailable, so validation degrades gracefully instead of failing.base_trainer.py:_validate_instance_type(...)that resolves the allowed enum and raises aValueErrorlisting the supported values when the providedinstance_typeis not allowed.replicasenum is available.test_sft_trainer_integration.py: assert an unsupported instance type (ml.t3.medium) raisesValueErrorfor a Llama LORA serverful job.test_sft_trainer_serverful_smtj.py: assert an unsupported instance type raisesValueErrorfor a Nova SMTJ job, and that an out-of-range instance count raisesValueErrorwhen a valid instance type is used.Behavior
instance_type→ValueError: Instance type '<type>' is not supported. Allowed values: [...]raised duringtrain(dry_run=True)before any job is submitted.Testing
ValueError.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.