sagemaker.core.payloads#
Utilities related to payloads of pretrained machine learning models.
Functions
|
Retrieves the compatible payloads for the model matching the given arguments. |
|
Retrieves a single compatible payload for the model matching the given arguments. |
- sagemaker.core.payloads.retrieve_all_examples(region: str | None = None, model_id: str | None = None, model_version: str | None = None, hub_arn: str | None = None, model_type: ~sagemaker.core.jumpstart.enums.JumpStartModelType | None = JumpStartModelType.OPEN_WEIGHTS, serialize: bool = False, tolerate_vulnerable_model: bool = False, tolerate_deprecated_model: bool = False, sagemaker_session: ~sagemaker.core.helper.session_helper.Session = <sagemaker.core.helper.session_helper.Session object>) List[JumpStartSerializablePayload] | None[source]#
Retrieves the compatible payloads for the model matching the given arguments.
- Parameters:
region (str) – The AWS Region for which to retrieve the Jumpstart model payloads.
model_id (str) – The model ID of the JumpStart model for which to retrieve the model payloads.
model_version (str) – The version of the JumpStart model for which to retrieve the model payloads.
serialize (bool) – Whether to serialize byte-stream valued payloads by downloading binary files from s3 and applying encoding, or to keep payload in pre-serialized state. Set this option to False if you want to avoid s3 downloads or if you want to inspect the payload in a human-readable form. (Default: False).
tolerate_vulnerable_model (bool) –
Trueif vulnerable versions of model specifications should be tolerated without raising an exception. IfFalse, raises an exception if the script used by this version of the model has dependencies with known security vulnerabilities. (Default: False).tolerate_deprecated_model (bool) –
Trueif deprecated versions of model specifications should be tolerated without raising an exception. IfFalse, raises an exception if the version of the model is deprecated. (Default: False).sagemaker_session (sagemaker.session.Session) – A SageMaker Session object, used for SageMaker interactions. If not specified, one is created using the default AWS configuration chain. (Default: sagemaker.jumpstart.constants.DEFAULT_JUMPSTART_SAGEMAKER_SESSION).
- Returns:
List of payloads or None.
- Return type:
Optional[List[JumpStartSerializablePayload]]
- Raises:
NotImplementedError – If the scope is not supported.
ValueError – If the combination of arguments specified is not supported.
VulnerableJumpStartModelError – If any of the dependencies required by the script have known security vulnerabilities.
DeprecatedJumpStartModelError – If the version of the model is deprecated.
- sagemaker.core.payloads.retrieve_example(region: str | None = None, model_id: str | None = None, model_version: str | None = None, hub_arn: str | None = None, model_type: ~sagemaker.core.jumpstart.enums.JumpStartModelType | None = JumpStartModelType.OPEN_WEIGHTS, serialize: bool = False, tolerate_vulnerable_model: bool = False, tolerate_deprecated_model: bool = False, sagemaker_session: ~sagemaker.core.helper.session_helper.Session = <sagemaker.core.helper.session_helper.Session object>) JumpStartSerializablePayload | None[source]#
Retrieves a single compatible payload for the model matching the given arguments.
- Parameters:
region (str) – The AWS Region for which to retrieve the Jumpstart model payloads.
model_id (str) – The model ID of the JumpStart model for which to retrieve the model payload.
model_version (str) – The version of the JumpStart model for which to retrieve the model payload.
model_type (str) – The model type of the JumpStart model, either is open weight or proprietary.
serialize (bool) – Whether to serialize byte-stream valued payloads by downloading binary files from s3 and applying encoding, or to keep payload in pre-serialized state. Set this option to False if you want to avoid s3 downloads or if you want to inspect the payload in a human-readable form. (Default: False).
tolerate_vulnerable_model (bool) –
Trueif vulnerable versions of model specifications should be tolerated without raising an exception. IfFalse, raises an exception if the script used by this version of the model has dependencies with known security vulnerabilities. (Default: False).tolerate_deprecated_model (bool) –
Trueif deprecated versions of model specifications should be tolerated without raising an exception. IfFalse, raises an exception if the version of the model is deprecated. (Default: False).sagemaker_session (sagemaker.session.Session) – A SageMaker Session object, used for SageMaker interactions. If not specified, one is created using the default AWS configuration chain. (Default: sagemaker.jumpstart.constants.DEFAULT_JUMPSTART_SAGEMAKER_SESSION).
- Returns:
A single default payload or None.
- Return type:
Optional[JumpStartSerializablePayload]
- Raises:
NotImplementedError – If the scope is not supported.
ValueError – If the combination of arguments specified is not supported.
VulnerableJumpStartModelError – If any of the dependencies required by the script have known security vulnerabilities.
DeprecatedJumpStartModelError – If the version of the model is deprecated.