diff --git a/.github/workflows/build_and_publish_to_pypi.yml b/.github/workflows/build_and_publish_to_pypi.yml index bee4a13..0aa6811 100755 --- a/.github/workflows/build_and_publish_to_pypi.yml +++ b/.github/workflows/build_and_publish_to_pypi.yml @@ -10,6 +10,8 @@ on: jobs: build-n-publish: name: Build and publish Python distributions to PyPI + permissions: + id-token: write runs-on: ubuntu-latest steps: - uses: actions/checkout@master @@ -27,8 +29,6 @@ jobs: run: >- python -m build - - name: Publish distribution to PyPI - if: startsWith(github.ref, 'refs/tags') + + - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/openwakeword/model.py b/openwakeword/model.py index 6029963..787e30a 100755 --- a/openwakeword/model.py +++ b/openwakeword/model.py @@ -111,7 +111,15 @@ def __init__( # Do imports for inference framework if inference_framework == "tflite": try: - import tflite_runtime.interpreter as tflite + try: + # Attempt to import the newer LiteRT runtime + import ai_edge_litert.interpreter as tflite + except ImportError: + try: + # Fallback to the original tflite_runtime if LiteRT is unavailable + import tflite_runtime.interpreter as tflite + except ImportError: + raise ImportError("Neither LiteRT nor TensorFlow Lite runtime found. Please install `ai_edge_litert` or `tflite_runtime`.") def tflite_predict(tflite_interpreter, input_index, output_index, x): tflite_interpreter.set_tensor(input_index, x) diff --git a/openwakeword/utils.py b/openwakeword/utils.py index 4964706..780312f 100644 --- a/openwakeword/utils.py +++ b/openwakeword/utils.py @@ -94,10 +94,14 @@ def __init__(self, elif inference_framework == "tflite": try: - import tflite_runtime.interpreter as tflite + # Attempt to import the newer LiteRT runtime + import ai_edge_litert.interpreter as tflite except ImportError: - raise ValueError("Tried to import the TFLite runtime, but it was not found." - "Please install it using `pip install tflite-runtime`") + try: + # Fallback to the original tflite_runtime if LiteRT is unavailable + import tflite_runtime.interpreter as tflite + except ImportError: + raise ImportError("Neither LiteRT nor TensorFlow Lite runtime found. Please install `ai_edge_litert` or `tflite_runtime`.") if melspec_model_path == "": melspec_model_path = os.path.join(pathlib.Path(__file__).parent.resolve(), diff --git a/pyproject.toml b/pyproject.toml index d420f04..94072e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,12 +11,12 @@ testpaths = [ ] [project] -name = "openwakeword" +name = "private-assistant-openwakeword" version = "0.6.0" authors = [ - { name="David Scripka", email="david.scripka@gmail.com" }, + { name="stkr22", email="stkr22@github.com" }, ] -description = "An open-source audio wake word (or phrase) detection framework with a focus on performance and simplicity" +description = "An open-source audio wake word (or phrase) detection framework with a focus on performance and simplicity. Fork of the original package." readme = "README.md" requires-python = ">=3.7" classifiers = [ @@ -27,4 +27,4 @@ classifiers = [ dynamic = ["dependencies", "optional-dependencies"] [project.urls] -"Homepage" = "https://github.com/dscripka/openWakeWord" \ No newline at end of file +"Homepage" = "https://github.com/stkr22/openWakeWord" \ No newline at end of file diff --git a/setup.py b/setup.py index df0a666..b014758 100644 --- a/setup.py +++ b/setup.py @@ -25,17 +25,18 @@ def build_additional_requires(): return additional_requires setuptools.setup( - name="openwakeword", - version="0.6.0", + name="private-assistant-openwakeword", + version="0.6.1", install_requires=[ - 'onnxruntime>=1.10.0,<2', - 'tflite-runtime>=2.8.0,<3; platform_system == "Linux"', 'tqdm>=4.0,<5.0', 'scipy>=1.3,<2', 'scikit-learn>=1,<2', 'requests>=2.0,<3', ], extras_require={ + 'onnx': ['onnxruntime>=1.10.0,<2'], + 'tflite': ['tflite-runtime>=2.8.0,<3'], + 'litert': ['ai-edge-litert>=1.0.1,<2'], 'test': [ 'pytest>=7.2.0,<8', 'pytest-cov>=2.10.1,<3', @@ -74,14 +75,14 @@ def build_additional_requires(): 'deep-phonemizer==0.0.19' ] }, - author="David Scripka", - author_email="david.scripka@gmail.com", - description="An open-source audio wake word (or phrase) detection framework with a focus on performance and simplicity", + author="stkr22", + author_email="stk22@github.com", + description="An open-source audio wake word (or phrase) detection framework with a focus on performance and simplicity. Fork of the original package.", long_description=long_description, long_description_content_type="text/markdown", - url="https://pypi.org/project/openwakeword", + url="https://pypi.org/project/private-assistant-openwakeword", project_urls={ - "Bug Tracker": "https://pypi.org/project/openwakeword/issues", + "Bug Tracker": "https://pypi.org/project/private-assistant-openwakeword/issues", }, classifiers=[ "Programming Language :: Python :: 3",