No project description provided
Project description
serialzy
Serialzy is a library for python objects serialization into portable and interoperable data formats (if possible).
Example
Suppose you have a catboost model:
from catboost import CatBoostClassifier
model = CatBoostClassifier()
model.fit(...)
Firstly you should find a proper serializer for the catboost model type or the corresponding data format:
from serialzy.registry import DefaultSerializerRegistry
registry = DefaultSerializerRegistry()
serializer = registry.find_serializer_by_type(type(model)) # registry.find_serializer_by_data_format("cbm")
Serializers have several properties:
serializer.available() # can be used in the current environment
serializer.requirements() # libraries needed to be installed to use this serializer
serializer.stable() # has portable data format
Serializers can provide data format and schema for a type:
serializer.data_format()
serializer.schema(type(model))
Serialization:
with open('model.cbm', 'wb') as file:
serializer.serialize(model, file)
Deserialization:
with open('result', 'rb') as file:
deserialized_obj = serializer.deserialize(file)
List of supported libraries for stable serialization:
Library | Types | Data format |
---|---|---|
Python std lib | int, str, float, bool, None | string representation |
Python std lib | List, Tuple | custom format |
CatBoost | CatBoostRegressor, CatBoostClassifier, CatBoostRanker | cbm |
CatBoost | Pool | quantized pool |
Tensorflow.Keras | Sequential, Model with subclasses | tf_keras |
Tensorflow | Checkpoint, Module with subclasses | tf_pure |
LightGBM | LGBMClassifier, LGBMRegressor, LGBMRanker | lgbm |
XGBoost | XGBClassifier, XGBRegressor, XGBRanker | xgb |
Torch | Module with subclasses | pt |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
serialzy-1.0.0.tar.gz
(15.7 kB
view details)
Built Distribution
serialzy-1.0.0-py3-none-any.whl
(23.1 kB
view details)
File details
Details for the file serialzy-1.0.0.tar.gz
.
File metadata
- Download URL: serialzy-1.0.0.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87c4e64520a1a263a722acbb47586239ef5483ef0626ddb2319d3505b23ee897 |
|
MD5 | 090e1ab206615701f5d49453504d939b |
|
BLAKE2b-256 | b5233731576d608855537bf53b2d2950a4702b95d16a4f49fea45d0fee0ac54c |
File details
Details for the file serialzy-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: serialzy-1.0.0-py3-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99f7df05aca42f711dfad35bafe32c524b0549a2b4d93a39665ac6586f8fa985 |
|
MD5 | d3a2c17dfc73f3487f44507e50ad2cb2 |
|
BLAKE2b-256 | 9913d0135d9098a51e81d44086659de29285726ce9fef1bac6f14c98a233b335 |