CustomModelArgs

data class CustomModelArgs(val baseModelIdentifier: Output<String>? = null, val customModelKmsKeyId: Output<String>? = null, val customModelName: Output<String>? = null, val customizationType: Output<String>? = null, val hyperparameters: Output<Map<String, String>>? = null, val jobName: Output<String>? = null, val outputDataConfig: Output<CustomModelOutputDataConfigArgs>? = null, val roleArn: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val timeouts: Output<CustomModelTimeoutsArgs>? = null, val trainingDataConfig: Output<CustomModelTrainingDataConfigArgs>? = null, val validationDataConfig: Output<CustomModelValidationDataConfigArgs>? = null, val vpcConfig: Output<CustomModelVpcConfigArgs>? = null) : ConvertibleToJava<CustomModelArgs>

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.bedrockfoundation.getModel({
modelId: "amazon.titan-text-express-v1",
});
const exampleCustomModel = new aws.bedrock.CustomModel("example", {
customModelName: "example-model",
jobName: "example-job-1",
baseModelIdentifier: example.then(example => example.modelArn),
roleArn: exampleAwsIamRole.arn,
hyperparameters: {
epochCount: "1",
batchSize: "1",
learningRate: "0.005",
learningRateWarmupSteps: "0",
},
outputDataConfig: {
s3Uri: `s3://${output.id}/data/`,
},
trainingDataConfig: {
s3Uri: `s3://${training.id}/data/train.jsonl`,
},
});
import pulumi
import pulumi_aws as aws
example = aws.bedrockfoundation.get_model(model_id="amazon.titan-text-express-v1")
example_custom_model = aws.bedrock.CustomModel("example",
custom_model_name="example-model",
job_name="example-job-1",
base_model_identifier=example.model_arn,
role_arn=example_aws_iam_role["arn"],
hyperparameters={
"epochCount": "1",
"batchSize": "1",
"learningRate": "0.005",
"learningRateWarmupSteps": "0",
},
output_data_config={
"s3_uri": f"s3://{output['id']}/data/",
},
training_data_config={
"s3_uri": f"s3://{training['id']}/data/train.jsonl",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.BedrockFoundation.GetModel.Invoke(new()
{
ModelId = "amazon.titan-text-express-v1",
});
var exampleCustomModel = new Aws.Bedrock.CustomModel("example", new()
{
CustomModelName = "example-model",
JobName = "example-job-1",
BaseModelIdentifier = example.Apply(getModelResult => getModelResult.ModelArn),
RoleArn = exampleAwsIamRole.Arn,
Hyperparameters =
{
{ "epochCount", "1" },
{ "batchSize", "1" },
{ "learningRate", "0.005" },
{ "learningRateWarmupSteps", "0" },
},
OutputDataConfig = new Aws.Bedrock.Inputs.CustomModelOutputDataConfigArgs
{
S3Uri = $"s3://{output.Id}/data/",
},
TrainingDataConfig = new Aws.Bedrock.Inputs.CustomModelTrainingDataConfigArgs
{
S3Uri = $"s3://{training.Id}/data/train.jsonl",
},
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/bedrock"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/bedrockfoundation"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := bedrockfoundation.GetModel(ctx, &bedrockfoundation.GetModelArgs{
ModelId: "amazon.titan-text-express-v1",
}, nil)
if err != nil {
return err
}
_, err = bedrock.NewCustomModel(ctx, "example", &bedrock.CustomModelArgs{
CustomModelName: pulumi.String("example-model"),
JobName: pulumi.String("example-job-1"),
BaseModelIdentifier: pulumi.String(example.ModelArn),
RoleArn: pulumi.Any(exampleAwsIamRole.Arn),
Hyperparameters: pulumi.StringMap{
"epochCount": pulumi.String("1"),
"batchSize": pulumi.String("1"),
"learningRate": pulumi.String("0.005"),
"learningRateWarmupSteps": pulumi.String("0"),
},
OutputDataConfig: &bedrock.CustomModelOutputDataConfigArgs{
S3Uri: pulumi.Sprintf("s3://%v/data/", output.Id),
},
TrainingDataConfig: &bedrock.CustomModelTrainingDataConfigArgs{
S3Uri: pulumi.Sprintf("s3://%v/data/train.jsonl", training.Id),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.bedrockfoundation.BedrockfoundationFunctions;
import com.pulumi.aws.bedrockfoundation.inputs.GetModelArgs;
import com.pulumi.aws.bedrock.CustomModel;
import com.pulumi.aws.bedrock.CustomModelArgs;
import com.pulumi.aws.bedrock.inputs.CustomModelOutputDataConfigArgs;
import com.pulumi.aws.bedrock.inputs.CustomModelTrainingDataConfigArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = BedrockfoundationFunctions.getModel(GetModelArgs.builder()
.modelId("amazon.titan-text-express-v1")
.build());
var exampleCustomModel = new CustomModel("exampleCustomModel", CustomModelArgs.builder()
.customModelName("example-model")
.jobName("example-job-1")
.baseModelIdentifier(example.modelArn())
.roleArn(exampleAwsIamRole.arn())
.hyperparameters(Map.ofEntries(
Map.entry("epochCount", "1"),
Map.entry("batchSize", "1"),
Map.entry("learningRate", "0.005"),
Map.entry("learningRateWarmupSteps", "0")
))
.outputDataConfig(CustomModelOutputDataConfigArgs.builder()
.s3Uri(String.format("s3://%s/data/", output.id()))
.build())
.trainingDataConfig(CustomModelTrainingDataConfigArgs.builder()
.s3Uri(String.format("s3://%s/data/train.jsonl", training.id()))
.build())
.build());
}
}
resources:
exampleCustomModel:
type: aws:bedrock:CustomModel
name: example
properties:
customModelName: example-model
jobName: example-job-1
baseModelIdentifier: ${example.modelArn}
roleArn: ${exampleAwsIamRole.arn}
hyperparameters:
epochCount: '1'
batchSize: '1'
learningRate: '0.005'
learningRateWarmupSteps: '0'
outputDataConfig:
s3Uri: s3://${output.id}/data/
trainingDataConfig:
s3Uri: s3://${training.id}/data/train.jsonl
variables:
example:
fn::invoke:
function: aws:bedrockfoundation:getModel
arguments:
modelId: amazon.titan-text-express-v1

Import

Using pulumi import, import Bedrock custom model using the job_arn. For example:

$ pulumi import aws:bedrock/customModel:CustomModel example arn:aws:bedrock:us-west-2:123456789012:model-customization-job/amazon.titan-text-express-v1:0:8k/1y5n57gh5y2e

Constructors

Link copied to clipboard
constructor(baseModelIdentifier: Output<String>? = null, customModelKmsKeyId: Output<String>? = null, customModelName: Output<String>? = null, customizationType: Output<String>? = null, hyperparameters: Output<Map<String, String>>? = null, jobName: Output<String>? = null, outputDataConfig: Output<CustomModelOutputDataConfigArgs>? = null, roleArn: Output<String>? = null, tags: Output<Map<String, String>>? = null, timeouts: Output<CustomModelTimeoutsArgs>? = null, trainingDataConfig: Output<CustomModelTrainingDataConfigArgs>? = null, validationDataConfig: Output<CustomModelValidationDataConfigArgs>? = null, vpcConfig: Output<CustomModelVpcConfigArgs>? = null)

Properties

Link copied to clipboard
val baseModelIdentifier: Output<String>? = null

The Amazon Resource Name (ARN) of the base model.

Link copied to clipboard
val customizationType: Output<String>? = null

The customization type. Valid values: FINE_TUNING, CONTINUED_PRE_TRAINING.

Link copied to clipboard
val customModelKmsKeyId: Output<String>? = null

The custom model is encrypted at rest using this key. Specify the key ARN.

Link copied to clipboard
val customModelName: Output<String>? = null

Name for the custom model.

Link copied to clipboard
val hyperparameters: Output<Map<String, String>>? = null

Parameters related to tuning the model.

Link copied to clipboard
val jobName: Output<String>? = null

A name for the customization job.

Link copied to clipboard

S3 location for the output data.

Link copied to clipboard
val roleArn: Output<String>? = null

The Amazon Resource Name (ARN) of an IAM role that Bedrock can assume to perform tasks on your behalf.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A map of tags to assign to the customization job and custom model. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val timeouts: Output<CustomModelTimeoutsArgs>? = null
Link copied to clipboard

Information about the training dataset.

Link copied to clipboard

Information about the validation dataset.

Link copied to clipboard
val vpcConfig: Output<CustomModelVpcConfigArgs>? = null

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

Functions

Link copied to clipboard
open override fun toJava(): CustomModelArgs