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

Uploaded Source

Built Distribution

serialzy-1.1.2-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for serialzy-1.1.2.tar.gz
Algorithm Hash digest
SHA256 883e4c9fdab59e31cb5cf2dc9a1ce5435cdb80ba9547b8935c44fedd05448000
MD5 53537b9fd9bf8f8a6bea13e2dd27f81e
BLAKE2b-256 76aac0dc91e0284014eb0410dd98f1c30aa8c66caab517efe7cd44367927bd79

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for serialzy-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 44cc35249b091d720d82ce953f94287d4638b7b2edc24147a1184e83f29fb084
MD5 78c6f2de56be3765a0c68ff079b40942
BLAKE2b-256 ea7b2a0cdb768723366b36b0d826a6f238b95940e3c3e6c9194236aa0a283c79

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