converting-pytorch-to-litert
Skill1.1k starsChanged 3 years agoApache-2.0View on GitHub
Converts PyTorch models (e.g. ResNet, timm, HuggingFace transformers) directly to LiteRT (.tflite) flatbuffer format. Use when converting PyTorch models to TFLite, setting up export environments, or troubleshooting torch-to-litert conversion bugs. Don't use for ONNX exports or converting existing TensorFlow models.
- Installs packages
1 other project uses a version of this.
Trending
Quiet since July.about the whole repository
Most recently taken up by
- google-ai-edge/litert-torchword for word, first seen Oct 8, 2026
Who's talking about google-ai-edge/ai-edge-torch
- Samsung/ONE“[circle-mlir] tflite test models from ai-edge-torch”GitHub · Sep 30, 2025 · 1 reactions
- google-ai-edge/mediapipe“Direct download of Phi-3/3.5 task on Kaggle”GitHub · Oct 16, 2024 · 1 reactions
- Stack Overflow“Model size is smaller in .onnx format than in .tflite format”Stack Overflow · Aug 5, 2024 · 1 votes
- google-ai-edge/litert-torch“Add gemma4 case to build_llm_metadata model type dispatch”GitHub · Jul 8, 2026
- wannaphong/llm2litertlm“Add HuggingFace to LiteRT LM conversion script with .litertlm support”GitHub · Jan 20, 2026
The biggest 5 of 31 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 31
Talked about on GitHub and Stack Overflow (31 times).
On GitHub · 28
- Sep 30, 2025[circle-mlir] tflite test models from ai-edge-torch — Samsung/ONE1 reaction · 10 comments
- Oct 16, 2024Direct download of Phi-3/3.5 task on Kaggle — google-ai-edge/mediapipe1 reaction · 4 comments
- Jul 8, 2026Add gemma4 case to build_llm_metadata model type dispatch — google-ai-edge/litert-torch0 reactions · 2 comments
- Jan 20, 2026Add HuggingFace to LiteRT LM conversion script with .litertlm support — wannaphong/llm2litertlm0 reactions · 2 comments
- Dec 22, 2025Update declared license for maven:aicore 0.0.1-exp02 — clearlydefined/curated-data0 reactions · 2 comments
23 more on GitHub
- Nov 30, 2025Clarification on Gemma 3N support and request for conversion example — google-ai-edge/litert-torch0 reactions · 2 comments
- Jul 17, 2025Basic example not working — google-ai-edge/litert-torch0 reactions · 6 comments
- Feb 27, 2025Issue in converting a Fine Tuned Bert model for NER — google-ai-edge/litert-torch0 reactions · 4 comments
- Feb 5, 2025t5 conversion example error — google-ai-edge/litert-torch0 reactions · 7 comments
- Dec 24, 2024Master issue: LLM Benchmark — mlcommons/mobile_app_opensays it tested it0 reactions · 64 comments
- Nov 28, 2024Convolution operator not marked as quantizable when `padding` is defined in the class instantiation — google-ai-edge/litert-torch0 reactions · 3 comments
- Nov 26, 2024TF_SelectV2Op gets legalized to TFL_SelectOp — google-ai-edge/litert-torch0 reactions · 2 comments
- Nov 20, 2024Fix bad comments — google-ai-edge/litert-torch0 reactions
- Nov 20, 2024fix weird group norm lowering — google-ai-edge/litert-torch0 reactions
- Nov 19, 2024Dynamic Update Slice as a Torch Custom Op. — google-ai-edge/litert-torch0 reactions
- Nov 1, 2024set PJRT_DEVICE before loading torch_xla — google-ai-edge/litert-torch0 reactions
- Oct 4, 2024Getting an error while generating quantized tiny llama model due to AI-edge-quantizer — google-ai-edge/ai-edge-quantizer0 reactions
- Sep 24, 2024fix text_generator_main inference error — google-ai-edge/litert-torch0 reactions · 1 comment
- Sep 6, 2024Optimize Memory Usage by Using Exported Program Instead of PyTorch Module in Converter Signature — google-ai-edge/litert-torch0 reactions
- Sep 5, 2024OOM Error in Gemini 2 2B TFLite Conversion with Quantization on 80GB RAM — google-ai-edge/litert-torch0 reactions · 7 comments
- Aug 28, 2024Tiny-llama Encountered unresolved custom op: odml.update_kv_cache — google-ai-edge/litert-torch0 reactions · 9 comments
- Aug 8, 2024quant_config Dtype INT16 support request — google-ai-edge/litert-torch0 reactions · 3 comments
- Aug 1, 2024Explicit head_dim configuration — google-ai-edge/litert-torch0 reactions
- Aug 1, 2024Format source with new rules — google-ai-edge/litert-torch0 reactions
- Jul 2, 2024Fix torch requirement — google-ai-edge/litert-torch0 reactions
- Jun 10, 2024Phi3 conversion OOM on A100 — google-ai-edge/litert-torch0 reactions · 13 comments
- May 25, 2024remove trailing comment in workflow files — google-ai-edge/litert-torch0 reactions · 1 comment
- May 18, 2024skip venv, .downloads and third_party with isort and pyink. — google-ai-edge/litert-torch0 reactions
On Stack Overflow · 3
- Aug 5, 2024Model size is smaller in .onnx format than in .tflite format1 vote
- Jul 1, 2024tensorflow lite conversion for LSTM Model0 votes
- Jul 1, 2024Converting ONNX model to Tensorflow Lite - pytorch_half_pixel not supported0 votes
Other versions1 project uses a version of this.
Word for word · 1
- google-ai-edge/litert-torch★ 1.1k100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
ATTENTION ALL AGENTS: If you are tasked with converting a PyTorch model (e.g., ResNet or similar architectures) to a .tflite flatbuffer …
- Very specific: line 18
Use the litert-torch library for the direct PyTorch to TFLite conversion.
- Very specific: line 25
Before running any conversion script, ensure the following are installed in your python3.11 environment:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PyTorch to LiteRT Conversion Guide
ATTENTION ALL AGENTS: If you are tasked with converting a PyTorch model (e.g., ResNet or similar architectures) to a .tflite flatbuffer format in this repository, you must strictly follow these rules based on recent project findings:
1. Direct Conversion Only (No ONNX)
Bypass ONNX entirely. Do not attempt to export the model to ONNX or use onnx2tf. Convert directly from PyTorch to LiteRT.
2. Use litert-torch
Use the litert-torch library for the direct PyTorch to TFLite conversion. Note that ai-edge-torch is deprecated and has been officially renamed to litert-torch.
3. Strict Python Environment Rules
- Do NOT use Python 3.14. It currently has compatibility issues with typing in
torchao(AttributeError: 'typing.Union' object has no attribute '__module__'). - Use Python 3.11 (e.g.,
python3.11) as it is highly recommended for stability and avoids the aforementioned type hint bugs.
4. Dependencies
Before running any conversion script, ensure the following are installed in your python3.11 environment:
python3.11 -m pip install torch transformers timm litert-torch ai-edge-litert litert-cli-nightlyDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

