sagemaker.core.training.utils#
Training utilities.
Functions
Build the HyperPod manifest.json S3 URI for a Nova training job. |
|
|
Build the serverless manifest.json S3 URI for a Nova training job. |
Build the output.tar.gz S3 URI for a Nova training job. |
|
|
Convert Unassigned values to None for any instance. |
Read the checkpoint URI from a raw manifest.json object in S3. |
|
|
Resolve the Nova checkpoint (escrow) URI from a training job's output. |
|
Client-side validation for Compute.instance_preferences (server remains the source of truth). |
- sagemaker.core.training.utils.build_nova_hyperpod_manifest_s3_uri(s3_output_path: str, training_job_name: str) str[source]#
Build the HyperPod manifest.json S3 URI for a Nova training job.
HyperPod jobs write the manifest directly under the job directory:
<s3_output_path>/<training_job_name>/manifest.json.- Parameters:
s3_output_path – The training job’s
output_data_config.s3_output_path.training_job_name – The training job name.
- Returns:
Fully-qualified S3 URI to the job’s manifest.json.
- sagemaker.core.training.utils.build_nova_manifest_s3_uri(s3_output_path: str, training_job_name: str) str[source]#
Build the serverless manifest.json S3 URI for a Nova training job.
Serverless jobs write the manifest under a nested output directory:
<s3_output_path>/<training_job_name>/output/output/manifest.json.- Parameters:
s3_output_path – The training job’s
output_data_config.s3_output_path.training_job_name – The training job name.
- Returns:
Fully-qualified S3 URI to the job’s manifest.json.
- sagemaker.core.training.utils.build_nova_output_tar_gz_s3_uri(s3_output_path: str, training_job_name: str) str[source]#
Build the output.tar.gz S3 URI for a Nova training job.
- Parameters:
s3_output_path – The training job’s
output_data_config.s3_output_path.training_job_name – The training job name.
- Returns:
Fully-qualified S3 URI to the job’s output.tar.gz.
- sagemaker.core.training.utils.convert_unassigned_to_none(instance) Any[source]#
Convert Unassigned values to None for any instance.
- sagemaker.core.training.utils.read_nova_checkpoint_uri_from_manifest(s3_client, s3_uri: str) str[source]#
Read the checkpoint URI from a raw manifest.json object in S3.
- Parameters:
s3_client – A boto3 S3 client.
s3_uri – S3 URI of the manifest.json object.
- Returns:
The
checkpoint_s3_bucketvalue from the manifest.- Raises:
ValueError – If the object is missing, unparseable, or lacks the key.
- sagemaker.core.training.utils.resolve_nova_checkpoint_uri(s3_client, s3_output_path: str, training_job_name: str) str[source]#
Resolve the Nova checkpoint (escrow) URI from a training job’s output.
Reads
checkpoint_s3_bucketfrom the job’s manifest.json. The manifest is first looked up as a raw object, and if that fails, it falls back to the copy packaged insideoutput.tar.gz.- Parameters:
s3_client – A boto3 S3 client.
s3_output_path – The training job’s
output_data_config.s3_output_path.training_job_name – The training job name.
- Returns:
The checkpoint URI recorded in the manifest.
- Raises:
ValueError – If the checkpoint URI cannot be resolved from any known output layout.
- sagemaker.core.training.utils.validate_instance_preferences(compute) None[source]#
Client-side validation for Compute.instance_preferences (server remains the source of truth).
instance_preferences is mutually exclusive with the classic single-cluster fields instance_type / instance_groups / instance_placement_config, and with managed spot training.
Instance types must not repeat across preferences.
Count mode: exactly one of the top-level instance_count (applies to whichever preference wins) with no per-preference instance_count, or an instance_count on EVERY element with the top-level unset. Both-set, partial, and neither are rejected.
Training plans: the top-level (whole-job) training_plan_arn is mutually exclusive with per-preference training_plan_arns.
List-size limits (max preferences, max plans per preference) are deliberately NOT enforced client-side: they are server-side configurable, so raising them must not require a new SDK release.
No-op when instance_preferences is not set.