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
7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 | |