Bedrock / Client / create_model_customization_job

create_model_customization_job#

Bedrock.Client.create_model_customization_job(**kwargs)#

Creates a fine-tuning job to customize a base model.

You specify the base foundation model and the location of the training data. After the model-customization job completes successfully, your custom model resource will be ready to use. Training data contains input and output text for each record in a JSONL format. Optionally, you can specify validation data in the same format as the training data. Bedrock returns validation loss metrics and output generations after the job completes.

Model-customization jobs are asynchronous and the completion time depends on the base model and the training/validation data size. To monitor a job, use the GetModelCustomizationJob operation to retrieve the job status.

For more information, see Custom models in the Bedrock User Guide.

See also: AWS API Documentation

Request Syntax

response = client.create_model_customization_job(
    jobName='string',
    customModelName='string',
    roleArn='string',
    clientRequestToken='string',
    baseModelIdentifier='string',
    customModelKmsKeyId='string',
    jobTags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    customModelTags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    trainingDataConfig={
        's3Uri': 'string'
    },
    validationDataConfig={
        'validators': [
            {
                's3Uri': 'string'
            },
        ]
    },
    outputDataConfig={
        's3Uri': 'string'
    },
    hyperParameters={
        'string': 'string'
    },
    vpcConfig={
        'subnetIds': [
            'string',
        ],
        'securityGroupIds': [
            'string',
        ]
    }
)
Parameters:
  • jobName (string) –

    [REQUIRED]

    Enter a unique name for the fine-tuning job.

  • customModelName (string) –

    [REQUIRED]

    Enter a name for the custom model.

  • roleArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of an IAM role that Bedrock can assume to perform tasks on your behalf. For example, during model training, Bedrock needs your permission to read input data from an S3 bucket, write model artifacts to an S3 bucket. To pass this role to Bedrock, the caller of this API must have the iam:PassRole permission.

  • clientRequestToken (string) –

    Unique token value that you can provide. The GetModelCustomizationJob response includes the same token value.

    This field is autopopulated if not provided.

  • baseModelIdentifier (string) –

    [REQUIRED]

    Name of the base model.

  • customModelKmsKeyId (string) – The custom model is encrypted at rest using this key.

  • jobTags (list) –

    Assign tags to the job.

    • (dict) –

      Definition of the key/value pair for a tag.

      • key (string) – [REQUIRED]

        Key for the tag.

      • value (string) – [REQUIRED]

        Value for the tag.

  • customModelTags (list) –

    Assign tags to the custom model.

    • (dict) –

      Definition of the key/value pair for a tag.

      • key (string) – [REQUIRED]

        Key for the tag.

      • value (string) – [REQUIRED]

        Value for the tag.

  • trainingDataConfig (dict) –

    [REQUIRED]

    Information about the training dataset.

    • s3Uri (string) – [REQUIRED]

      The S3 URI where the training data is stored.

  • validationDataConfig (dict) –

    Information about the validation dataset.

    • validators (list) – [REQUIRED]

      Information about the validators.

      • (dict) –

        Information about a validator.

        • s3Uri (string) – [REQUIRED]

          The S3 URI where the validation data is stored.

  • outputDataConfig (dict) –

    [REQUIRED]

    S3 location for the output data.

    • s3Uri (string) – [REQUIRED]

      The S3 URI where the output data is stored.

  • hyperParameters (dict) –

    [REQUIRED]

    Parameters related to tuning the model.

    • (string) –

      • (string) –

  • vpcConfig (dict) –

    VPC configuration (optional). Configuration parameters for the private Virtual Private Cloud (VPC) that contains the resources you are using for this job.

    • subnetIds (list) – [REQUIRED]

      VPC configuration subnets.

      • (string) –

    • securityGroupIds (list) – [REQUIRED]

      VPC configuration security group Ids.

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'jobArn': 'string'
}

Response Structure

  • (dict) –

    • jobArn (string) –

      ARN of the fine tuning job

Exceptions

  • Bedrock.Client.exceptions.ResourceNotFoundException

  • Bedrock.Client.exceptions.AccessDeniedException

  • Bedrock.Client.exceptions.ValidationException

  • Bedrock.Client.exceptions.ConflictException

  • Bedrock.Client.exceptions.InternalServerException

  • Bedrock.Client.exceptions.TooManyTagsException

  • Bedrock.Client.exceptions.ServiceQuotaExceededException

  • Bedrock.Client.exceptions.ThrottlingException