On this put up, I’ll present you the best way to use Amazon Bedrock—with its totally managed, on-demand API—along with your Amazon SageMaker educated or fine-tuned mannequin.
Amazon Bedrock is a completely managed service that provides a selection of high-performing basis fashions (FMs) from main AI firms equivalent to AI21 Labs, Anthropic, Cohere, Meta, Mistral AI, Stability AI, and Amazon by a single API, together with a broad set of capabilities to construct generative AI purposes with safety, privateness, and accountable AI.
Beforehand, in case you needed to make use of your individual customized fine-tuned fashions in Amazon Bedrock, you both needed to self-manage your inference infrastructure in SageMaker or prepare the fashions immediately inside Amazon Bedrock, which requires expensive provisioned throughput.
With Amazon Bedrock Customized Mannequin Import, you need to use new or present fashions which have been educated or fine-tuned inside SageMaker utilizing Amazon SageMaker JumpStart. You may import the supported architectures into Amazon Bedrock, permitting you to entry them on demand by the Amazon Bedrock totally managed invoke mannequin API.
Answer overview
On the time of writing, Amazon Bedrock helps importing customized fashions from the next architectures:
- Mistral
- Flan
- Meta Llama 2 and Llama 3
For this put up, we use a Hugging Face Flan-T5 Base mannequin.
Within the following sections, I stroll you thru the steps to coach a mannequin in SageMaker JumpStart and import it into Amazon Bedrock. Then you possibly can work together along with your customized mannequin by the Amazon Bedrock playgrounds.
Stipulations
Earlier than you start, confirm that you’ve got an AWS account with Amazon SageMaker Studio and Amazon Bedrock entry.
If you happen to don’t have already got an occasion of SageMaker Studio, see Launch Amazon SageMaker Studio for directions to create one.
Practice a mannequin in SageMaker JumpStart
Full the next steps to coach a Flan mannequin in SageMaker JumpStart:
- Open the AWS Administration Console and go to SageMaker Studio.
- In SageMaker Studio, select JumpStart within the navigation pane.
With SageMaker JumpStart, machine studying (ML) practitioners can select from a broad choice of publicly accessible FMs utilizing pre-built machine studying options that may be deployed in a number of clicks.
- Seek for and select the Hugging Face Flan-T5 Base
On the mannequin particulars web page, you possibly can assessment a brief description of the mannequin, the best way to deploy it, the best way to fine-tune it, and what format your coaching knowledge must be in to customise the mannequin.
- Select Practice to start fine-tuning the mannequin in your coaching knowledge.
Create the coaching job utilizing the default settings. The defaults populate the coaching job with beneficial settings.
- The instance on this put up makes use of a prepopulated instance dataset. When utilizing your individual knowledge, enter its location within the Information part, ensuring it meets the format necessities.
- Configure the safety settings equivalent to AWS Id and Entry Administration (IAM) position, digital non-public cloud (VPC), and encryption.
- Notice the worth for Output artifact location (S3 URI) to make use of later.
- Submit the job to start out coaching.
You may monitor your job by deciding on Coaching on the Jobs dropdown menu. When the coaching job standing reveals as Accomplished, the job has completed. With default settings, coaching takes about 10 minutes.
Import the mannequin into Amazon Bedrock
After the mannequin has accomplished coaching, you possibly can import it into Amazon Bedrock. Full the next steps:
- On the Amazon Bedrock console, select Imported fashions underneath Basis fashions within the navigation pane.
- Select Import mannequin.
- For Mannequin identify, enter a recognizable identify to your mannequin.
- Below Mannequin import settings, choose Amazon SageMaker mannequin and choose the radio button subsequent to your mannequin.
- Below Service entry, choose Create and use a brand new service position and enter a reputation for the position.
- Select Import mannequin.
- The mannequin import will full in about quarter-hour.
- Below Playgrounds within the navigation pane, select Textual content.
- Select Choose mannequin.
- For Class, select Imported fashions.
- For Mannequin, select flan-t5-fine-tuned.
- For Throughput, select On-demand.
- Select Apply.
Now you can work together along with your customized mannequin. Within the following screenshot, we use our instance customized mannequin to summarize an outline about Amazon Bedrock.
Clear up
Full the next steps to wash up your sources:
- If you happen to’re not going to proceed utilizing SageMaker, delete your SageMaker area.
- If you happen to now not wish to keep your mannequin artifacts, delete the Amazon Easy Storage Service (Amazon S3) bucket the place your mannequin artifacts are saved.
- To delete your imported mannequin from Amazon Bedrock, on the Imported fashions web page on the Amazon Bedrock console, choose your mannequin, after which select the choices menu (three dots) and choose Delete.
Conclusion
On this put up, we explored how the Customized Mannequin Import function in Amazon Bedrock lets you use your individual customized educated or fine-tuned fashions for on-demand, cost-efficient inference. By integrating SageMaker mannequin coaching capabilities with the totally managed, scalable infrastructure of Amazon Bedrock, you now have a seamless technique to deploy your specialised fashions and make them accessible by a easy API.
Whether or not you favor the user-friendly SageMaker Studio console or the pliability of SageMaker notebooks, you possibly can prepare and import your fashions into Amazon Bedrock. This lets you give attention to growing progressive purposes and options, with out the burden of managing complicated ML infrastructure.
Because the capabilities of huge language fashions proceed to evolve, the flexibility to combine customized fashions into your purposes turns into more and more beneficial. With the Amazon Bedrock Customized Mannequin Import function, now you can unlock the total potential of your specialised fashions and ship tailor-made experiences to your prospects, all whereas benefiting from the scalability and cost-efficiency of a completely managed service.
To dive deeper into fine-tuning on SageMaker, see Instruction fine-tuning for FLAN T5 XL with Amazon SageMaker Jumpstart. To get extra hands-on expertise with Amazon Bedrock, try our Constructing with Amazon Bedrock workshop.
Concerning the Writer
Joseph Sadler is a Senior Options Architect on the Worldwide Public Sector staff at AWS, specializing in cybersecurity and machine studying. With private and non-private sector expertise, he has experience in cloud safety, synthetic intelligence, risk detection, and incident response. His various background helps him architect sturdy, safe options that use cutting-edge applied sciences to safeguard mission-critical techniques