Introducing Google AI Edge Portal: Benchmark Edge AI at scale. Sign-up to request access during private preview.

Migrate to LiteRT from TensorFlow Lite

All new development for Google's high-performance runtime for on-device AI will be exclusively on LiteRT. Applications that use TensorFlow Lite packages will continue to function, but all new updates will only be included in LiteRT packages. The LiteRT APIs contain the same method names as the TF Lite APIs, so migrating to LiteRT does not require detailed code changes.

For package name changes, see the following migration guides for specific platforms.

Migrate with Android

To migrate an Android application using Tensorflow Lite, replace the dependency from org.tensorflow:tensorflow-lite to com.google.ai.edge.litert. The LiteRT Maven repository includes the following packages:

You can make this change in your build.gradle dependencies:

dependencies{
...
implementation`com.google.ai.edge.litert:litert:1.4.1`
}

Play Services

LiteRT in the Play Services runtime continues to use the play-services-tflite dependency. If your app is already using the Play Services runtime with TensorFlow Lite, you don't need to make any code changes.

To use LiteRT in Play Services, add the following to your build.gradle dependencies:

dependencies{
...
// LiteRT dependencies for Google Play services
implementation'com.google.android.gms:play-services-tflite-java:16.4.0'
// Optional: include LiteRT Support Library
implementation'com.google.android.gms:play-services-tflite-support:16.4.0'
...
}

Migrate with Python

To migrate Python code using Tensorflow Lite, replace the PIP package from tflite-runtime to ai-edge-litert.

Install LiteRT with PIP:

$ python3 -m pip install ai-edge-litert

Import LiteRT with the following:

fromai_edge_litert.interpreterimport Interpreter
interpreter = Interpreter(model_path=args.model_file)

Other Libraries

The Swift and Objective-C SDKs for iOS, C++ SDK, Task Library, and Model Maker library continues to exist in the TensorFlow Lite APIs. Applications using these SDKs or libraries shouldn't migrate to LiteRT.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年12月21日 UTC.