Amazon SageMaker JumpStart is a machine studying (ML) hub providing pre-trained fashions and pre-built options. It gives entry to tons of of basis fashions (FMs). A personal hub is a characteristic in SageMaker JumpStart that enables a corporation to share their fashions and notebooks in order to centralize mannequin artifacts, facilitate discoverability, and enhance the reuse throughout the group. With new fashions launched every day, many enterprise admins need extra management over the FMs that may be found and utilized by customers inside their group (for instance, solely permitting fashions primarily based on pytorch framework to be found).
Now enterprise admins can effortlessly configure granular entry management over the FMs that SageMaker JumpStart gives out of field in order that solely allowed fashions might be accessed by customers inside their organizations. On this put up, we focus on the steps required for an administrator to configure granular entry management of fashions in SageMaker JumpStart utilizing a personal hub, in addition to the steps for customers to entry and devour fashions from the personal hub.
Answer overview
Beginning right this moment, with SageMaker JumpStart and its personal hub characteristic, directors can create repositories for a subset of fashions tailor-made to completely different groups, use instances, or license necessities utilizing the Amazon SageMaker Python SDK. Admins may also arrange a number of personal hubs with completely different lists of fashions discoverable for various teams of customers. Customers are then solely in a position to uncover and use fashions throughout the personal hubs they’ve entry to by way of Amazon SageMaker Studio and the SDK. This stage of management empowers enterprises to devour the most recent in open weight generative synthetic intelligence (AI) improvement whereas implementing governance guardrails. Lastly, admins can share entry to non-public hubs throughout a number of AWS accounts, enabling collaborative mannequin administration whereas sustaining centralized management. SageMaker JumpStart makes use of AWS Useful resource Entry Supervisor (AWS RAM) to securely share personal hubs with different accounts in the identical group. The brand new characteristic is offered within the us-east-2 AWS Area as of writing, and will probably be out there to extra Areas quickly.
The next diagram reveals an instance structure of SageMaker JumpStart with its private and non-private hub options. The diagram illustrates how SageMaker JumpStart gives entry to completely different mannequin repositories, with some customers accessing the general public SageMaker JumpStart hub and others utilizing personal curated hubs.
Within the following part, we reveal how admins can configure granular entry management of fashions in SageMaker JumpStart utilizing a personal hub. Then we present how customers can entry and devour allowlisted fashions within the personal hub utilizing SageMaker Studio and the SageMaker Python SDK. Lastly, we take a look at how an admin consumer can share the personal hub with customers in one other account.
Conditions
To make use of the SageMaker Python SDK and run the code related to this put up, you want the next stipulations:
- An AWS account that comprises all of your AWS assets
- An AWS Identification and Entry Administration (IAM) position with entry to SageMaker Studio notebooks
- SageMaker JumpStart enabled in a SageMaker Studio area
Create a personal hub, curate fashions, and configure entry management (admins)
This part gives a step-by-step information for directors to create a personal hub, curate fashions, and configure entry management to your group’s customers.
- As a result of the characteristic has been built-in within the newest SageMaker Python SDK, to make use of the mannequin granular entry management characteristic with a personal hub, let’s first replace the SageMaker Python SDK:
!pip3 set up sagemaker —force-reinstall —quiet - Subsequent, import the SageMaker and Boto3 libraries:
import boto3 from sagemaker import Session from sagemaker.jumpstart.hub.hub import Hub - Configure your personal hub:
HUB_NAME="CompanyHub" HUB_DISPLAY_NAME="Allowlisted Fashions" HUB_DESCRIPTION="These are allowlisted fashions taken from the JumpStart Public Hub." REGION="<your_region_name>" # for instance, "us-west-2"Within the previous code,
HUB_NAMEspecifies the identify of your Hub.HUB_DISPLAY_NAMEis the show identify to your hub that will probably be proven to customers in UI experiences.HUB_DESCRIPTIONis the outline to your hub that will probably be proven to customers. - Arrange a Boto3 consumer for SageMaker:
sm_client = boto3.consumer('sagemaker') session = Session(sagemaker_client=sm_client) session.get_caller_identity_arn() - Test if the next insurance policies have been already added to your admin IAM position; if not, you’ll be able to add them as inline insurance policies:
{ "Model": "2012-10-17", "Assertion": [ { "Action": [ "s3:ListBucket", "s3:GetObject", "s3:GetObjectTagging" ], "Useful resource": [ "arn:aws:s3:::jumpstart-cache-prod-<REGION>", "arn:aws:s3:::jumpstart-cache-prod-<REGION>/*" ], "Impact": "Enable" } ] }Exchange the
<REGION>placeholder utilizing the configurations in Step 3.Along with establishing IAM permissions to the admin position, you might want to scope down permissions to your customers to allow them to’t entry public contents.
- Use the next coverage to disclaim entry to the general public hub to your customers. These might be added as inline insurance policies within the consumer’s IAM position:
{ "Model": "2012-10-17", "Assertion": [ { "Action": "s3:*", "Effect": "Deny", "Resource": [ "arn:aws:s3:::jumpstart-cache-prod-<REGION>", "arn:aws:s3:::jumpstart-cache-prod-<REGION>/*" ], "Situation": { "StringNotLike": {"s3:prefix": ["*.ipynb", "*/eula.txt"]} } }, { "Motion": "sagemaker:*", "Impact": "Deny", "Useful resource": [ "arn:aws:sagemaker:<REGION>:aws:hub/SageMakerPublicHub", "arn:aws:sagemaker:<REGION>:aws:hub-content/SageMakerPublicHub/*/*" ] } ] }Exchange the
<REGION>placeholder within the coverage utilizing the configurations in Step 3.After you’ve got arrange the personal hub configuration and permissions, you’re able to create the personal hub.
- Use the next code to create the personal hub inside your AWS account within the Area you specified earlier:
hub = Hub(hub_name=HUB_NAME, sagemaker_session=session) attempt: hub.create( description=HUB_DESCRIPTION, display_name=HUB_DISPLAY_NAME ) print(f"Efficiently created Hub with identify {HUB_NAME} in {REGION}") besides Exception as e: if "ResourceInUse" in str(e): print(f"A hub with the identify {HUB_NAME} already exists in your account.") else: elevate e - Use
hub.describe()to confirm the configuration of your hub.After your personal hub is about up, you’ll be able to add a reference to fashions from the SageMaker JumpStart public hub to your personal hub. No mannequin artifacts must be managed by the client. The SageMaker workforce will handle any model or safety updates.For an inventory of accessible fashions, consult with Built-in Algorithms with pre-trained Model Table. - To go looking programmatically, run the command
filter_value = "framework == meta" response = hub.list_sagemaker_public_hub_models(filter=filter_value) fashions = response["hub_content_summaries"] whereas response["next_token"]: response = hub.list_sagemaker_public_hub_models(filter=filter_value, next_token=response["next_token"]) fashions.lengthen(response["hub_content_summaries"]) print(fashions)The filter argument is non-compulsory. For an inventory of filters you’ll be able to apply, consult with SageMaker Python SDK.
- Use the retrieved fashions from the previous command to create mannequin references to your personal hub:
for mannequin in fashions: print(f"Including {mannequin.get('hub_content_name')} to Hub") hub.create_model_reference(model_arn=mannequin.get("hub_content_arn"), model_name=mannequin.get("hub_content_name"))The SageMaker JumpStart personal hub presents different helpful options for managing and interacting with the curated fashions. Directors can verify the metadata of a selected mannequin utilizing the
hub.describe_model(model_name=<model_name>)command. To checklist all out there fashions within the personal hub, you need to use a easy loop:response = hub.list_models() fashions = response["hub_content_summaries"] whereas response["next_token"]: response = hub.list_models(next_token=response["next_token"]) fashions.lengthen(response["hub_content_summaries"]) for mannequin in fashions: print(mannequin.get('HubContentArn'))If you might want to take away a selected mannequin reference from the personal hub, use the next command:
hub.delete_model_reference("<model_name>")If you wish to delete the personal hub out of your account and Area, you’ll have to delete all of the HubContents first, then delete the personal hub. Use the next code:
for mannequin in fashions: hub.delete_model_reference(model_name=mannequin.get('HubContentName')) hub.delete()
Work together with allowlisted fashions (customers)
This part presents a step-by-step information for customers to work together with allowlisted fashions in SageMaker JumpStart. We reveal learn how to checklist out there fashions, establish a mannequin from the general public hub, and deploy the mannequin to endpoints from SageMaker Studio in addition to the SageMaker Python SDK.
Person expertise in SageMaker Studio
Full the next steps to work together with allowlisted fashions utilizing SageMaker Studio:
- On the SageMaker Studio console, select JumpStart within the navigation pane or within the Prebuilt and automatic options part.

