common.serialization#
Serialization and deserialization module for exchanging data in tensordicts across nodes.
For simplicity, all data that is serialized must be of type TensorDict. This allows us to easily serialize and deserialize the data using PyTorch’s torch.save and torch.load functions in combination with io.BytesIO to convert the data to and from bytes.
- soulsai.distributed.common.serialization.serialize(data: TensorDict) bytes#
Serialize the data into a byte string.
- Parameters:
data – Data to be serialized.
- Returns:
Byte string representation of the data.
- soulsai.distributed.common.serialization.deserialize(data: bytes) TensorDict#
Deserialize the data from a byte string.
- Parameters:
data – Byte string representation of the data.
- Returns:
Deserialized data as a TensorDict.