cursus.steps.configs.config_pytorch_training_step

class PyTorchTrainingConfig(*, author, bucket, role, region, service_name, pipeline_version, model_class='xgboost', current_date=<factory>, framework_version='2.1.2', py_version='py310', source_dir=None, enable_caching=False, use_secure_pypi=False, max_runtime_seconds=172800, project_root_folder, training_entry_point, training_instance_type='ml.g5.12xlarge', training_instance_count=1, training_volume_size=30, ca_repository_arn='arn:aws:codeartifact:us-west-2:149122183214:repository/amazon/secure-pypi', skip_hyperparameters_s3_uri=True, hyperparameters=None, use_precomputed_imputation=False, use_precomputed_risk_tables=False, use_precomputed_features=False, enable_true_streaming=False, num_workers_per_rank=0, prefetch_factor=None, use_persistent_workers=False, job_type=None, **extra_data)[source]

Bases: BasePipelineConfig

Configuration specific to the SageMaker PyTorch Training Step. This version is streamlined to work with specification-driven architecture. Input/output paths are now provided via step specifications and dependencies.

training_entry_point: str
training_instance_type: str
training_instance_count: int
training_volume_size: int
framework_version: str
py_version: str
ca_repository_arn: str
skip_hyperparameters_s3_uri: bool
hyperparameters: ModelHyperparameters | None
use_precomputed_imputation: bool
use_precomputed_risk_tables: bool
use_precomputed_features: bool
enable_true_streaming: bool
num_workers_per_rank: int
prefetch_factor: int | None
use_persistent_workers: bool
job_type: str | None
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'protected_namespaces': (), 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod validate_job_type(v)[source]

Validate job_type is open (any lowercase alphanumeric with underscores; None = standard).

validate_dataloader_config()[source]

Validate DataLoader worker configuration (warnings only, no mutation).

Conditional logic is enforced in training script, not here. This validator only checks for potentially problematic values.

get_environment_variables()[source]

Get environment variables for the PyTorch training script.

Returns:

Dictionary mapping environment variable names to values

Return type:

Dict[str, str]

get_public_init_fields()[source]

Override get_public_init_fields to include PyTorch training-specific fields. Gets a dictionary of public fields suitable for initializing a child config. Includes both base fields (from parent) and PyTorch training-specific fields.

Returns:

Dictionary of field names to values for child initialization

Return type:

Dict[str, Any]

get_job_arguments()[source]

CLI args — config is the single source (FZ 31e1d3h).

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

author: str
bucket: str
role: str
region: str
service_name: str
pipeline_version: str
model_class: str
current_date: str
source_dir: str | None
enable_caching: bool
use_secure_pypi: bool
max_runtime_seconds: int
project_root_folder: str