I want to use this:
with this:
Find presentations, documentation, sample code, and resources for building macOS, iOS, and tvOS apps with the Metal framework.
Is this possible? I want the brevity/ease of use of tflite-model-maker with the acceleration capabilities of my M1 MacBook Air running macOS 12.0.
I successfully completed the step to install tensorflow-macos, which to my understanding is just a special version of tensorflow 2.5 to take advantage of the M1 hardware acceleration.
Now, when I try to follow the tflite-model-maker example this happens:
I expected an error because in the requirements.txt, tensorflow==2.6.0 is specified (not tensorflow-macos==2.5.0).
Could I just edit that requirements file to specify tensorflow-macos=2.5.0 instead of tensorflow==2.6.0? Or is there an older version of tflite-model-maker that will work with tensorflow-macos==2.5.0?
I assume this is what is also causing the tflite-support dependency problem.
lgusm
August 26, 2021, 11:40am
#3
@Yuqi_Li or @Tian_LIN ight be able to help here
Can you try pip install tflite-model-maker
first and then tensorflow-metal
?
Basically satisfy tflite-model-maker
requirements first, and then use tensorflow-metal
while preserving the tensorflow API.
We didnβt do that before, so are not sure whether it is possible. Please let us know your experience. Good luck!
1 Like
Iβm also struggling:I canβt install tflite-model-maker
on my M1 Mac at all
From a fresh conda
environment (using the Apple Silicon version of Conda through miniforge3) or a Docker python image (dockerfile below), I get:
root@XXXXXXXXXXX:/# pip install tflite-model-maker
Collecting tflite-model-maker
Downloading tflite_model_maker-0.3.4-py3-none-any.whl (616 kB)
|ββββββββββββββββββββββββββββββββ| 616 kB 4.8 MB/s
Collecting flatbuffers==1.12
Downloading flatbuffers-1.12-py2.py3-none-any.whl (15 kB)
Collecting tensorflow-hub<0.13,>=0.7.0
Downloading tensorflow_hub-0.12.0-py2.py3-none-any.whl (108 kB)
|ββββββββββββββββββββββββββββββββ| 108 kB 4.9 MB/s
Collecting lxml>=4.6.1
Downloading lxml-4.6.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (6.6 MB)
|ββββββββββββββββββββββββββββββββ| 6.6 MB 5.3 MB/s
Collecting neural-structured-learning>=1.3.1
Downloading neural_structured_learning-1.3.1-py2.py3-none-any.whl (120 kB)
|ββββββββββββββββββββββββββββββββ| 120 kB 18.7 MB/s
Collecting sentencepiece>=0.1.91
Downloading sentencepiece-0.1.96-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB)
|ββββββββββββββββββββββββββββββββ| 1.2 MB 31.9 MB/s
Collecting pillow>=7.0.0
Downloading Pillow-8.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.0 MB)
|ββββββββββββββββββββββββββββββββ| 3.0 MB 12.0 MB/s
Collecting tf-models-official==2.3.0
Downloading tf_models_official-2.3.0-py2.py3-none-any.whl (840 kB)
|ββββββββββββββββββββββββββββββββ| 840 kB 10.4 MB/s
Collecting tflite-model-maker
Downloading tflite_model_maker-0.3.3-py3-none-any.whl (616 kB)
|ββββββββββββββββββββββββββββββββ| 616 kB 25.3 MB/s
Downloading tflite_model_maker-0.3.2-py3-none-any.whl (591 kB)
|ββββββββββββββββββββββββββββββββ| 591 kB 21.2 MB/s
Collecting librosa>=0.5
Downloading librosa-0.8.1-py3-none-any.whl (203 kB)
|ββββββββββββββββββββββββββββββββ| 203 kB 9.6 MB/s
Collecting tflite-model-maker
Downloading tflite_model_maker-0.3.1-py3-none-any.whl (590 kB)
|ββββββββββββββββββββββββββββββββ| 590 kB 11.9 MB/s
Downloading tflite_model_maker-0.3.0-py3-none-any.whl (567 kB)
|ββββββββββββββββββββββββββββββββ| 567 kB 13.8 MB/s
Downloading tflite_model_maker-0.2.5-py3-none-any.whl (499 kB)
|ββββββββββββββββββββββββββββββββ| 499 kB 13.4 MB/s
Collecting tensorflow-datasets>=2.1.0
Downloading tensorflow_datasets-4.4.0-py3-none-any.whl (4.0 MB)
|ββββββββββββββββββββββββββββββββ| 4.0 MB 12.7 MB/s
Collecting tflite-model-maker
Downloading tflite_model_maker-0.2.4-py3-none-any.whl (190 kB)
|ββββββββββββββββββββββββββββββββ| 190 kB 16.1 MB/s
Collecting numpy>=1.17.3
Downloading numpy-1.21.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.0 MB)
|ββββββββββββββββββββββββββββββββ| 13.0 MB 943 kB/s
Collecting absl-py<0.11>=0.10.0
Downloading absl_py-0.10.0-py3-none-any.whl (127 kB)
|ββββββββββββββββββββββββββββββββ| 127 kB 12.2 MB/s
Collecting tflite-model-maker
Downloading tflite_model_maker-0.2.3-py3-none-any.whl (114 kB)
|ββββββββββββββββββββββββββββββββ| 114 kB 14.3 MB/s
Downloading tflite_model_maker-0.2.2-py3-none-any.whl (103 kB)
|ββββββββββββββββββββββββββββββββ| 103 kB 16.8 MB/s
Downloading tflite_model_maker-0.2.1-py3-none-any.whl (102 kB)
|ββββββββββββββββββββββββββββββββ| 102 kB 18.9 MB/s
Collecting fire>=0.3.1
Downloading fire-0.4.0.tar.gz (87 kB)
|ββββββββββββββββββββββββββββββββ| 87 kB 4.6 MB/s
Collecting absl-py>=0.10.0
Downloading absl_py-1.0.0-py3-none-any.whl (126 kB)
|ββββββββββββββββββββββββββββββββ| 126 kB 19.2 MB/s
Collecting tflite-model-maker
Downloading tflite_model_maker-0.2.0-py3-none-any.whl (102 kB)
|ββββββββββββββββββββββββββββββββ| 102 kB 18.7 MB/s
Downloading tflite_model_maker-0.1.2-py3-none-any.whl (104 kB)
|ββββββββββββββββββββββββββββββββ| 104 kB 13.7 MB/s
Collecting tf-models-nightly
Downloading tf_models_nightly-2.7.0.dev20211210-py2.py3-none-any.whl (1.9 MB)
|ββββββββββββββββββββββββββββββββ| 1.9 MB 24.1 MB/s
Collecting tflite-model-maker
Downloading tflite_model_maker-0.1.1-py3-none-any.whl (86 kB)
|ββββββββββββββββββββββββββββββββ| 86 kB 4.2 MB/s
Collecting tflite-support==0.1.0a0
Downloading tflite-support-0.1.0a0.tar.gz (258 kB)
|ββββββββββββββββββββββββββββββββ| 258 kB 14.2 MB/s
Collecting tflite-model-maker
Downloading tflite_model_maker-0.1.0-py3-none-any.whl (84 kB)
|ββββββββββββββββββββββββββββββββ| 84 kB 2.8 MB/s
ERROR: Cannot install tflite-model-maker==0.1.0, tflite-model-maker==0.1.1, tflite-model-maker==0.1.2, tflite-model-maker==0.2.0, tflite-model-maker==0.2.1, tflite-model-maker==0.2.2, tflite-model-maker==0.2.3, tflite-model-maker==0.2.4, tflite-model-maker==0.2.5, tflite-model-maker==0.3.0, tflite-model-maker==0.3.1, tflite-model-maker==0.3.2, tflite-model-maker==0.3.3 and tflite-model-maker==0.3.4 because these package versions have conflicting dependencies.
The conflict is caused by:
tflite-model-maker 0.3.4 depends on numba==0.53
tflite-model-maker 0.3.3 depends on numba==0.53
tflite-model-maker 0.3.2 depends on tflite-support>=0.1.0rc4
tflite-model-maker 0.3.1 depends on tflite-support>=0.1.0rc4
tflite-model-maker 0.3.0 depends on tflite-support>=0.1.0rc4
tflite-model-maker 0.2.5 depends on tensorflow>=2.4.0
tflite-model-maker 0.2.4 depends on tflite-support==0.1.0rc4
tflite-model-maker 0.2.3 depends on tf-nightly==2.4.0.dev20200902
tflite-model-maker 0.2.2 depends on tf-nightly==2.4.0.dev20200902
tflite-model-maker 0.2.1 depends on tf-nightly==2.4.0.dev20200811
tflite-model-maker 0.2.0 depends on tf-nightly==2.4.0.dev20200810
tflite-model-maker 0.1.2 depends on tf-nightly
tflite-model-maker 0.1.1 depends on tf-nightly
tflite-model-maker 0.1.0 depends on tf-nightly
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Dockerfile:
FROM python:latest
RUN pip install tflite-model-maker
Sorry, very new to TF (and a little fresh on Python too, tbh!) and not sure what else would be useful in terms of a reprex!
Same here.
Iβve installed Tensorflow as per the Apple docs:
Find presentations, documentation, sample code, and resources for building macOS, iOS, and tvOS apps with the Metal framework.
and then tried to install tflite-model-maker and get the same issue as the OP. If I edit requirements.txt to change the dependency to tensorflow-macos instead of tensorflow, I get an error with tflite-support.
Is there a working guide on how to install tflite-model-maker on a M1 Macbook? Iβm not too bothered about using the M1 neural capabilities just yet.
If I try and install the packages as per the tflite-model-maker docs and a simple Python script that converts a model, Python crashes and it seems to be related to Rosetta trying to run a x86 version of Tensorflow on M1
Even M2 is out for some time and this isnβt resolved, right?