AWS SageMaker

Booklet.ai supports models deployed to AWS SageMaker. This section highlights SageMaker-specific steps and details to get your model up and running.

Granting Access to AWS SageMaker

You need to grant Booklet read-only access to a limited number of SageMaker actions via an IAM role that is associated with our AWS account.

Follow these steps to create a read-only IAM Role for Booklet:

  1. Create a new role in the AWS IAM Console.
  2. Select “Another AWS account” for the Role Type and enter “256039543343” in the Account ID, field (this is the Booklet.ai AWS account id).
  3. Click the “Next: Permissions” button.
  4. Click the “Create Policy” button (opens a new window).
  5. Select the JSON tab. Copy and paste this JSON into the text area.
  6. Click “Review policy”.
  7. Name the policy “BookletAWSIntegrationPolicy” and click “Create policy” and close the window.
  8. Back in the “Create role” window, refresh the list of policies and select the policy you just created.
  9. Click “Next: Tags” and “Next: Review” to proceed to the review step.
  10. Give the role a name such as “BookletAWSIntegrationRole”. Click “Create Role”.
  11. Copy the Role ARN. It looks like something like “arn:aws:iam::123456789012:role/BookletIntegrationRole”.

With the AWS Role created and the ARN on your clipboard, we’re almost there. In the Booklet.ai, head over to your Org Settings (under your email in the top right) and the SageMaker integration settings. Here is where you’ll paste in the AWS Role ARN, select your region, and click the “Save” button:

sagemaker arn

When you click the “Save” button, Booklet.ai attempts to retrieve a list of SageMaker endpoints for the region you selected. If this API calls fails, Booklet.ai will render the error message. If no InService endpoints are found, the ARN is still saved, but Booklet will let you know that no endpoints were found.

input_fn Schema Requirements

Booklet.ai’s model inference UI generates predictions via the SageMaker InvokeEndpoint API endpoint. Your model’s input_fn must support the default application/json format defined in the SageMaker docs for your ML framework. In most cases, this is a JSON object containing a single JSON array. For example:

[
  [1, 3],
  [2, 5]
]

Booklet.ai infers the input schema based on the endpoint’s image name. For example, if the image name is:

1234567890.dkr.ecr.us-east-1.amazonaws.com/pytorch-inference:1.4.0-cpu-py3

Booklet infers that this is a PyTorch model and will invoke the endpoint with a single JSON array (the default format defined in the SageMaker PyTorch docs).

MLflow input_fn requirements

All MLflow models have a standard input structure, which is outlined in the MLflow documentation. See Booklet.ai’s MLFlow input schema requirements.