sagemaker.core.serializers.implementations#
Implements methods for serializing data for an inference endpoint.
Functions
|
Retrieves the default serializer for the model matching the given arguments. |
|
Retrieves the supported serializers for the model matching the given arguments. |
- sagemaker.core.serializers.implementations.retrieve_default(region: str | None = None, model_id: str | None = None, model_version: str | None = None, hub_arn: str | None = None, tolerate_vulnerable_model: bool = False, tolerate_deprecated_model: bool = False, model_type: ~sagemaker.core.jumpstart.enums.JumpStartModelType = JumpStartModelType.OPEN_WEIGHTS, sagemaker_session: ~sagemaker.core.helper.session_helper.Session = <sagemaker.core.helper.session_helper.Session object>, config_name: str | None = None) BaseSerializer[source]#
Retrieves the default serializer for the model matching the given arguments.
- Parameters:
region (str) – The AWS Region for which to retrieve the default serializer. Defaults to
None.model_id (str) – The model ID of the model for which to retrieve the default serializer. (Default: None).
model_version (str) – The version of the model for which to retrieve the default serializer. (Default: None).
hub_arn (str) – The arn of the SageMaker Hub for which to retrieve model details from. (Default: None).
tolerate_vulnerable_model (bool) – True if vulnerable versions of model specifications should be tolerated (exception not raised). If False, 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) – True if deprecated models should be tolerated (exception not raised). False if these models should raise an exception. (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).
config_name (Optional[str]) – Name of the JumpStart Model config to apply. (Default: None).
- Returns:
The default serializer to use for the model.
- Return type:
- Raises:
ValueError – If the combination of arguments specified is not supported.
- sagemaker.core.serializers.implementations.retrieve_options(region: str | None = None, model_id: str | None = None, model_version: str | None = None, hub_arn: str | None = None, 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>, config_name: str | None = None) List[BaseSerializer][source]#
Retrieves the supported serializers for the model matching the given arguments.
- Parameters:
region (str) – The AWS Region for which to retrieve the supported serializers. Defaults to
None.model_id (str) – The model ID of the model for which to retrieve the supported serializers. (Default: None).
model_version (str) – The version of the model for which to retrieve the supported serializers. (Default: None).
hub_arn (str) – The arn of the SageMaker Hub for which to retrieve model details from. (Default: None).
tolerate_vulnerable_model (bool) – True if vulnerable versions of model specifications should be tolerated (exception not raised). If False, 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) – True if deprecated models should be tolerated (exception not raised). False if these models should raise an exception. (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).
config_name (Optional[str]) – Name of the JumpStart Model config to apply. (Default: None).
- Returns:
The supported serializers to use for the model.
- Return type:
List[SimpleBaseSerializer]
- Raises:
ValueError – If the combination of arguments specified is not supported.