/AWS1/IF_SGM=>CREATEOPTIMIZATIONJOB()¶
About CreateOptimizationJob¶
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.
Method Signature¶
METHODS /AWS1/IF_SGM~CREATEOPTIMIZATIONJOB
IMPORTING
!IV_OPTIMIZATIONJOBNAME TYPE /AWS1/SGMENTITYNAME OPTIONAL
!IV_ROLEARN TYPE /AWS1/SGMROLEARN OPTIONAL
!IO_MODELSOURCE TYPE REF TO /AWS1/CL_SGMOPTIMIZATIONJOBM00 OPTIONAL
!IV_DEPLOYMENTINSTANCETYPE TYPE /AWS1/SGMOPTIMIZATIONJOBDEPL00 OPTIONAL
!IV_MAXINSTANCECOUNT TYPE /AWS1/SGMOPTMZTNJOBMAXINSTCNT OPTIONAL
!IT_OPTIMIZATIONENVIRONMENT TYPE /AWS1/CL_SGMOPTIMIZATIONJOBE00=>TT_OPTIMIZATIONJOBENVIRONMEN00 OPTIONAL
!IT_OPTIMIZATIONCONFIGS TYPE /AWS1/CL_SGMOPTIMIZATIONCONFIG=>TT_OPTIMIZATIONCONFIGS OPTIONAL
!IO_OUTPUTCONFIG TYPE REF TO /AWS1/CL_SGMOPTIMIZATIONJOBO00 OPTIONAL
!IO_STOPPINGCONDITION TYPE REF TO /AWS1/CL_SGMSTOPPINGCONDITION OPTIONAL
!IT_TAGS TYPE /AWS1/CL_SGMTAG=>TT_TAGLIST OPTIONAL
!IO_VPCCONFIG TYPE REF TO /AWS1/CL_SGMOPTIMIZATIONVPCCFG OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_sgmcreoptimizationj01
RAISING
/AWS1/CX_SGMRESOURCEINUSE
/AWS1/CX_SGMRESOURCELIMITEXCD
/AWS1/CX_SGMCLIENTEXC
/AWS1/CX_SGMSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_optimizationjobname TYPE /AWS1/SGMENTITYNAME /AWS1/SGMENTITYNAME¶
A custom name for the new optimization job.
iv_rolearn TYPE /AWS1/SGMROLEARN /AWS1/SGMROLEARN¶
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.
io_modelsource TYPE REF TO /AWS1/CL_SGMOPTIMIZATIONJOBM00 /AWS1/CL_SGMOPTIMIZATIONJOBM00¶
The location of the source model to optimize with an optimization job.
iv_deploymentinstancetype TYPE /AWS1/SGMOPTIMIZATIONJOBDEPL00 /AWS1/SGMOPTIMIZATIONJOBDEPL00¶
The type of instance that hosts the optimized model that you create with the optimization job.
it_optimizationconfigs TYPE /AWS1/CL_SGMOPTIMIZATIONCONFIG=>TT_OPTIMIZATIONCONFIGS TT_OPTIMIZATIONCONFIGS¶
Settings for each of the optimization techniques that the job applies.
io_outputconfig TYPE REF TO /AWS1/CL_SGMOPTIMIZATIONJOBO00 /AWS1/CL_SGMOPTIMIZATIONJOBO00¶
Details for where to store the optimized model that you create with the optimization job.
io_stoppingcondition TYPE REF TO /AWS1/CL_SGMSTOPPINGCONDITION /AWS1/CL_SGMSTOPPINGCONDITION¶
Specifies a limit to how long a job can run. When the job reaches the time limit, SageMaker ends the job. Use this API to cap costs.
To stop a training job, SageMaker sends the algorithm the
SIGTERMsignal, which delays job termination for 120 seconds. Algorithms can use this 120-second window to save the model artifacts, so the results of training are not lost.The training algorithms provided by SageMaker automatically save the intermediate results of a model training job when possible. This attempt to save artifacts is only a best effort case as model might not be in a state from which it can be saved. For example, if training has just started, the model might not be ready to save. When saved, this intermediate data is a valid model artifact. You can use it to create a model with
CreateModel.The Neural Topic Model (NTM) currently does not support saving intermediate model artifacts. When training NTMs, make sure that the maximum runtime is sufficient for the training job to complete.
Optional arguments:¶
iv_maxinstancecount TYPE /AWS1/SGMOPTMZTNJOBMAXINSTCNT /AWS1/SGMOPTMZTNJOBMAXINSTCNT¶
The maximum number of instances to use for the optimization job.
it_optimizationenvironment TYPE /AWS1/CL_SGMOPTIMIZATIONJOBE00=>TT_OPTIMIZATIONJOBENVIRONMEN00 TT_OPTIMIZATIONJOBENVIRONMEN00¶
The environment variables to set in the model container.
it_tags TYPE /AWS1/CL_SGMTAG=>TT_TAGLIST TT_TAGLIST¶
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.
io_vpcconfig TYPE REF TO /AWS1/CL_SGMOPTIMIZATIONVPCCFG /AWS1/CL_SGMOPTIMIZATIONVPCCFG¶
A VPC in Amazon VPC that your optimized model has access to.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_sgmcreoptimizationj01 /AWS1/CL_SGMCREOPTIMIZATIONJ01¶
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->createoptimizationjob(
io_modelsource = new /aws1/cl_sgmoptimizationjobm00(
io_s3 = new /aws1/cl_sgmoptimizationjobm01(
io_modelaccessconfig = new /aws1/cl_sgmoptimizationmdel00( ABAP_TRUE )
iv_s3uri = |string|
)
io_sagemakermodel = new /aws1/cl_sgmoptmztnsmmodel( |string| )
)
io_outputconfig = new /aws1/cl_sgmoptimizationjobo00(
io_sagemakermodel = new /aws1/cl_sgmoptmztnsmmodel( |string| )
iv_kmskeyid = |string|
iv_s3outputlocation = |string|
)
io_stoppingcondition = new /aws1/cl_sgmstoppingcondition(
iv_maxpendingtimeinseconds = 123
iv_maxruntimeinseconds = 123
iv_maxwaittimeinseconds = 123
)
io_vpcconfig = new /aws1/cl_sgmoptimizationvpccfg(
it_securitygroupids = VALUE /aws1/cl_sgmoptimizationvpcs00=>tt_optimizationvpcsecgroupids(
( new /aws1/cl_sgmoptimizationvpcs00( |string| ) )
)
it_subnets = VALUE /aws1/cl_sgmoptimizationvpcs01=>tt_optimizationvpcsubnets(
( new /aws1/cl_sgmoptimizationvpcs01( |string| ) )
)
)
it_optimizationconfigs = VALUE /aws1/cl_sgmoptimizationconfig=>tt_optimizationconfigs(
(
new /aws1/cl_sgmoptimizationconfig(
io_mdelspeculativedecoding00 = new /aws1/cl_sgmmdelspeculatived00(
io_trainingdatasource = new /aws1/cl_sgmmdelspeculatived01(
iv_s3datatype = |string|
iv_s3uri = |string|
)
iv_technique = |string|
)
io_modelcompilationconfig = new /aws1/cl_sgmmdelcompilationcfg(
it_overrideenvironment = VALUE /aws1/cl_sgmoptimizationjobe00=>tt_optimizationjobenvironmen00(
(
VALUE /aws1/cl_sgmoptimizationjobe00=>ts_optimizationjobenv00_maprow(
key = |string|
value = new /aws1/cl_sgmoptimizationjobe00( |string| )
)
)
)
iv_image = |string|
)
io_modelquantizationconfig = new /aws1/cl_sgmmdelquantization00(
it_overrideenvironment = VALUE /aws1/cl_sgmoptimizationjobe00=>tt_optimizationjobenvironmen00(
(
VALUE /aws1/cl_sgmoptimizationjobe00=>ts_optimizationjobenv00_maprow(
key = |string|
value = new /aws1/cl_sgmoptimizationjobe00( |string| )
)
)
)
iv_image = |string|
)
io_modelshardingconfig = new /aws1/cl_sgmmodelshardingcfg(
it_overrideenvironment = VALUE /aws1/cl_sgmoptimizationjobe00=>tt_optimizationjobenvironmen00(
(
VALUE /aws1/cl_sgmoptimizationjobe00=>ts_optimizationjobenv00_maprow(
key = |string|
value = new /aws1/cl_sgmoptimizationjobe00( |string| )
)
)
)
iv_image = |string|
)
)
)
)
it_optimizationenvironment = VALUE /aws1/cl_sgmoptimizationjobe00=>tt_optimizationjobenvironmen00(
(
VALUE /aws1/cl_sgmoptimizationjobe00=>ts_optimizationjobenv00_maprow(
key = |string|
value = new /aws1/cl_sgmoptimizationjobe00( |string| )
)
)
)
it_tags = VALUE /aws1/cl_sgmtag=>tt_taglist(
(
new /aws1/cl_sgmtag(
iv_key = |string|
iv_value = |string|
)
)
)
iv_deploymentinstancetype = |string|
iv_maxinstancecount = 123
iv_optimizationjobname = |string|
iv_rolearn = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_optimizationjobarn = lo_result->get_optimizationjobarn( ).
ENDIF.