create_optimization_job
¶
create_optimization_job(
*,
config_overrides: Optional[SageMakerClientConfig] = None,
optimization_job_name: Optional[EntityName] = None,
role_arn: Optional[RoleArn] = None,
model_source: Optional[OptimizationJobModelSource] = None,
deployment_instance_type: Optional[OptimizationJobDeploymentInstanceType] = None,
max_instance_count: Optional[OptimizationJobMaxInstanceCount] = None,
optimization_environment: Optional[OptimizationJobEnvironmentVariables] = None,
optimization_configs: Optional[OptimizationConfigs] = None,
output_config: Optional[OptimizationJobOutputConfig] = None,
stopping_condition: Optional[StoppingCondition] = None,
tags: Optional[TagList] = None,
vpc_config: Optional[OptimizationVpcConfig] = None,
training_plan_arns: Optional[OptimizationJobTrainingPlanArns] = None,
) -> CreateOptimizationJobResponse
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.
Parameters:
-
optimization_job_name(Optional[EntityName], default:None) –A custom name for the new optimization job.
-
role_arn(Optional[RoleArn], default:None) –The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker AI to perform tasks on your behalf.
During model optimization, Amazon SageMaker AI 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 AI, the caller of this API must have the
iam:PassRolepermission. For more information, see Amazon SageMaker AI Roles. -
-
model_source(Optional[OptimizationJobModelSource], default:None) –The location of the source model to optimize with an optimization job.
-
deployment_instance_type(Optional[OptimizationJobDeploymentInstanceType], default:None) –The type of instance that hosts the optimized model that you create with the optimization job.
-
max_instance_count(Optional[OptimizationJobMaxInstanceCount], default:None) –The maximum number of instances to use for the optimization job.
-
optimization_environment(Optional[OptimizationJobEnvironmentVariables], default:None) –The environment variables to set in the model container.
-
optimization_configs(Optional[OptimizationConfigs], default:None) –Settings for each of the optimization techniques that the job applies.
-
output_config(Optional[OptimizationJobOutputConfig], default:None) –Details for where to store the optimized model that you create with the optimization job.
-
tags(Optional[TagList], default:None) –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.
-
vpc_config(Optional[OptimizationVpcConfig], default:None) –A VPC in Amazon VPC that your optimized model has access to.
-
training_plan_arns(Optional[OptimizationJobTrainingPlanArns], default:None) –The Amazon Resource Name (ARN) of the training plan to use for this optimization job.
When you use reserved capacity from a training plan, the optimization job runs on that reserved capacity instead of on-demand capacity. If you omit this field, the job uses on-demand capacity. You can specify at most one training plan.
For more information about how to reserve GPU capacity for your optimization jobs using Amazon SageMaker Training Plans, see Reserve capacity with training plans.
Raises:
-
ResourceInUse–Resource being accessed is in use.
-
ResourceLimitExceeded–You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_sagemaker/_services/sage_maker.py
6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 | |