litert-torch
Support PyTorch model conversion with LiteRT.
What it is and what it does
LiteRT Torch bridges PyTorch and on-device deployment by converting trained PyTorch models into LiteRT's .tflite format. The library integrates with torch.export() to capture models, then serializes them for execution on mobile and IoT hardware. It provides two main workflows: a PyTorch Converter (Beta) for general model conversion, and a Generative API (Alpha) specialized for transformer-based models and large language models with quantization support.
The package targets developers building edge ML applications where models must run entirely on-device without cloud connectivity. It handles the conversion pipeline and offers initial support for CPU, GPU, and NPU execution. With 19 runtime dependencies including torch, transformers, jax, and tf-nightly, it brings a substantial environment; deployment of the converted .tflite files themselves requires the separate LiteRT runtime.
Use it for:
- Convert a trained vision model to .tflite for inference on Android or iOS devices
- Quantize and optimize a transformer-based LLM for on-device deployment using the Generative API
- Export a PyTorch model for IoT edge devices that cannot reach cloud inference services
- Package a converted model and tokenizer into a .litertlm container for production mobile deployment
- Benchmark model performance on target hardware using LiteRT's compiled model API after conversion
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts PyTorch models to .tflite format for on-device deployment on Android, iOS, and IoT devices via LiteRT, with CPU coverage and initial GPU and NPU support.
Yes, if you are converting PyTorch models for on-device deployment and targeting Android, iOS, or IoT. The library is actively maintained, has low install friction, and offers both general and LLM-specific conversion paths. Conditions: requires Python 3.10 through 3.13 (3.11 recommended), Linux, and a large dependency footprint; the Generative API is Alpha, so production LLM workflows should expect iteration.
Install
litert-torch on PyPI
pip
pip install litert-torchuv
uv add litert-torchpoetry
poetry add litert-torchInstalling litert-torch
Before you install
Low friction; pure Python wheel. Active maintenance with release 10 days old and recent commits. However, 19 runtime dependencies including torch, transformers, jax, and tf-nightly create a substantial environment footprint.
License in practice
Permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install litert-torch
import torch
import litert_torch
model = torch.nn.Linear(10, 2)
with torch.no_grad():
sample_inputs = (torch.randn(1, 10),)
edge_model = litert_torch.convert(model.eval(), sample_inputs)
edge_model.export("model.tflite")
Python >=3.10 and <3.14 required; Python 3.11 highly recommended. Linux only. Requires PyTorch >=2.4.0 and tf-nightly.
Verify before relying
- Specific coverage of Core ATen operators and which PyTorch operations are unsupported in conversion
- Performance benchmarks or latency comparisons for converted models on target devices
- Quantization support details beyond the mention of Generative API quantization
- Whether GPU/NPU support is production-ready or experimental
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 19 — absl-py, numpy, scipy, safetensors, multipledispatch, transformers, kagglehub, tabulate, torch, ai-edge-litert, ai-edge-quantizer, litert-converter, torchao, jax, jaxtyping, fire, sentencepiece, rich, litert-lm-builder |
| Maintenance | actively maintained — 10 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 166,622/month — #10,487 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: litert_torch-0.9.3-py3-none-any.whl
Keywords: On-Device ML, AI, Google, TFLite, LiteRT, PyTorch, LLMs, GenAI
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
ai-edge-litertai-edge-litert runs machine learning models on…
permissive · top 15,000 on PyPI
onnx2tfConverts ONNX model files to LiteRT,…
permissive · top 5,000 on PyPI
litert-converterConverts machine learning models to LiteRT…
permissive · top 15,000 on PyPI
litert-lm-builderProvides Python tools for building, inspecting,…
permissive · top 15,000 on PyPI
ai-edge-litert-nightlyLiteRT is a runtime for running trained machine…
permissive · top 15,000 on PyPI
tflite-runtimeTensorFlow Lite runtime enables on-device…
permissive · top 15,000 on PyPI
pnnxExports and converts PyTorch neural network…
permissive · top 15,000 on PyPI
ai-edge-quantizerQuantizes LiteRT models to reduce size and…
permissive · top 15,000 on PyPI
executorchExecuTorch exports and runs PyTorch models on…
permissive · top 15,000 on PyPI
pte-adapter-model-explorerExtends Model Explorer with visualization…
permissive · top 15,000 on PyPI