Instructions to use litert-community/gemma-4-E2B-it-litert-lm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/gemma-4-E2B-it-litert-lm with LiteRT-LM:
# LiteRT-LM runs on various platforms (Android, iOS, Windows, Linux, macOS, IoT, Web/WASM) # and supports many APIs (C++, Python, Kotlin, Swift, JavaScript, Flutter). # For platform-specific integration guides, please refer to the official developer website: # https://ai.google.dev/edge/litert-lm # To try LiteRT-LM, the easiest way is to use our CLI tool. # 1. Install the LiteRT-LM CLI tool: pip install -U litert-lm # 2. Download and run this model locally: # See: https://ai.google.dev/edge/litert-lm/cli # A single .litertlm file in the repo is picked automatically; otherwise the CLI asks which one to run # (or pass its name right after the repo id). litert-lm run \ --from-huggingface-repo=litert-community/gemma-4-E2B-it-litert-lm \ --prompt="Write me a poem"
- Notebooks
- Google Colab
- Kaggle
NPU support or compilation guidance gemma4 e2b on mediatek npu 780
#50
by Nicepotato01 - opened
Title: Compiling & running Gemma on MediaTek NPU 780 – where do I start?
Hey everyone,
I'm trying to get Gemma running on-device with hardware acceleration on the MediaTek NPU 780 (Dimensity 8300/8350), but I'm fairly new to the MediaTek toolchain and looking for some direction.
I'm aiming to offload as much of the model to the NPU as possible, but I’m a bit lost on the actual compilation and deployment pipeline.
A few questions for anyone who has worked with this NPU:
Which workflow should I use?
- Is it better to go through LiteRT (TFLite) with the NeuroPilot delegate, use ExecuTorch, or compile directly to
.dlausing the standalone NeuroPilot SDK?
- Is it better to go through LiteRT (TFLite) with the NeuroPilot delegate, use ExecuTorch, or compile directly to
Quantization & Support:
- Does NPU 780 handle INT4 weights smoothly for LLMs, or is INT8/FP16 the safer target?
- If some operations aren't supported on the NPU, does it automatically fall back to CPU/GPU, or will the compile step just fail?
KV Cache & Shapes:
- Do I need to compile with fixed, bucketed sequence lengths (like 512, 1024), or does the runtime support dynamic context lengths well?
If anyone has a working example repo, export script, or general pointers to get started, I’d really appreciate the help!
Thanks!