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. Amazon Bedrock returns validation loss metrics and output generations after the job completes.

For information on the format of training and validation data, see Prepare the datasets.

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 Amazon 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',
    customizationType='FINE_TUNING'|'CONTINUED_PRE_TRAINING',
    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]

    A name for the fine-tuning job.

  • customModelName (string) –

    [REQUIRED]

    A name for the resulting custom model.

  • roleArn (string) –

    [REQUIRED]

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

  • clientRequestToken (string) –

    A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency.

    This field is autopopulated if not provided.

  • baseModelIdentifier (string) –

    [REQUIRED]

    Name of the base model.

  • customizationType (string) – The customization type.

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

  • jobTags (list) –

    Tags to attach 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) –

    Tags to attach to the resulting 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. For details on the format for different models, see Custom model hyperparameters.

    • (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) –

      Amazon Resource Name (ARN) of the fine tuning job

Exceptions