sagemaker.train.container_drivers.scripts.environment#
This module is used to define the environment variables for the training job container.
Functions
|
Deserialize hyperparameters from string to their original types. |
|
Log Environment Variables from the environment and an env_vars_dict. |
|
Log a key-value pair, masking sensitive values if necessary. |
|
Main function to set the environment variables for the training job container. |
|
Recursively mask sensitive information in a dictionary. |
|
Return the number of CPUs available in the current container. |
|
Return the number of GPUs available in the current container. |
Return the number of neuron cores available in the current container. |
|
|
Set environment variables for the training job container. |
- sagemaker.train.container_drivers.scripts.environment.deserialize_hyperparameters(hyperparameters: Dict[str, str]) Dict[str, Any][source]#
Deserialize hyperparameters from string to their original types.
- Parameters:
hyperparameters (Dict[str, str]) – Hyperparameters as strings.
- Returns:
Hyperparameters as their original types.
- Return type:
Dict[str, Any]
- sagemaker.train.container_drivers.scripts.environment.log_env_variables(env_vars_dict: Dict[str, Any])[source]#
Log Environment Variables from the environment and an env_vars_dict.
- sagemaker.train.container_drivers.scripts.environment.log_key_value(key: str, value: str)[source]#
Log a key-value pair, masking sensitive values if necessary.
- sagemaker.train.container_drivers.scripts.environment.main()[source]#
Main function to set the environment variables for the training job container.
- sagemaker.train.container_drivers.scripts.environment.mask_sensitive_info(data)[source]#
Recursively mask sensitive information in a dictionary.
- sagemaker.train.container_drivers.scripts.environment.num_cpus() int[source]#
Return the number of CPUs available in the current container.
- Returns:
Number of CPUs available in the current container.
- Return type:
int
- sagemaker.train.container_drivers.scripts.environment.num_gpus() int[source]#
Return the number of GPUs available in the current container.
- Returns:
Number of GPUs available in the current container.
- Return type:
int
- sagemaker.train.container_drivers.scripts.environment.num_neurons() int[source]#
Return the number of neuron cores available in the current container.
- Returns:
Number of Neuron Cores available in the current container.
- Return type:
int
- sagemaker.train.container_drivers.scripts.environment.set_env(resource_config: Dict[str, Any], input_data_config: Dict[str, Any], hyperparameters_config: Dict[str, Any], output_file: str = '/opt/ml/input/sm_training.env')[source]#
Set environment variables for the training job container.
- Parameters:
resource_config (Dict[str, Any]) – Resource configuration for the training job.
input_data_config (Dict[str, Any]) – Input data configuration for the training job.
hyperparameters_config (Dict[str, Any]) – Hyperparameters configuration for the training job.
output_file (str) – Output file to write the environment variables.