Skip to main content

No project description provided

Project description

Pypi version Tests Python tests coverage PyPI - Python Version

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


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.4.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

serialzy-1.4.0-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file serialzy-1.4.0.tar.gz.

File metadata

  • Download URL: serialzy-1.4.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for serialzy-1.4.0.tar.gz
Algorithm Hash digest
SHA256 8dcde1a824b9c904d8de55d2032459821345e4a7aa197f70ffa15070341f8bb2
MD5 5256b3c937cb02eae8c70933a266a92b
BLAKE2b-256 54353da3dd8b0d805b59fe41c6cd5f68e81b516aa8880e1aebefd5a4bb332a15

See more details on using hashes here.

File details

Details for the file serialzy-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: serialzy-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 26.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for serialzy-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c39bdc5d7d15df551f1caa15714807ff5e6d5363a5b053d7cb4ba53d5e9c60c5
MD5 b696a2cbe4a5f94c3c1d6e3584ce7314
BLAKE2b-256 26de0aab39a338b8f9e6836149f569ac7f50e9edf4644d697d3afd17a747d035

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page