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

feat: allow full tensorflow usage if available #178

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mikejgray
Copy link
Contributor

closes #159

@mikejgray
Copy link
Contributor Author

Hey @dscripka , please let me know if you want any changes on this PR. Happy to adjust it to meet your requirements!

@dscripka
Copy link
Owner

@mikejgray thanks for the follow-up. Could youadjust the logic so that it only imports from the full tensorflow package if it is both installed and the tflite package is not installed? This happens implicitly right now with the try except block, but it might be a bit more clear by using something like https://docs.python.org/3/library/importlib.html#importlib.util.find_spec to verify the conditions precisely.

@mikejgray
Copy link
Contributor Author

mikejgray commented Nov 17, 2024

@dscripka

python
Python 3.12.5 (main, Aug 13 2024, 09:22:07) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import openwakeword
>>> from openwakeword.model import Model
>>> Model()
WARNING:root:Tried to import the tflite runtime, but it was not found. Using tensorflow instead.
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
>>> import tflite_runtime.interpreter as tflite
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tflite_runtime'
>>> exit()
❯ pip list | grep tensor
tensorboard               2.18.0
tensorboard-data-server   0.7.2
tensorflow                2.18.0python
Python 3.12.5 (main, Aug 13 2024, 09:22:07) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from openwakeword.utils import AudioFeatures
>>> x=AudioFeatures(inference_framework="tflite")
WARNING:root:Tried to import the tflite runtime, but it was not found. Using tensorflow instead.
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

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

Successfully merging this pull request may close these issues.

Allow full tensorflow if tflite_runtime isn't available
2 participants