diff --git a/tensorflow/lite/g3doc/guide/python.md b/tensorflow/lite/g3doc/guide/python.md index ed902d865ba..54d39c4f522 100644 --- a/tensorflow/lite/g3doc/guide/python.md +++ b/tensorflow/lite/g3doc/guide/python.md @@ -10,148 +10,52 @@ just a few minutes. All you need is a TensorFlow model [converted to TensorFlow Lite](../convert/). (If you don't have a model converted yet, you can experiment using the model provided with the example linked below.) -## Install just the TensorFlow Lite interpreter +## About the TensorFlow Lite runtime package -To quickly run TensorFlow Lite models with Python, you can install just the -TensorFlow Lite interpreter, instead of all TensorFlow packages. +To quickly start executing TensorFlow Lite models with Python, you can install +just the TensorFlow Lite interpreter, instead of all TensorFlow packages. We +call this simplified Python package `tflite_runtime`. -This interpreter-only package is a fraction the size of the full TensorFlow +The `tflite_runtime` package is a fraction the size of the full `tensorflow` package and includes the bare minimum code required to run inferences with -TensorFlow Lite—it includes only the -[`tf.lite.Interpreter`](https://www.tensorflow.org/api_docs/python/tf/lite/Interpreter) +TensorFlow Lite—primarily the +[`Interpreter`](https://www.tensorflow.org/api_docs/python/tf/lite/Interpreter) Python class. This small package is ideal when all you want to do is execute `.tflite` models and avoid wasting disk space with the large TensorFlow library. -Note: If you need access to other Python APIs, such as the [TensorFlow Lite -Converter](../convert/python_api.md), you must install the [full TensorFlow -package](https://www.tensorflow.org/install/). +Note: If you need access to other Python APIs, such as the +[TensorFlow Lite Converter](../convert/), you must install the +[full TensorFlow package](https://www.tensorflow.org/install/). -To install, run `pip3 install` and pass it the appropriate Python wheel URL from -the following table. +## Install TensorFlow Lite for Python -For example, if you have a Raspberry Pi that's running Raspberry Pi OS 10 (which -has Python 3.7), install the Python wheel as follows: +To install the TensorFlow Lite runtime package, run this command: + +
+pip3 install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime ++ +If you're on a Raspberry Pi, this command might fail due to a known issue with +the `extra-index-url` option +([#4011](https://github.com/raspberrypi/linux/issues/4011)). So we suggest you +specify one of the +[`tflite_runtime` wheels](https://github.com/google-coral/pycoral/releases/) +that matches your system. For example, if you're running Raspberry Pi OS 10 +(which has Python 3.7), instead use this command:
pip3 install https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_armv7l.whl-
Platform | Python | URL |
---|---|---|
Linux (ARM 32) | -3.5 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp35-cp35m-linux_armv7l.whl | -
3.6 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp36-cp36m-linux_armv7l.whl | -|
3.7 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_armv7l.whl | -|
3.8 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp38-cp38-linux_armv7l.whl | -|
Linux (ARM 64) | -3.5 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp35-cp35m-linux_aarch64.whl | -
3.6 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp36-cp36m-linux_aarch64.whl | -|
3.7 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_aarch64.whl | -|
3.8 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp38-cp38-linux_aarch64.whl | -|
Linux (x86-64) | -3.5 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp35-cp35m-linux_x86_64.whl | -
3.6 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp36-cp36m-linux_x86_64.whl | -|
3.7 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_x86_64.whl | -|
3.8 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp38-cp38-linux_x86_64.whl | -|
macOS 10.15 | -3.5 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp35-cp35m-macosx_10_15_x86_64.whl | -
3.6 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp36-cp36m-macosx_10_15_x86_64.whl | -|
3.7 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-macosx_10_15_x86_64.whl | -|
3.8 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp38-cp38-macosx_10_15_x86_64.whl | -|
Windows 10 | -3.5 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp35-cp35m-win_amd64.whl | -
3.6 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp36-cp36m-win_amd64.whl | -|
3.7 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-win_amd64.whl | -|
3.8 | -https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp38-cp38-win_amd64.whl | -