Compile a Model (AWS Command Line Interface)
This section shows how to manage Amazon SageMaker Neo compilation jobs for machine learning models using AWS Command Line Interface (CLI). You can create, describe, stop, and list the compilation jobs.
Create a Compilation Job
With the CreateCompilationJob API operation, you can specify the data input format, the S3 bucket in which to store your model, the S3 bucket to which to write the compiled model, and the target hardware device or platform.
The following table demonstrates how to configure
CreateCompilationJob
API based on whether your target is a device or a platform.Note
For the
OutputConfig
API operation, theTargetDevice
andTargetPlatform
API operations are mutually exclusive. You have to choose one of the two options.To find the JSON string examples of
DataInputConfig
depending on frameworks, see What input data shapes Neo expects.For more information about setting up the configurations, see the InputConfig, OutputConfig, and TargetPlatform API operations in the SageMaker API reference.
After you configure the JSON file, run the following command to create the compilation job:
aws sagemaker create-compilation-job \ --cli-input-json file://job.json \ --region us-west-2 # You should get CompilationJobArn
Describe the compilation job by running the following command:
aws sagemaker describe-compilation-job \ --compilation-job-name $JOB_NM \ --region us-west-2
Stop the compilation job by running the following command:
aws sagemaker stop-compilation-job \ --compilation-job-name $JOB_NM \ --region us-west-2 # There is no output for compilation-job operation
List the compilation job by running the following command:
aws sagemaker list-compilation-jobs \ --region us-west-2