Msgpack utils#
Utils for writing in msgpack format. Derived from flax.serialization.
- orbax.checkpoint.msgpack_utils.msgpack_serialize(pytree, in_place=False)[source][source]#
Save data structure to bytes in msgpack format.
Low-level function that only supports python trees with array leaves, for custom objects use to_bytes. It splits arrays above MAX_CHUNK_SIZE into multiple chunks.
- Parameters:
pytree – python tree of dict, list, tuple with python primitives and array leaves.
in_place (
bool
) – boolean specifyng if pytree should be modified in place.
- Return type:
bytes
- Returns:
msgpack-encoded bytes of pytree.
- orbax.checkpoint.msgpack_utils.msgpack_restore(encoded_pytree)[source][source]#
Restore data structure from bytes in msgpack format.
Low-level function that only supports python trees with array leaves, for custom objects use from_bytes.
- Parameters:
encoded_pytree (
bytes
) – msgpack-encoded bytes of python tree.- Returns:
Python tree of dict, list, tuple with python primitive and array leaves.