Cloudpickle
Cloudpickle extends the standard functionality of the pickle module, allowing the serialization of Python objects that are not natively serializable. Current version is 3.1.2, released regularly with bug fixes and features.
Warnings
- breaking Dropped support for Python versions 3.6 and 3.7
- gotcha Ensure objects being pickled are supported by cloudpickle or face serialization errors.
Install
-
pip install cloudpickle
Imports
- cloudpickle
import cloudpickle
Quickstart
import cloudpickle
import os
model = {'name': 'example_model'}
# Serialize
serialized_model = cloudpickle.dumps(model)
# Deserialize
loaded_model = cloudpickle.loads(serialized_model)
print(loaded_model)