create_optimization_job
async
¶
create_optimization_job(
*,
config_overrides: Optional[AsyncSageMakerClientConfig] = 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/async_sage_maker.py
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 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 | |