CustomModel

class CustomModel : KotlinCustomResource

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.applyValue(getModelResult -> getModelResult.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

Properties

Link copied to clipboard

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

Link copied to clipboard

The customization type. Valid values: FINE_TUNING, CONTINUED_PRE_TRAINING.

Link copied to clipboard
val customModelArn: Output<String>

The ARN of the output model.

Link copied to clipboard

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

Link copied to clipboard
val customModelName: Output<String>

Name for the custom model.

Link copied to clipboard

Parameters related to tuning the model.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val jobArn: Output<String>

The ARN of the customization job.

Link copied to clipboard
val jobName: Output<String>

A name for the customization job.

Link copied to clipboard
val jobStatus: Output<String>

The status of the customization job. A successful job transitions from InProgress to Completed when the output model is ready to use.

Link copied to clipboard

S3 location for the output data.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val roleArn: Output<String>

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>>?

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 tagsAll: Output<Map<String, String>>

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
Link copied to clipboard

Information about the training dataset.

Link copied to clipboard

Metrics associated with the customization job.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard

Information about the validation dataset.

Link copied to clipboard

The loss metric for each validator that you provided.

Link copied to clipboard

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