Deserializers

Implements methods for deserializing data returned from an inference endpoint.

sagemaker.deserializers.retrieve_options(region=None, model_id=None, model_version=None, tolerate_vulnerable_model=False, tolerate_deprecated_model=False, sagemaker_session=<sagemaker.session.Session object>)

Retrieves the supported deserializers for the model matching the given arguments.

Parameters
  • region (str) – The AWS Region for which to retrieve the supported deserializers. Defaults to None.

  • model_id (str) – The model ID of the model for which to retrieve the supported deserializers. (Default: None).

  • model_version (str) – The version of the model for which to retrieve the supported deserializers. (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).

Returns

The supported deserializers to use for the model.

Return type

List[BaseDeserializer]

Raises

ValueError – If the combination of arguments specified is not supported.

sagemaker.deserializers.retrieve_default(region=None, model_id=None, model_version=None, tolerate_vulnerable_model=False, tolerate_deprecated_model=False, sagemaker_session=<sagemaker.session.Session object>)

Retrieves the default deserializer for the model matching the given arguments.

Parameters
  • region (str) – The AWS Region for which to retrieve the default deserializer. Defaults to None.

  • model_id (str) – The model ID of the model for which to retrieve the default deserializer. (Default: None).

  • model_version (str) – The version of the model for which to retrieve the default deserializer. (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).

Returns

The default deserializer to use for the model.

Return type

BaseDeserializer

Raises

ValueError – If the combination of arguments specified is not supported.