Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.9 support #6

Closed
fgervais opened this issue Dec 4, 2020 · 8 comments
Closed

Python 3.9 support #6

fgervais opened this issue Dec 4, 2020 · 8 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@fgervais
Copy link

fgervais commented Dec 4, 2020

I'd like to try and build tflite_runtime myself for python 3.9.

Any guidelines on how I would go about doing that?

@Namburger
Copy link

Hello @fgervais
You'd have to create a target for python3.9 and build from here as we don't have supports for 3.9 at this time:
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/tools/pip_package

Also, make sure that you checked out this commit of tensorflow before building it!

@Namburger Namburger added enhancement New feature or request question Further information is requested labels Dec 4, 2020
@fgervais
Copy link
Author

fgervais commented Dec 8, 2020

I want to report my progress as it seems I might have a working milestone.

What I did is I went in there:

https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/tools/pip_package

at current tensorflow master (5453cf0b1c8359c0ee6afef8393b350c832a9123)

Then I commented out the python2 stuff as it doesn't seem to be packaged for newer debian version:

diff --git a/tensorflow/lite/tools/pip_package/Dockerfile b/tensorflow/lite/tools/pip_package/Dockerfile
index 834fe5efca7..cc8c22acf89 100644
--- a/tensorflow/lite/tools/pip_package/Dockerfile
+++ b/tensorflow/lite/tools/pip_package/Dockerfile
@@ -10,15 +10,15 @@ RUN apt-get update && \
     apt-get install -y \
       debhelper \
       dh-python \
-      python-all \
-      python-setuptools \
-      python-wheel \
-      python-numpy \
-      python-pip \
+      # python-all \
+      # python-setuptools \
+      # python-wheel \
+      # python-numpy \
+      # python-pip \
       pybind11-dev \
-      libpython-dev \
-      libpython-dev:armhf \
-      libpython-dev:arm64 \
+      # libpython-dev \
+      # libpython-dev:armhf \
+      # libpython-dev:arm64 \
       python3-all \
       python3-setuptools \
       python3-wheel \

Then I built using bullseye as base as it comes with python 3.9.0-4

cd tensorflow/tensorflow/lite/tools/pip_package
make BASE_IMAGE=debian:bullseye PYTHON=python3 TENSORFLOW_TARGET=aarch64 docker-build

For now it seems to work:

root@buildroot:~# pip install /tflite_runtime-2.5.0-cp39-cp39-linux_aarch64.whl 
Processing /tflite_runtime-2.5.0-cp39-cp39-linux_aarch64.whl
Requirement already satisfied: numpy>=1.16.0 in /usr/lib/python3.9/site-packages (from tflite-runtime==2.5.0) (1.18.2)
Installing collected packages: tflite-runtime
Successfully installed tflite-runtime-2.5.0
root@buildroot:~# python
Python 3.9.0 (default, Dec  8 2020, 17:05:44) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tflite_runtime.interpreter as tflite
>>> 

@Namburger
Copy link

Nice!!!!

@fgervais
Copy link
Author

fgervais commented Dec 11, 2020

I tested the package I built on an M.2 edgetpu module and it does inference fine.

Should I close this issue or do we leave it open until official support for python 3.9?

root@edgetpu-service:/subvolumes/google-coral-tflite/python/examples/classification# python3 classify_image.py --model models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --labels models/inat_bird_labels.txt --input images/parrot.jpg
----INFERENCE TIME----
Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory.
12.4ms
2.4ms
2.4ms
2.4ms
2.4ms
-------RESULTS--------
Ara macao (Scarlet Macaw): 0.77734
root@edgetpu-service:/subvolumes/google-coral-tflite/python/examples/classification# python3 --version
Python 3.9.0

@Namburger
Copy link

@fgervais yes, please keep it open until we have an official package, thanks!

@thekazak
Copy link

thekazak commented Jan 2, 2021

@fgervais it helps build install tensorflow/lite with python 3.9
but what about pycoral? I need it on python 3.9 together with tensorflow lite

@fgervais
Copy link
Author

fgervais commented Jan 2, 2021

Humm I'm not sure, I haven't used pycoral for my inferences.

@dmitriykovalev
Copy link
Member

We have Python 3.9 wheels now, please check releases page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants