View a markdown version of this page

CreateTrainingSession - Amazon SageMaker

CreateTrainingSession

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:

  • DescribeTrainingSession

  • ListTrainingSessions

  • StopTrainingSession

  • DeleteTrainingSession

Request Syntax

{ "LoraConfig": { "Alpha": number, "Rank": number }, "ModelConfig": { "AcceptEula": boolean, "BaseModelArn": "string" }, "ModelPackageGroupArn": "string", "OutputConfig": { "S3Location": { "KmsKeyArn": "string", "Path": "string" } }, "RoleArn": "string", "Tags": [ { "Key": "string", "Value": "string" } ], "TrainingSessionName": "string", "VpcConfig": { "SecurityGroupIds": [ "string" ], "Subnets": [ "string" ] } }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

LoraConfig

The Low-Rank Adaptation (LoRA) configuration for the training session, including the rank and alpha parameters.

Type: LoraConfig object

Required: Yes

ModelConfig

The configuration for the base model, including the model ARN and end-user license agreement (EULA) acceptance.

Type: TrainingSessionModelConfig object

Required: Yes

ModelPackageGroupArn

The Amazon Resource Name (ARN) of the model package group where checkpoints and fine-tuned model artifacts are published.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 2048.

Pattern: arn:aws[a-z\-]*:sagemaker:[a-z0-9\-]{9,16}:[0-9]{12}:model-package-group/[\S]{1,2048}

Required: No

OutputConfig

The output configuration for the training session, including the S3 location and optional encryption settings.

Type: TrainingSessionOutputConfig object

Required: Yes

RoleArn

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.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 2048.

Pattern: arn:aws[a-z\-]*:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@\-_/]+

Required: Yes

Tags

An array of key-value pairs to apply to the training session as tags. For more information, see Tagging AWS Resources.

Type: Array of Tag objects

Array Members: Minimum number of 0 items. Maximum number of 50 items.

Required: No

TrainingSessionName

The name of the training session.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 63.

Pattern: [a-zA-Z0-9](-*[a-zA-Z0-9]){0,62}

Required: Yes

VpcConfig

The Virtual Private Cloud (VPC) configuration for the training session. Specify subnets and security groups to run the training session in your VPC.

Type: VpcConfig object

Required: No

Response Syntax

{ "TrainingSessionArn": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

TrainingSessionArn

The Amazon Resource Name (ARN) of the training session.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 256.

Pattern: arn:(aws[a-z\-]*):sagemaker:[a-z0-9\-]+:[0-9]{12}:training-session/[a-zA-Z0-9](-*[a-zA-Z0-9]){0,62}

Errors

For information about the errors that are common to all actions, see Common Error Types.

ResourceInUse

Resource being accessed is in use.

HTTP Status Code: 400

ResourceLimitExceeded

You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.

HTTP Status Code: 400

ResourceNotFound

Resource being access is not found.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: