ML 17293 1
In this post, I’ll show you how to use Amazon Bedrock—with its fully managed, on-demand API—with your Amazon SageMaker trained or fine-tuned model.
Amazon Bedrock is a fully managed service that offers a choice of high-performing foundation models (FMs) from leading AI companies such as AI21 Labs, Anthropic, Cohere, Meta, Mistral AI, Stability AI, and Amazon through a single API, along with a broad set of capabilities to build generative AI applications with security, privacy, and responsible AI.
Previously, if you wanted to use your own custom fine-tuned models in Amazon Bedrock, you either had to self-manage your inference infrastructure in SageMaker or train the models directly within Amazon Bedrock, which requires costly provisioned throughput.
With Amazon Bedrock Custom Model Import, you can use new or existing models that have been trained or fine-tuned within SageMaker using Amazon SageMaker JumpStart. You can import the supported architectures into Amazon Bedrock, allowing you to access them on demand through the Amazon Bedrock fully managed invoke model API.
At the time of writing, Amazon Bedrock supports importing custom models from the following architectures:
For this post, we use a Hugging Face Flan-T5 Base model.
In the following sections, I walk you through the steps to train a model in SageMaker JumpStart and import it into Amazon Bedrock. Then you can interact with your custom model through the Amazon Bedrock playgrounds.
Before you begin, verify that you have an AWS account with Amazon SageMaker Studio and Amazon Bedrock access.
If you don’t already have an instance of SageMaker Studio, see Launch Amazon SageMaker Studio for instructions to create one.
Complete the following steps to train a Flan model in SageMaker JumpStart:
With SageMaker JumpStart, machine learning (ML) practitioners can choose from a broad selection of publicly available FMs using pre-built machine learning solutions that can be deployed in a few clicks.
On the model details page, you can review a short description of the model, how to deploy it, how to fine-tune it, and what format your training data needs to be in to customize the model.
Create the training job using the default settings. The defaults populate the training job with recommended settings.
You can monitor your job by selecting Training on the Jobs dropdown menu. When the training job status shows as Completed, the job has finished. With default settings, training takes about 10 minutes.
After the model has completed training, you can import it into Amazon Bedrock. Complete the following steps:
You can now interact with your custom model. In the following screenshot, we use our example custom model to summarize a description about Amazon Bedrock.
Complete the following steps to clean up your resources:
In this post, we explored how the Custom Model Import feature in Amazon Bedrock enables you to use your own custom trained or fine-tuned models for on-demand, cost-efficient inference. By integrating SageMaker model training capabilities with the fully managed, scalable infrastructure of Amazon Bedrock, you now have a seamless way to deploy your specialized models and make them accessible through a simple API.
Whether you prefer the user-friendly SageMaker Studio console or the flexibility of SageMaker notebooks, you can train and import your models into Amazon Bedrock. This allows you to focus on developing innovative applications and solutions, without the burden of managing complex ML infrastructure.
As the capabilities of large language models continue to evolve, the ability to integrate custom models into your applications becomes increasingly valuable. With the Amazon Bedrock Custom Model Import feature, you can now unlock the full potential of your specialized models and deliver tailored experiences to your customers, all while benefiting from the scalability and cost-efficiency of a fully managed service.
To dive deeper into fine-tuning on SageMaker, see Instruction fine-tuning for FLAN T5 XL with Amazon SageMaker Jumpstart. To get more hands-on experience with Amazon Bedrock, check out our Building with Amazon Bedrock workshop.
By combining fine-tuning and in-context learning, you get LLMs that can learn tasks that would…
We sat down with Tom Conrad, the interim CEO of Sonos, to talk about the…
Engineers developed a ping-pong-playing robot that quickly estimates the speed and trajectory of an incoming…
A lot (if not nearly all) of the success and progress made by many generative…
CBP’s acting commissioner has rescinded four Biden-era policies that aimed to protect vulnerable people in…
A team of researchers has unveiled a cutting-edge Amphibious Robotic Dog capable of roving across…