sagemaker.train.base_trainer#
Classes
|
Abstract base class for all SageMaker training workflows. |
- class sagemaker.train.base_trainer.BaseTrainer(sagemaker_session: Session | None = None, role: str | None = None, base_job_name: str | None = None, tags: List[Tag] | None = None, hyperparameters: Dict[str, Any] | None = None, output_data_config: OutputDataConfig | None = None, input_data_config: List[Channel | InputData] | None = None, environment: Dict[str, str] | None = None)[source]#
Bases:
ABCAbstract base class for all SageMaker training workflows.
This class provides the common interface and shared functionality for all trainer implementations including SFT, DPO, RLVR, and RLAIF trainers. It defines the standard parameters and abstract methods that concrete trainer classes must implement.
- Parameters:
sagemaker_session (Optional[Session]) – The SageMaker session for managing API calls and resources. If not specified, a default session will be created.
role (Optional[str]) – The IAM role ARN for the training job execution. If not specified, the default SageMaker execution role will be used.
base_job_name (Optional[str]) – The base name for training jobs. A unique suffix will be appended. If not specified, a default name will be generated based on the trainer type.
tags (Optional[List[Tag]]) – List of tags to apply to the training job for resource management and billing.
hyperparameters (Optional[Dict[str, Any]]) – Dictionary of hyperparameters for the training job. Trainer-specific defaults will be applied if not specified.
output_data_config (Optional[shapes.OutputDataConfig]) – Configuration for training job outputs including S3 paths and encryption. If not specified, default output configuration will be used.
input_data_config (Optional[List[Union[Channel, InputData]]]) – List of input data channels for the training job. Can include training and validation datasets.
environment (Optional[Dict[str, str]]) – Environment variables to set in the training container.
- base_job_name: str | None = None#
- environment: Dict[str, str] | None = None#
- hyperparameters: Dict[str, Any] | None = None#
- latest_training_job: TrainingJob | None = None#
- output_data_config: OutputDataConfig | None = None#
- role: str | None = None#