Instance Types

Accessors to retrieve instance types.

sagemaker.instance_types.retrieve_default(region=None, model_id=None, model_version=None, scope=None, tolerate_vulnerable_model=False, tolerate_deprecated_model=False, sagemaker_session=<sagemaker.session.Session object>, training_instance_type=None, model_type=JumpStartModelType.OPEN_WEIGHTS)

Retrieves the default instance type for the model matching the given arguments.

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

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

  • model_version (str) – The version of the model for which to retrieve the default instance type. (Default: None).

  • scope (str) – The model type, i.e. what it is used for. Valid values: “training” and “inference”.

  • 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).

  • training_instance_type (str) – In the case of a model fine-tuned on SageMaker, the training instance type used for the training job that produced the fine-tuned weights. Optionally supply this to get a inference instance type conditioned on the training instance, to ensure compatability of training artifact to inference instance. (Default: None).

  • model_type (JumpStartModelType) –

Returns

The default instance type to use for the model.

Return type

str

Raises

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

sagemaker.instance_types.retrieve(region=None, model_id=None, model_version=None, scope=None, tolerate_vulnerable_model=False, tolerate_deprecated_model=False, sagemaker_session=<sagemaker.session.Session object>, training_instance_type=None)

Retrieves the supported training instance types for the model matching the given arguments.

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

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

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

  • training_instance_type (str) – In the case of a model fine-tuned on SageMaker, the training instance type used for the training job that produced the fine-tuned weights. Optionally supply this to get a inference instance type conditioned on the training instance, to ensure compatability of training artifact to inference instance. (Default: None).

  • scope (Optional[str]) –

Returns

The supported instance types to use for the model.

Return type

list

Raises

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