Create Bento Archive

This guide shows you how to create a Bento Archive and export it (bentoml export) to an S3 bucket.

Before You Start

  • Ensure you have completed Developer System Setup.
    • You may need to install bentoml[aws] if you have not done so already.
  • This guide assumes you have already trained a model and are ready to create a Bento.

How to Create a Bento Archive

Create Bento

Prepare your model and save it as a Bento:

bentoml build -o tag

Create S3 Bucket

  1. Create an AWS profile:
    aws --profile my-aws-profile configure
    AWS Access Key ID [None]: AKIAYLGG12ZIQZLL6PUG
    AWS Secret Access Key [None]: AeazKuGrL4UgiUABVnfhwW02oNtTeB4ec9cQwE1y
    Default region name [None]:
    Default output format [None]:
  2. Create an S3 bucket:
    aws --profile aioli-demo s3 mb s3://mlis-bucket --region us-east-1 
    make_bucket: USER-bucket
  3. List your bentos:
    bentoml list
     Tag                                  Size       Model Size  Creation Time       
    pytorch_mnist_demo:fml2z4xekol6llg6  20.63 KiB  1.30 MiB    2024-03-17 07:40:49 

Export Bento as Archive

  1. Export the Bento as an archive using the bentoml export command. The Bento archive must end with .bento:
    bentoml export pytorch_mnist_demo:latest s3://mlis-bucket/bentoml/pytorch_mnist_demo_.bento
    tip icon Tip
    If this command fails to export the Bento to S3 storage, make sure you have installed bentoml with aws support (e.g., pip install 'bentoml[aws]').
  2. Verify the Bento archive is accessible:
    aws --profile aioli-demo s3 ls s3://mlis-bucket/bentoml/
    2024-03-18 14:46:19    1255948 pytorch_mnist_demo.bento