Skip to content

Create Optimization Job

sagemaker_create_optimization_job R Documentation

Creates a job that optimizes a model for inference performance

Description

Creates a job that optimizes a model for inference performance. To create the job, you provide the location of a source model, and you provide the settings for the optimization techniques that you want the job to apply. When the job completes successfully, SageMaker uploads the new optimized model to the output destination that you specify.

For more information about how to use this action, and about the supported optimization techniques, see Optimize model inference with Amazon SageMaker.

Usage

sagemaker_create_optimization_job(OptimizationJobName, RoleArn,
  ModelSource, DeploymentInstanceType, OptimizationEnvironment,
  OptimizationConfigs, OutputConfig, StoppingCondition, Tags, VpcConfig)

Arguments

OptimizationJobName

[required] A custom name for the new optimization job.

RoleArn

[required] The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker to perform tasks on your behalf.

During model optimization, Amazon SageMaker needs your permission to:

  • Read input data from an S3 bucket

  • Write model artifacts to an S3 bucket

  • Write logs to Amazon CloudWatch Logs

  • Publish metrics to Amazon CloudWatch

You grant permissions for all of these tasks to an IAM role. To pass this role to Amazon SageMaker, the caller of this API must have the iam:PassRole permission. For more information, see Amazon SageMaker Roles.

ModelSource

[required] The location of the source model to optimize with an optimization job.

DeploymentInstanceType

[required] The type of instance that hosts the optimized model that you create with the optimization job.

OptimizationEnvironment

The environment variables to set in the model container.

OptimizationConfigs

[required] Settings for each of the optimization techniques that the job applies.

OutputConfig

[required] Details for where to store the optimized model that you create with the optimization job.

StoppingCondition

[required]

Tags

A list of key-value pairs associated with the optimization job. For more information, see Tagging Amazon Web Services resources in the Amazon Web Services General Reference Guide.

VpcConfig

A VPC in Amazon VPC that your optimized model has access to.

Value

A list with the following syntax:

list(
  OptimizationJobArn = "string"
)

Request syntax

svc$create_optimization_job(
  OptimizationJobName = "string",
  RoleArn = "string",
  ModelSource = list(
    S3 = list(
      S3Uri = "string",
      ModelAccessConfig = list(
        AcceptEula = TRUE|FALSE
      )
    )
  ),
  DeploymentInstanceType = "ml.p4d.24xlarge"|"ml.p4de.24xlarge"|"ml.p5.48xlarge"|"ml.g5.xlarge"|"ml.g5.2xlarge"|"ml.g5.4xlarge"|"ml.g5.8xlarge"|"ml.g5.12xlarge"|"ml.g5.16xlarge"|"ml.g5.24xlarge"|"ml.g5.48xlarge"|"ml.g6.xlarge"|"ml.g6.2xlarge"|"ml.g6.4xlarge"|"ml.g6.8xlarge"|"ml.g6.12xlarge"|"ml.g6.16xlarge"|"ml.g6.24xlarge"|"ml.g6.48xlarge"|"ml.inf2.xlarge"|"ml.inf2.8xlarge"|"ml.inf2.24xlarge"|"ml.inf2.48xlarge"|"ml.trn1.2xlarge"|"ml.trn1.32xlarge"|"ml.trn1n.32xlarge",
  OptimizationEnvironment = list(
    "string"
  ),
  OptimizationConfigs = list(
    list(
      ModelQuantizationConfig = list(
        Image = "string",
        OverrideEnvironment = list(
          "string"
        )
      ),
      ModelCompilationConfig = list(
        Image = "string",
        OverrideEnvironment = list(
          "string"
        )
      )
    )
  ),
  OutputConfig = list(
    KmsKeyId = "string",
    S3OutputLocation = "string"
  ),
  StoppingCondition = list(
    MaxRuntimeInSeconds = 123,
    MaxWaitTimeInSeconds = 123,
    MaxPendingTimeInSeconds = 123
  ),
  Tags = list(
    list(
      Key = "string",
      Value = "string"
    )
  ),
  VpcConfig = list(
    SecurityGroupIds = list(
      "string"
    ),
    Subnets = list(
      "string"
    )
  )
)