I can't install Tensorflow Model Maker on Apple Silicon
Asked Answered
S

1

6

I have the Apple M1 Pro chip and cannot get my tensorflow project running. I followed the installation instructions from Apple's site.

When I run pip install -r requirements.txt, all my python packages install except for tflite-model-maker. I get the following error:

ERROR: Cannot install -r requirements.txt (line 19) and tflite-support because these package versions have conflicting dependencies.

The conflict is caused by:
    tflite-model-maker 0.3.4 depends on tensorflow>=2.6.0
    tflite-model-maker 0.3.3 depends on tensorflow>=2.6.0
    tflite-model-maker 0.3.2 depends on tensorflow>=2.4.0
    tflite-model-maker 0.3.1 depends on tensorflow>=2.4.0
    tflite-model-maker 0.3.0 depends on tensorflow>=2.4.0
    tflite-model-maker 0.2.5 depends on tensorflow>=2.4.0
    The user requested tflite-support
    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
    The user requested tflite-support
    tflite-model-maker 0.1.1 depends on tflite-support==0.1.0a0
    The user requested tflite-support
    tflite-model-maker 0.1.0 depends on tflite-support==0.1.0a0

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

Any ideas?

Senter answered 28/2, 2022 at 5:41 Comment(1)
Found a similar issue, did you try as mentioned here?Lienlienhard
J
-1

I had the same problem, the official release of tflite_model_maker doesn't support M1 chip yet.

But you can convert your model without installing the library:

1- Install TensorFlow: I used this tutorial: works perfectly: https://sudhanva.me/install-tensorflow-on-apple-m1-pro-max/

2- create your model using Keras os load it:

import tensorflow
model = tensorflow.keras.models.load_model(load_weights)

3- Convert your model to tflite:

converter = tensorflow.lite.TFLiteConverter.from_keras_model(model)
tflite_model = converter.convert()

with open('new_model.tflite', 'wb') as f:
    f.write(tflite_model)
Jointly answered 9/5, 2022 at 2:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.