sagemaker.core.jumpstart.hub.utils#

This module contains utilities related to SageMaker JumpStart Hub.

Functions

construct_hub_arn_from_name(hub_name[, ...])

Constructs a Hub arn from the Hub name using default Session values.

construct_hub_model_arn_from_inputs(hub_arn, ...)

Constructs a HubContent model arn from the Hub name, model name, and model version.

construct_hub_model_reference_arn_from_inputs(...)

Constructs a HubContent model arn from the Hub name, model name, and model version.

generate_hub_arn_for_init_kwargs(hub_name[, ...])

Generates the Hub Arn for JumpStart class args from a HubName or Arn.

get_hub_model_version(hub_name, ...[, ...])

Returns available Jumpstart hub model version.

get_info_from_hub_resource_arn(arn)

Extracts descriptive information from a Hub or HubContent Arn.

is_gated_bucket(bucket_name)

Returns true if the bucket name is the JumpStart gated bucket.

sagemaker.core.jumpstart.hub.utils.construct_hub_arn_from_name(hub_name: str, region: str | None = None, session: ~sagemaker.core.helper.session_helper.Session | None = <sagemaker.core.helper.session_helper.Session object>, account_id: str | None = None) str[source]#

Constructs a Hub arn from the Hub name using default Session values.

sagemaker.core.jumpstart.hub.utils.construct_hub_model_arn_from_inputs(hub_arn: str, model_name: str, version: str) str[source]#

Constructs a HubContent model arn from the Hub name, model name, and model version.

sagemaker.core.jumpstart.hub.utils.construct_hub_model_reference_arn_from_inputs(hub_arn: str, model_name: str, version: str) str[source]#

Constructs a HubContent model arn from the Hub name, model name, and model version.

sagemaker.core.jumpstart.hub.utils.generate_hub_arn_for_init_kwargs(hub_name: str, region: str | None = None, session: Session | None = None)[source]#

Generates the Hub Arn for JumpStart class args from a HubName or Arn.

Parameters:
  • hub_name (str) – HubName or HubArn from JumpStart class args

  • region (str) – Region from JumpStart class args

  • session (Session) – Custom SageMaker Session from JumpStart class args

sagemaker.core.jumpstart.hub.utils.get_hub_model_version(hub_name: str, hub_model_name: str, hub_model_type: str, hub_model_version: str | None = None, sagemaker_session: ~sagemaker.core.helper.session_helper.Session = <sagemaker.core.helper.session_helper.Session object>) str[source]#

Returns available Jumpstart hub model version.

It will attempt both a semantic HubContent version search and Marketplace version search. If the Marketplace version is also semantic, this function will default to HubContent version.

Raises:
  • ClientError – If the specified model is not found in the hub.

  • KeyError – If the specified model version is not found.

sagemaker.core.jumpstart.hub.utils.get_info_from_hub_resource_arn(arn: str) HubArnExtractedInfo[source]#

Extracts descriptive information from a Hub or HubContent Arn.

sagemaker.core.jumpstart.hub.utils.is_gated_bucket(bucket_name: str) bool[source]#

Returns true if the bucket name is the JumpStart gated bucket.