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

Conflict with bazel scripts and installed tflite_micro wheel #2564

Open
mansnils opened this issue May 8, 2024 · 1 comment
Open

Conflict with bazel scripts and installed tflite_micro wheel #2564

mansnils opened this issue May 8, 2024 · 1 comment
Assignees

Comments

@mansnils
Copy link
Contributor

mansnils commented May 8, 2024

This comment summarize the problem: #2545 (comment)

How to reproduce:

Make sure tflite_micro is not installed. Either of these should run successfully,
./tensorflow/lite/micro/tools/ci_build/test_generate_integration_tests.sh
./tensorflow/lite/micro/tools/ci_build/test_generate_micro_mutable_op_resolver_tests.sh

Now pip install tflite_micro and try to run the ci test scripts. It fails, e.g.

    from tflite_micro.tensorflow.lite.micro.tools import generate_test_for_model
ModuleNotFoundError: No module named 'tflite_micro.tensorflow.lite.micro'
@mansnils
Copy link
Contributor Author

Summarizing the problem, taking generate_micro_mutable_op_resolver_from_model.py as example.

When running the script as regular python script without bazel, it does not work because visualize is not part of the tflite-micro wheel.
When running the script with bazel, bazel can pick up visualize from the path tflite_micro/tensorflow/lite/tools as long as tflite-micro wheel is not installed. If tflite-micro is installed bazel will only look in that, where again visualize is not part of.

So problem is the script does not work when tflite-micro is installed.

Possible solutions:

  • Import visualize from tensorflow instead of tflite-micro. That should make it work for both bazel and as a regular python script.
  • Add visualize to tflite-micro. That should make it work for both bazel and as a regular python script.
  • Make bazel find visualize even if tflite-micro is installed. That will make it work for bazel, which is good enough as far as I am concerned.

mansnils added a commit to mansnils/tflite-micro that referenced this issue May 15, 2024
BUG=tensorflow#2564

Change-Id: Id37ba1ef827eb1da8836dd8e7ea440e7e9918828
rascani added a commit to rascani/tflite-micro that referenced this issue May 22, 2024
When running the gen_micro_mutable_op_resolver script as a regular
python script without bazel, it cannot find visualize because it is not
part of the tflite-micro wheel. When running the script with bazel,
bazel can pick up visualize from the path
tflite_micro/tensorflow/lite/tools as long as tflite-micro wheel is not
installed. If it is installed, then bazel will only look at that, which
it is not a part of.

This PR switches the import to just be from tensorflow, which should
work regardless of whether it is from the tf package or relative path.

BUG=tensorflow#2564
mergify bot pushed a commit that referenced this issue May 23, 2024
When running the gen_micro_mutable_op_resolver script as a regular python script without bazel, it cannot find visualize because it is not part of the tflite-micro wheel. When running the script with bazel, bazel can pick up visualize from the path
tflite_micro/tensorflow/lite/tools as long as tflite-micro wheel is not installed. If it is installed, then bazel will only look at that, which it is not a part of.

This PR switches the import to just be from tensorflow, which should work regardless of whether it is from the tf package or relative path.

BUG=#2564
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant