skillfed

onnx2tf

A tool for converting ONNX files to LiteRT/TFLite/TensorFlow, PyTorch native code (nn.Module), TorchScript (.pt), state_dict (.pt), Exported Program (.pt2), and Dynamo ONNX. It also supports direct conversion from LiteRT to PyTorch.

onnx2tf v2.6.8 1.6M downloads/30d#3,706 on PyPI987
Permissive license MIT Active released

What it is and what it does

onnx2tf is a model format converter that takes ONNX (Open Neural Network Exchange) files and translates them into multiple target frameworks: LiteRT (Google's edge ML runtime), TensorFlow/TFLite, PyTorch (as native nn.Module code or TorchScript), and other formats. It also works in reverse, converting LiteRT models back to PyTorch. The package uses two execution paths: flatbuffer_direct (the current default, optimized for speed and success rate) and tf_converter (a legacy path supporting a large set of ONNX operators). The tool is designed for developers who need to move trained models between frameworks—for instance, to deploy a PyTorch model on mobile via TFLite, or to run a TensorFlow model in PyTorch training pipelines.

The package depends on 18 runtime libraries covering ONNX tooling (onnx, onnxruntime, onnxsim, onnxoptimizer, onnxscript), ML frameworks (ai-edge-litert, flatbuffers), and utilities (numpy, opencv-python, protobuf, h5py). It requires Python 3.12 or later and is actively maintained. The conversion success depends on whether your model's layers are in the supported operator list; the documentation lists hundreds of ONNX operators with full or partial support status.

Use it for:

  • Deploy a PyTorch model to mobile/edge devices by converting to LiteRT or TFLite format.
  • Migrate a trained TensorFlow model to PyTorch for retraining or fine-tuning in a different framework.
  • Convert ONNX models (from any framework) to TensorFlow for production serving.
  • Optimize and simplify ONNX graphs before deployment using the built-in simplification and optimization tools.
  • Export PyTorch models through ONNX as an intermediate step to reach non-PyTorch runtimes.
  • Validate model compatibility across frameworks by round-tripping through ONNX and LiteRT.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Converts ONNX model files to LiteRT, TensorFlow, PyTorch, TorchScript, and other formats, with support for direct conversion from LiteRT back to PyTorch.

Yes, if you need to convert ONNX models to LiteRT, TensorFlow, or PyTorch. The package is actively maintained, has low install friction, and covers a broad set of ONNX operators. Check the supported operator list against your model's layers first—partial or missing support for specific ops may require workarounds. MIT license poses no restrictions. Not necessary if you work exclusively within one framework.

Install

onnx2tf on PyPI

pip

pip install onnx2tf

uv

uv add onnx2tf

poetry

poetry add onnx2tf

Installing onnx2tf

Before you install

Low install friction with a pure Python wheel. Active maintenance—last commit 2026-08-01, 13 days old. Requires Python 3.12 or later. Pulls in 18 runtime dependencies including numpy, onnx, onnxruntime, and TensorFlow-adjacent libraries (ai-edge-litert, flatbuffers); dependency chain is substantial but standard for ML tooling.

License in practice

MIT license (permissive). No restrictions on commercial or proprietary use; you may use, modify, and distribute this package with minimal obligations.

Quickstart

pip install onnx2tf

from onnx2tf import onnx2tf
# Convert ONNX to LiteRT (default backend)
onnx2tf.convert(onnx_model_path='model.onnx', output_dir='./output')

Requires Python 3.12 or later. Conversion success depends on whether your ONNX model's layers are supported by the target backend (tf_converter or flatbuffer_direct).

Verify before relying

  • Exact list of PyTorch export formats (nn.Module, TorchScript, state_dict, Exported Program, Dynamo ONNX) and their completeness/stability.
  • Performance characteristics and conversion time for typical model sizes.
  • Handling of unsupported ONNX operators and error recovery behavior.
  • Whether flatbuffer_direct backend covers all use cases or if tf_converter fallback is still needed.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.12)
Install friction low — pure-Python wheel
Runtime dependencies 18 — numpy, onnx, onnxruntime, opencv-python, onnxsim, onnxoptimizer, onnxscript, ai-edge-litert, sne4onnx, sng4onnx, psutil, protobuf, h5py, ml-dtypes, setuptools, flatbuffers, tqdm, pytest
Maintenance actively maintained — 13 days since the last release
Last repo commit
First released
Downloads 1,629,877/month — #3,706 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: onnx2tf-2.6.8-py3-none-any.whl

Keywords: onnx, tensorflow, tflite, litert, keras, pytorch, deep-learning, machine-learning

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: Python :: 3Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Scientific/Engineering :: Artificial Intelligence

Tags

onnx to tensorflow conversiononnx to litert converteronnx to pytorch exportmodel format conversion toolonnx to tflite converterdeep learning model conversionneural network format translator
model-conversionml-deploymentedge-inference

More Artificial Intelligence packages