Skip to main content

Converter of Deep Learning Model Formats

Project description

Deeplite Model Converter

Collaboration is one of the biggest challenge is designing deep learning based solutions. There are multiple formats available using which a deep learning mdoel can be expressed: PyTorch, Tensorflow, ONNX, TFLite. This open source converter library aims to convert convert deep learning models from one format to another.

Install using pip

Use following command to install the package from our internal PyPI repository.

$ pip install --upgrade pip
$ pip install deeplite-model-converter

Install from source

$ git clone https://github.com/Deeplite/deeplite-model-converter.git
$ pip install .

Install in Dev mode

$ git clone https://github.com/Deeplite/deeplite-model-converter.git
$ pip install -e .
$ pip install -r requirements-test.txt

To test the installation, one can run the basic tests using pytest command in the root folder.

NOTE: Currently, we support Tensorflow 2.4+ versions, and onnxruntime 1.8. We do not support all the OPSET versions of ONNX, yet.

How to Use

PyTorch2ONNX

# Step 1: Define native pytorch dataloaders and model
data_splits = /* ... load iterable data loaders ... */
model = /* ... load native deep learning model ... */

# Step 2: Instantiate a converter object
pytorch2onnx = PyTorch2ONNX(model=model)
pytorch2onnx.set_config(precision='fp32', device=Device.CPU)

# Step 3: Convert the format and save
dataloader = TorchProfiler.enable_forward_pass_data_splits(data_splits)
rval = pytorch2onnx.convert(dataloader, dynamic_input='bchw', path="model.onnx")

TF2TFLite

# Step 1: Define native Tensorflow model
model_conc_functions = /* ... load TF native model as concrete functions ... */

# Step 2: Instantiate a converter object
tf2tflite = TF2TFLite(model=model_conc_functions)

# Step 3: Convert the format and save
tflite_model, rval = tf2tflite.convert()
tf2tflite.save(tflite_model, "model.tflite")

Examples

To run an example,

pip install deeplite-torch-zoo
python examples/converters/pytorch2tflite.py

Supported Converters

The following converters are supported till now,

  • pytorch2onnx
  • pytorch2jit
  • onnx2tf
  • tf2tflite

Contribute a Converter

We always welcome community contributions to expand the scope of deeplite-model-converter and also to have additional new converters. In general, we follow the fork-and-pull Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull request so that we can review your changes

NOTE: Be sure to merge the latest from "upstream" before making a pull request!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

deeplite_model_converter-1.2.4-cp39-cp39-manylinux2010_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

deeplite_model_converter-1.2.4-cp38-cp38-manylinux2010_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

deeplite_model_converter-1.2.4-cp37-cp37m-manylinux2010_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

deeplite_model_converter-1.2.4-cp36-cp36m-manylinux2010_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

File details

Details for the file deeplite_model_converter-1.2.4-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for deeplite_model_converter-1.2.4-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 03fd060d9e7169ba40d96a9de76fc5dd8a3dc18e56843d72f784bcb599a8bc92
MD5 ed9610ac5904643ecf2a894c6b393468
BLAKE2b-256 baa341e2d7ab01d391b22e22d66d059853f7e118d5a98cfbbee7c694275e7469

See more details on using hashes here.

File details

Details for the file deeplite_model_converter-1.2.4-cp39-cp39-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for deeplite_model_converter-1.2.4-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b6223bdcc18c3b2d596aad9fcc96230d331f48204414ad4c07f239ab0285d1ec
MD5 f59167415844b52ef0eb808e3c5dc694
BLAKE2b-256 f9f4be15e81dd56840e319fc24174d321827f4449fb15bfcd06d884fd3cc8ec8

See more details on using hashes here.

File details

Details for the file deeplite_model_converter-1.2.4-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for deeplite_model_converter-1.2.4-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 82cb87dcd028bf78fd7216ad4c12eb4d7c100a2975173dc05ae7c791e0727808
MD5 e71467cbd95f1a2a5a5570cb8726cb31
BLAKE2b-256 1fe41d12108942b2c4ab35c0fd739424c73cb02399b9fb4b83afea571b9992f2

See more details on using hashes here.

File details

Details for the file deeplite_model_converter-1.2.4-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for deeplite_model_converter-1.2.4-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4d56a688610f0ef00537b4593ccdd873995f6ce7d38e443a025ffeb7ee8d5a72
MD5 ba0889e57c7a5b886da1b6d8c865ef50
BLAKE2b-256 d12208ab5faa7cdaa9741789440c8917172433902a4055b212aba724dc302b22

See more details on using hashes here.

File details

Details for the file deeplite_model_converter-1.2.4-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for deeplite_model_converter-1.2.4-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 613120aad371fcdfba8945e2e1c8c731d4e8b34bf451cb2a991e179f5132714d
MD5 65ada049897fdc87e161f4be64a15b09
BLAKE2b-256 25290dc850d44519c580f9f5a2c931e3e8cf8cb62d4eee4d0ac412e388cca7ed

See more details on using hashes here.

File details

Details for the file deeplite_model_converter-1.2.4-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for deeplite_model_converter-1.2.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e00ecc834569552f8e227450a3b9645a259e2af7932def3dc1c4b92da2aadd2d
MD5 ed055cc702e9a48c0315b720ed5843d2
BLAKE2b-256 735142442b0b83b399766235073b886ad86ade237ea4c2424fc7b33fb3499250

See more details on using hashes here.

File details

Details for the file deeplite_model_converter-1.2.4-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: deeplite_model_converter-1.2.4-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.7

File hashes

Hashes for deeplite_model_converter-1.2.4-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 95f76dfc2f7787634a84dace38df1ba620922915dfe001d426477bc83e785d6e
MD5 a210a35e3ff44c6ae9d7953a7e504121
BLAKE2b-256 54f0b4c59bae3726009529ee19b676e30dc8a1c7c9440ec5b2c995e906bdd13d

See more details on using hashes here.

File details

Details for the file deeplite_model_converter-1.2.4-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: deeplite_model_converter-1.2.4-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.7

File hashes

Hashes for deeplite_model_converter-1.2.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 44f9ed385d6670d77dfb3e1fe660aff613fb5ba36a6b3e3056771eca1d96810a
MD5 5e6c4bcbc943ec1556739c85e3227448
BLAKE2b-256 117afebf00b22840f3af12b846d19f6fa872f97dabe2d707da75f2ad21028d82

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