Skip to main content

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!

Metadata

Release files for deeplite-model-converter 1.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for deeplite-model-converter 1.2.4
File Actions
deeplite_model_converter-1.2.4-cp39-cp39-manylinux2010_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.12+ x86-64 Details for deeplite_model_converter-1.2.4-cp39-cp39-manylinux2010_x86_64.whl
deeplite_model_converter-1.2.4-cp39-cp39-manylinux1_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.5+ x86-64 Details for deeplite_model_converter-1.2.4-cp39-cp39-manylinux1_x86_64.whl
deeplite_model_converter-1.2.4-cp38-cp38-manylinux2010_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.12+ x86-64 Details for deeplite_model_converter-1.2.4-cp38-cp38-manylinux2010_x86_64.whl
deeplite_model_converter-1.2.4-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details for deeplite_model_converter-1.2.4-cp38-cp38-manylinux1_x86_64.whl
deeplite_model_converter-1.2.4-cp37-cp37m-manylinux2010_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 Details for deeplite_model_converter-1.2.4-cp37-cp37m-manylinux2010_x86_64.whl
deeplite_model_converter-1.2.4-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details for deeplite_model_converter-1.2.4-cp37-cp37m-manylinux1_x86_64.whl
deeplite_model_converter-1.2.4-cp36-cp36m-manylinux2010_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64 Details for deeplite_model_converter-1.2.4-cp36-cp36m-manylinux2010_x86_64.whl
deeplite_model_converter-1.2.4-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details for deeplite_model_converter-1.2.4-cp36-cp36m-manylinux1_x86_64.whl

Total release size: 10.0 MB

Release files / deeplite_model_converter-1.2.4-cp39-cp39-manylinux2010_x86_64.whl

Download URL deeplite_model_converter-1.2.4-cp39-cp39-manylinux2010_x86_64.whl
Size 1.3 MB
Tags CPython 3.9 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
03fd060d9e7169ba40d96a9de76fc5dd8a3dc18e56843d72f784bcb599a8bc92
BLAKE2b-256 checksum
How to use checksums
baa341e2d7ab01d391b22e22d66d059853f7e118d5a98cfbbee7c694275e7469
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.6

Release files / deeplite_model_converter-1.2.4-cp39-cp39-manylinux1_x86_64.whl

Download URL deeplite_model_converter-1.2.4-cp39-cp39-manylinux1_x86_64.whl
Size 1.3 MB
Tags CPython 3.9 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
b6223bdcc18c3b2d596aad9fcc96230d331f48204414ad4c07f239ab0285d1ec
BLAKE2b-256 checksum
How to use checksums
f9f4be15e81dd56840e319fc24174d321827f4449fb15bfcd06d884fd3cc8ec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.6

Release files / deeplite_model_converter-1.2.4-cp38-cp38-manylinux2010_x86_64.whl

Download URL deeplite_model_converter-1.2.4-cp38-cp38-manylinux2010_x86_64.whl
Size 1.4 MB
Tags CPython 3.8 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
82cb87dcd028bf78fd7216ad4c12eb4d7c100a2975173dc05ae7c791e0727808
BLAKE2b-256 checksum
How to use checksums
1fe41d12108942b2c4ab35c0fd739424c73cb02399b9fb4b83afea571b9992f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Release files / deeplite_model_converter-1.2.4-cp38-cp38-manylinux1_x86_64.whl

Download URL deeplite_model_converter-1.2.4-cp38-cp38-manylinux1_x86_64.whl
Size 1.4 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
4d56a688610f0ef00537b4593ccdd873995f6ce7d38e443a025ffeb7ee8d5a72
BLAKE2b-256 checksum
How to use checksums
d12208ab5faa7cdaa9741789440c8917172433902a4055b212aba724dc302b22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Release files / deeplite_model_converter-1.2.4-cp37-cp37m-manylinux2010_x86_64.whl

Download URL deeplite_model_converter-1.2.4-cp37-cp37m-manylinux2010_x86_64.whl
Size 1.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
613120aad371fcdfba8945e2e1c8c731d4e8b34bf451cb2a991e179f5132714d
BLAKE2b-256 checksum
How to use checksums
25290dc850d44519c580f9f5a2c931e3e8cf8cb62d4eee4d0ac412e388cca7ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.9

Release files / deeplite_model_converter-1.2.4-cp37-cp37m-manylinux1_x86_64.whl

Download URL deeplite_model_converter-1.2.4-cp37-cp37m-manylinux1_x86_64.whl
Size 1.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
e00ecc834569552f8e227450a3b9645a259e2af7932def3dc1c4b92da2aadd2d
BLAKE2b-256 checksum
How to use checksums
735142442b0b83b399766235073b886ad86ade237ea4c2424fc7b33fb3499250
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.9

Release files / deeplite_model_converter-1.2.4-cp36-cp36m-manylinux2010_x86_64.whl

Download URL deeplite_model_converter-1.2.4-cp36-cp36m-manylinux2010_x86_64.whl
Size 1.2 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
95f76dfc2f7787634a84dace38df1ba620922915dfe001d426477bc83e785d6e
BLAKE2b-256 checksum
How to use checksums
54f0b4c59bae3726009529ee19b676e30dc8a1c7c9440ec5b2c995e906bdd13d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / deeplite_model_converter-1.2.4-cp36-cp36m-manylinux1_x86_64.whl

Download URL deeplite_model_converter-1.2.4-cp36-cp36m-manylinux1_x86_64.whl
Size 1.2 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
44f9ed385d6670d77dfb3e1fe660aff613fb5ba36a6b3e3056771eca1d96810a
BLAKE2b-256 checksum
How to use checksums
117afebf00b22840f3af12b846d19f6fa872f97dabe2d707da75f2ad21028d82
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for deeplite-model-converter 1.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page