Hyperparameters¶
Accessors to retrieve hyperparameters for training jobs.
- sagemaker.hyperparameters.retrieve_default(region=None, model_id=None, model_version=None, hub_arn=None, instance_type=None, include_container_hyperparameters=False, tolerate_vulnerable_model=False, tolerate_deprecated_model=False, sagemaker_session=<sagemaker.session.Session object>, config_name=None, model_type=JumpStartModelType.OPEN_WEIGHTS)¶
Retrieves the default training hyperparameters for the model matching the given arguments.
- Parameters
region (str) – The AWS Region for which to retrieve the default hyperparameters. Defaults to
None
.model_id (str) – The model ID of the model for which to retrieve the default hyperparameters. (Default: None).
model_version (str) – The version of the model for which to retrieve the default hyperparameters. (Default: None).
hub_arn (str) – The arn of the SageMaker Hub for which to retrieve model details from. (default: None).
instance_type (str) – An instance type to optionally supply in order to get hyperparameters specific for the instance type.
include_container_hyperparameters (bool) –
True
if the container hyperparameters should be returned. Container hyperparameters are not used to tune the specific algorithm. They are used by SageMaker Training jobs to set up the training container environment. For example, there is a container hyperparameter that indicates the entrypoint script to use. These hyperparameters may be required when creating a training job with boto3, however theEstimator
classes add required container hyperparameters to the job. (Default: False).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).
model_type (JumpStartModelType) – The type of the model, can be open weights model or proprietary model. (Default: JumpStartModelType.OPEN_WEIGHTS).
- Returns
The hyperparameters to use for the model.
- Return type
- Raises
ValueError – If the combination of arguments specified is not supported.
- sagemaker.hyperparameters.validate(region=None, model_id=None, hub_arn=None, model_version=None, hyperparameters=None, validation_mode=HyperparameterValidationMode.VALIDATE_PROVIDED, tolerate_vulnerable_model=False, tolerate_deprecated_model=False, sagemaker_session=<sagemaker.session.Session object>)¶
Validates hyperparameters for models.
- Parameters
region (str) – The AWS Region for which to validate hyperparameters. (Default: None).
model_id (str) – The model ID of the model for which to validate hyperparameters. (Default: None).
model_version (str) – The version of the model for which to validate hyperparameters. (Default: None).
hub_arn (str) – The arn of the SageMaker Hub for which to retrieve model details from. (default: None).
hyperparameters (dict) – Hyperparameters to validate. (Default: None).
validation_mode (HyperparameterValidationMode) – Method of validation to use with hyperparameters. If set to
VALIDATE_PROVIDED
, only hyperparameters provided to this function will be validated, the missing hyperparameters will be ignored. If set to``VALIDATE_ALGORITHM``, all algorithm hyperparameters will be validated. If set toVALIDATE_ALL
, all hyperparameters for the model will be validated. (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).
- Raises
JumpStartHyperparametersError – If the hyperparameter is not formatted correctly, according to its specs in the model metadata.
ValueError – If the combination of arguments specified is not supported.
- Return type
None