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

Uploaded Source

Built Distribution

serialzy-1.3.0-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for serialzy-1.3.0.tar.gz
Algorithm Hash digest
SHA256 6642fabebdc56fa5cf2669c9107e6453250a27b8c5d18de6ee65929d1e591a6e
MD5 2627c66644e992d6d42241bf230d4424
BLAKE2b-256 80b3f34f7f69a088e6200350457d5edde724d6366e2e5a8dbc1e0ca834df894b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: serialzy-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 25.6 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fec5597a2dea46fbf3b1d867ccffd83eb64add5ee04df556c3343b0b57938ff1
MD5 c5d5243969586e520a710e6e29a23ff9
BLAKE2b-256 e16aa4da0b5a0c892bf2676bdb713c014f8c142b62476e7a6ec7e6f95b57d0ec

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