sagemaker.core.jumpstart.cache#
This module defines the JumpStartModelsCache class.
Classes
|
Class that implements a cache for JumpStart models manifests and specs. |
- class sagemaker.core.jumpstart.cache.JumpStartModelsCache(region: str | None = None, max_s3_cache_items: int = 20, s3_cache_expiration_horizon: ~datetime.timedelta = datetime.timedelta(seconds=21600), max_semantic_version_cache_items: int = 20, semantic_version_cache_expiration_horizon: ~datetime.timedelta = datetime.timedelta(seconds=21600), manifest_file_s3_key: str = 'models_manifest.json', proprietary_manifest_s3_key: str = 'proprietary-sdk-manifest.json', s3_bucket_name: str | None = None, s3_client_config: ~botocore.config.Config | None = None, s3_client: ~boto3.client | None = None, sagemaker_session: ~sagemaker.core.helper.session_helper.Session | None = <sagemaker.core.helper.session_helper.Session object>)[source]#
Bases:
objectClass that implements a cache for JumpStart models manifests and specs.
The manifest and specs associated with JumpStart models provide the information necessary for launching JumpStart models from the SageMaker SDK.
- get_header(model_id: str, semantic_version_str: str, model_type: JumpStartModelType = JumpStartModelType.OPEN_WEIGHTS) JumpStartModelHeader[source]#
Return header for a given JumpStart model ID and semantic version.
- Parameters:
model_id (str) – model ID for which to get a header.
semantic_version_str (str) – The semantic version for which to get a header.
- get_hub_model(hub_model_arn: str) JumpStartModelSpecs[source]#
Return JumpStart-compatible specs for a given Hub model
- Parameters:
hub_model_arn (str) – Arn for the Hub model to get specs for
- get_hub_model_reference(hub_model_reference_arn: str) JumpStartModelSpecs[source]#
Return JumpStart-compatible specs for a given Hub model reference
- Parameters:
hub_model_arn (str) – Arn for the Hub model to get specs for
- get_manifest(model_type: JumpStartModelType = JumpStartModelType.OPEN_WEIGHTS) List[JumpStartModelHeader][source]#
Return entire JumpStart models manifest.
- get_manifest_file_s3_key(file_type: JumpStartS3FileType = JumpStartS3FileType.OPEN_WEIGHT_MANIFEST) str[source]#
Return manifest file s3 key for cache.
- get_specs(model_id: str, version_str: str, model_type: JumpStartModelType = JumpStartModelType.OPEN_WEIGHTS) JumpStartModelSpecs[source]#
Return specs for a given JumpStart model ID and semantic version.
- Parameters:
model_id (str) – model ID for which to get specs.
semantic_version_str (str) – The semantic version for which to get specs.
model_type (JumpStartModelType) – The type of the model of interest.
- set_manifest_file_s3_key(key: str, file_type: JumpStartS3FileType = JumpStartS3FileType.OPEN_WEIGHT_MANIFEST) None[source]#
Set manifest file s3 key, clear cache after new key is set.
- Raises:
ValueError – if the file type is not recognized