- Select certainly one of mannequin hubs you’ve got entry to. If the consumer has entry to a number of hubs, you’ll see an inventory of hubs, as proven within the following screenshot.

If the consumer has entry to just one hub, you’ll go straight to the mannequin checklist.
You may view the mannequin particulars and supported actions like practice, deploy, and consider. - To deploy a mannequin, select Deploy.

- Modify your mannequin configurations like cases and deployment parameters, and select Deploy.

Person expertise utilizing the SageMaker Python SDK
To work together together with your fashions utilizing the SageMaker Python SDK, full the next steps:
- Identical to the admin course of, step one is to power reinstall the SageMaker Python SDK:
!pip3 set up sagemaker —force-reinstall —quiet - Import the SageMaker and Boto3 libraries:
import boto3 from sagemaker import Session from sagemaker.jumpstart.hub.hub import Hub from sagemaker.jumpstart.mannequin import JumpStartModel from sagemaker.jumpstart.estimator import JumpStartEstimator - To entry the fashions in your personal hub, you want the Area and the identify of the hub in your account. Fill out the
HUB_NAMEandREGIONfields with the data offered by your administrator:HUB_NAME="CompanyHub" REGION="<your_region_name>" # for instance, "us-west-2" sm_client = boto3.consumer('sagemaker') sm_runtime_client = boto3.consumer('sagemaker-runtime') session = Session(sagemaker_client=sm_client, sagemaker_runtime_client=sm_runtime_client) hub = Hub(hub_name=HUB_NAME, sagemaker_session=session) - Checklist the fashions out there in your personal hub utilizing the next command:
response = hub.list_models() fashions = response["hub_content_summaries"] whereas response["next_token"]: response = hub.list_models(next_token=response["next_token"]) fashions.lengthen(response["hub_content_summaries"]) print(fashions) - To get extra details about a selected mannequin, use the
describe_modeltechnique:model_name = "huggingface-llm-phi-2" response = hub.describe_model(model_name=model_name) print(response) - You may deploy fashions in a hub with the Python SDK through the use of
JumpStartModel. To deploy a mannequin from the hub to an endpoint and invoke the endpoint with the default payloads, run the next code. To pick out which mannequin out of your hub you wish to use, go in amodel_idandmodel. When you go in*for themodel, it would take the most recent model out there for thatmodel_idwithin the hub. When you’re utilizing a mannequin gated behind a EULA settlement, go inaccept_eula=True.model_id, model = "huggingface-llm-phi-2", "1.0.0" mannequin = JumpStartModel(model_id, model, hub_name=HUB_NAME, area=REGION, sagemaker_session=session) predictor = mannequin.deploy(accept_eula=False) - To invoke your deployed mannequin with the default payloads, use the next code:
example_payloads = mannequin.retrieve_all_examples() for payload in example_payloads: response = predictor.predict(payload.physique) print("nInputn", payload.physique, "nnOutputn", response[0]["generated_text"], "nn===============") - To delete the mannequin endpoints that you just created, use the next code:
predictor.delete_model() predictor.delete_endpoint()
Cross-account sharing of personal hubs
SageMaker JumpStart personal hubs assist cross-account sharing, permitting you to increase the advantages of your curated mannequin repository past your individual AWS account. This characteristic allows collaboration throughout completely different groups or departments inside your group, even after they function in separate AWS accounts. Through the use of AWS RAM, you’ll be able to securely share your personal hubs whereas sustaining management over entry.
To share your personal hub throughout accounts, full the next steps:
- On the AWS RAM console, select Create useful resource share.
- When specifying useful resource share particulars, select the SageMaker hub useful resource kind and choose a number of personal hubs that you just wish to share. While you share a hub with every other account, all of its contents are additionally shared implicitly.
- Affiliate permissions together with your useful resource share.
- Use AWS account IDs to specify the accounts to which you wish to grant entry to your shared assets.
- Evaluation your useful resource share configuration and select Create useful resource share.
It might take a couple of minutes for the useful resource share and principal associations to finish.
Admins that wish to carry out the previous steps programmatically can enter the next command to provoke the sharing:
# create a useful resource share utilizing the personal hub
aws ram create-resource-share
--name test-share
--resource-arns arn:aws:sagemaker:<area>:<resource_owner_account_id>:hub/<hub_name>
--principals <consumer_account_id>
--region <area>
Exchange the <resource_owner_account_id>, <consumer_account_id>, <hub_name>, and <area> placeholders with the suitable values for the useful resource proprietor account ID, client account ID, identify of the hub, and Area to make use of.
After you arrange the useful resource share, the required AWS account will obtain an invite to affix. They have to settle for this invitation by way of AWS RAM to realize entry to the shared personal hub. This course of makes positive entry is granted solely with express consent from each the hub proprietor and the recipient account. For extra data, consult with Utilizing shared AWS assets.
You can even carry out this step programmatically:
# checklist useful resource shares
aws ram get-resource-share-invitations
--region <area>
# settle for useful resource share
# utilizing the arn from the earlier response
aws ram accept-resource-share-invitation
--resource-share-invitation-arn <arn_from_ previous_request>
--region <area>
For detailed directions on creating useful resource shares and accepting invites, consult with Making a useful resource share in AWS RAM. By extending your personal hub throughout accounts, you’ll be able to foster collaboration and preserve constant mannequin governance throughout your complete group.
Conclusion
SageMaker JumpStart permits enterprises to undertake FMs whereas sustaining granular management over mannequin entry and utilization. By making a curated repository of accredited fashions in personal hubs, organizations can align their AI initiatives with company insurance policies and regulatory necessities. The personal hub decouples mannequin curation from mannequin consumption, enabling directors to handle the mannequin stock whereas knowledge scientists deal with creating AI options.
This put up defined the personal hub characteristic in SageMaker JumpStart and offered steps to arrange and use a personal hub, with minimal extra configuration required. Directors can choose fashions from the general public SageMaker JumpStart hub, add them to the personal hub, and handle consumer entry by way of IAM insurance policies. Customers can then deploy these preapproved fashions, fine-tune them on customized datasets, and combine them into their functions utilizing acquainted SageMaker interfaces. The personal hub makes use of the SageMaker underlying infrastructure, permitting it to scale with enterprise-level ML calls for.
For extra details about SageMaker JumpStart, consult with SageMaker JumpStart. To get began utilizing SageMaker JumpStart, entry it by way of SageMaker Studio.
In regards to the Authors
Raju Rangan is a Senior Options Architect at AWS. He works with government-sponsored entities, serving to them construct AI/ML options utilizing AWS. When not tinkering with cloud options, you’ll catch him hanging out with household or smashing birdies in a full of life sport of badminton with mates.
Sherry Ding is a senior AI/ML specialist options architect at AWS. She has in depth expertise in machine studying with a PhD in laptop science. She primarily works with public sector clients on numerous AI/ML-related enterprise challenges, serving to them speed up their machine studying journey on the AWS Cloud. When not serving to clients, she enjoys out of doors actions.
June Gained is a product supervisor with Amazon SageMaker JumpStart. He focuses on making basis fashions simply discoverable and usable to assist clients construct generative AI functions. His expertise at Amazon additionally consists of cellular purchasing functions and final mile supply.
Bhaskar Pratap is a Senior Software program Engineer with the Amazon SageMaker workforce. He’s obsessed with designing and constructing elegant methods that deliver machine studying to individuals’s fingertips. Moreover, he has in depth expertise with constructing scalable cloud storage companies.

