sagemaker.train.utils#
Utils module.
Functions
|
Convert Unassigned values to None for any instance. |
|
Serialize the data without wrapping strings in quotes. |
- sagemaker.train.utils.convert_unassigned_to_none(instance) Any[source]#
Convert Unassigned values to None for any instance.
- sagemaker.train.utils.safe_serialize(data)[source]#
Serialize the data without wrapping strings in quotes.
This function handles the following cases: 1. If data is a string, it returns the string as-is without wrapping in quotes. 2. If data is of type PipelineVariable, it returns the json representation of the PipelineVariable 3. If data is serializable (e.g., a dictionary, list, int, float), it returns
the JSON-encoded string using json.dumps().
If data cannot be serialized (e.g., a custom object), it returns the string representation of the data using str(data).
- Parameters:
data (Any) – The data to serialize.
- Returns:
The serialized JSON-compatible string or the string representation of the input.
- Return type:
str