tensorflow / tflite-micro

Infrastructure to enable deployment of ML models to low-power resource-constrained embedded targets (including microcontrollers and digital signal processors).
Apache License 2.0
1.74k stars 770 forks source link

gen_micro_mutable script: update import path #2545

Closed mansnils closed 2 months ago

mansnils commented 2 months ago

BUG=https://github.com/tensorflow/tflite-micro/issues/1973

rascani commented 2 months ago

FYI @mansnils - I needed to revert this due to internal breakage. From my understanding, I believe either from tflite_micro.tensorflow.lite or from tensorflow.lite should work fine. The former should pick up visualize from the TFLM copy, whereas the latter should pick up visualize from the pip installed version of tensorflow. I think its better to use the former.

Were you seeing an issue with that? The linked issue didn't provide repro steps.

mansnils commented 2 months ago

FYI @mansnils - I needed to revert this due to internal breakage. From my understanding, I believe either from tflite_micro.tensorflow.lite or from tensorflow.lite should work fine. The former should pick up visualize from the TFLM copy, whereas the latter should pick up visualize from the pip installed version of tensorflow. I think its better to use the former.

Were you seeing an issue with that? The linked issue didn't provide repro steps.

Thanks @RJ - the issue the PR tried to fix has been seen randomly in seemingly similar environments to where it has not been seen but the fix always seemed to work in both environments. That is why I didn't provide the PR immediately. So not sure how to reproduce it.

mansnils commented 2 months ago

FYI @mansnils - I needed to revert this due to internal breakage. From my understanding, I believe either from tflite_micro.tensorflow.lite or from tensorflow.lite should work fine. The former should pick up visualize from the TFLM copy, whereas the latter should pick up visualize from the pip installed version of tensorflow. I think its better to use the former. Were you seeing an issue with that? The linked issue didn't provide repro steps.

Thanks @RJ - the issue the PR tried to fix has been seen randomly in seemingly similar environments to where it has not been seen but the fix always seemed to work in both environments. That is why I didn't provide the PR immediately. So not sure how to reproduce it.

I think the problem might be that fromtflite_micro.tensorflow.lite.tools import visualize as visualize as it is now works when the tflite-micro wheel is not installed. If it is installed it seems bazel tries to import visualize from the actual pip installed tflite-micro package and in fact there is no visualize in that package. For example it seems to work if creating a virtual environment before running the bazel command. I don't know if there is a way to tell bazel to just look in the directory structure.