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

Simple example does not work on Ubuntu 24.04 in WSL2 #204

Open
dibalavs opened this issue Sep 19, 2024 · 2 comments
Open

Simple example does not work on Ubuntu 24.04 in WSL2 #204

dibalavs opened this issue Sep 19, 2024 · 2 comments

Comments

@dibalavs
Copy link

Trying to install oww and launch basic example:

pip install openwakeword --break-system-packages

Example script:

import openwakeword
from pyaudio import PyAudio, paInt16
from openwakeword.model import Model
import wave

CHUNK_SIZE=2048

# BUG1: download_models() is not available in utils.
#openwakeword.utils.download_models()

# Instantiate the model(s)
# BUG2:  CUDAExecutionProvider is used instead of CPU.
model = Model(
 #   wakeword_models=["path/to/model.tflite"],  # can also leave this argument empty to load all of the included pre-trained models
)

with wave.open("models/computer-en.wav", "r") as wf:
    # Get audio data containing 16-bit 16khz PCM audio data from a file, microphone, network stream, etc.
    # For the best efficiency and latency, audio frames should be multiples of 80 ms, with longer frames
    # increasing overall efficiency at the cost of detection latency
    frame = wf.readframes(CHUNK_SIZE)

    # Get predictions for the frame
    prediction = model.predict(frame)

And result is:

/home/vdybala/.local/lib/python3.12/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py:69: UserWarning: Specified provider 'CUDAExecutionProvider' is not in available provider names.Available providers: 'AzureExecutionProvider, CPUExecutionProvider'
  warnings.warn(

How to specify CPUExecutionProvider?

@dibalavs
Copy link
Author

By some reasons pip installed version 0.4.0. When I try install most modern version 0.6.0 I got an error:

pip install openwakeword==0.6.0 --break-system-packages
Defaulting to user installation because normal site-packages is not writeable
Collecting openwakeword==0.6.0
  Using cached openwakeword-0.6.0-py3-none-any.whl.metadata (29 kB)
Requirement already satisfied: onnxruntime<2,>=1.10.0 in /home/vdybala/.local/lib/python3.12/site-packages (from openwakeword==0.6.0) (1.19.2)
Requirement already satisfied: tqdm<5.0,>=4.0 in /home/vdybala/.local/lib/python3.12/site-packages (from openwakeword==0.6.0) (4.66.5)
Requirement already satisfied: scipy<2,>=1.3 in /usr/lib/python3/dist-packages (from openwakeword==0.6.0) (1.11.4)
Requirement already satisfied: scikit-learn<2,>=1 in /home/vdybala/.local/lib/python3.12/site-packages (from openwakeword==0.6.0) (1.5.2)
Requirement already satisfied: requests<3,>=2.0 in /usr/lib/python3/dist-packages (from openwakeword==0.6.0) (2.31.0)
INFO: pip is looking at multiple versions of openwakeword to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement tflite-runtime<3,>=2.8.0; platform_system == "Linux" (from openwakeword) (from versions: none)
ERROR: No matching distribution found for tflite-runtime<3,>=2.8.0; platform_system == "Linux"

@dscripka
Copy link
Owner

What version of Python are you using? It looks like tflite-runtime only has pre-built WHLs up to Python 3.11, otherwise you will get this error.

And you shouldn't need to specify the Execution provider, it will choose CPU automatically when appropriate.

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

2 participants