SageMaker / Client / create_training_session
create_training_session¶
- SageMaker.Client.create_training_session(**kwargs)¶
Creates a training session in Amazon SageMaker. A training session provisions compute resources for fine-tuning a foundation model using Low-Rank Adaptation (LoRA). After the session is created, you can submit training operations and sample inference requests through the Amazon SageMaker Training Session Runtime API.
The following operations are related to
CreateTrainingSession:DescribeTrainingSessionListTrainingSessionsStopTrainingSessionDeleteTrainingSession
See also: AWS API Documentation
Request Syntax
response = client.create_training_session( TrainingSessionName='string', ModelPackageGroupArn='string', LoraConfig={ 'Rank': 123, 'Alpha': 123 }, RoleArn='string', VpcConfig={ 'SecurityGroupIds': [ 'string', ], 'Subnets': [ 'string', ] }, ModelConfig={ 'BaseModelArn': 'string', 'AcceptEula': True|False }, OutputConfig={ 'S3Location': { 'Path': 'string', 'KmsKeyArn': 'string' } }, Tags=[ { 'Key': 'string', 'Value': 'string' }, ] )
- Parameters:
TrainingSessionName (string) –
[REQUIRED]
The name of the training session.
ModelPackageGroupArn (string) – The Amazon Resource Name (ARN) of the model package group where checkpoints and fine-tuned model artifacts are published.
LoraConfig (dict) –
[REQUIRED]
The Low-Rank Adaptation (LoRA) configuration for the training session, including the rank and alpha parameters.
Rank (integer) – [REQUIRED]
The rank of the Low-Rank Adaptation (LoRA) adapter matrices.
Alpha (integer) – [REQUIRED]
The Low-Rank Adaptation (LoRA) scaling factor.
RoleArn (string) –
[REQUIRED]
The Amazon Resource Name (ARN) of the IAM role that Amazon SageMaker assumes to access resources on your behalf. The role must have permissions to access the output S3 path and model package group.
VpcConfig (dict) –
The Virtual Private Cloud (VPC) configuration for the training session. Specify subnets and security groups to run the training session in your VPC.
SecurityGroupIds (list) – [REQUIRED]
The VPC security group IDs, in the form
sg-xxxxxxxx. Specify the security groups for the VPC that is specified in theSubnetsfield.(string) –
Subnets (list) – [REQUIRED]
The ID of the subnets in the VPC to which you want to connect your training job or model. For information about the availability of specific instance types, see Supported Instance Types and Availability Zones.
(string) –
ModelConfig (dict) –
[REQUIRED]
The configuration for the base model, including the model ARN and end-user license agreement (EULA) acceptance.
BaseModelArn (string) – [REQUIRED]
The Amazon Resource Name (ARN) of the base foundation model from SageMaker Hub.
AcceptEula (boolean) –
Specifies whether you accept the end-user license agreement (EULA) for gated models.
OutputConfig (dict) –
[REQUIRED]
The output configuration for the training session, including the S3 location and optional encryption settings.
S3Location (dict) – [REQUIRED]
The Amazon S3 location where training session outputs, including checkpoints and model artifacts, are stored.
Path (string) – [REQUIRED]
The Amazon S3 path where training session outputs are stored.
KmsKeyArn (string) –
The Amazon Resource Name (ARN) of the KMS key used to encrypt output data. If not specified, the default Amazon S3 encryption is used.
Tags (list) –
An array of key-value pairs to apply to the training session as tags. For more information, see Tagging Amazon Web Services Resources.
(dict) –
A tag object that consists of a key and an optional value, used to manage metadata for SageMaker Amazon Web Services resources.
You can add tags to notebook instances, training jobs, hyperparameter tuning jobs, batch transform jobs, models, labeling jobs, work teams, endpoint configurations, and endpoints. For more information on adding tags to SageMaker resources, see AddTags.
For more information on adding metadata to your Amazon Web Services resources with tagging, see Tagging Amazon Web Services resources. For advice on best practices for managing Amazon Web Services resources with tagging, see Tagging Best Practices: Implement an Effective Amazon Web Services Resource Tagging Strategy.
Key (string) – [REQUIRED]
The tag key. Tag keys must be unique per resource.
Value (string) – [REQUIRED]
The tag value.
- Return type:
dict
- Returns:
Response Syntax
{ 'TrainingSessionArn': 'string' }
Response Structure
(dict) –
TrainingSessionArn (string) –
The Amazon Resource Name (ARN) of the training session.
Exceptions
SageMaker.Client.exceptions.ResourceNotFoundSageMaker.Client.exceptions.ResourceInUseSageMaker.Client.exceptions.ResourceLimitExceeded