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.2.1.tar.gz
(16.6 kB
view details)
Built Distribution
serialzy-1.2.1-py3-none-any.whl
(24.5 kB
view details)
File details
Details for the file serialzy-1.2.1.tar.gz
.
File metadata
- Download URL: serialzy-1.2.1.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0d90cd250a52e2a62e5428bf5c89c80c84c2be6335852765936411deeb38c46 |
|
MD5 | b53aeff825ee6a1d650a715bc0cd3d9f |
|
BLAKE2b-256 | b4746d28d7dac26922659a2e8d20d8faf2a019474adc7b00f25bd83e4ce7668e |
File details
Details for the file serialzy-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: serialzy-1.2.1-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aff9be59046afac019c64af4c940d1d099808c6ee1ef0c00e9552d579af935e |
|
MD5 | 76708f15a91f5390b4e84c7a77b41d93 |
|
BLAKE2b-256 | dd611c8e830f49c066bbe1107c4e43bfef092c13161b8229732d37c14b1598f3 |