Comments (17)
Thanks for the feedback! Unfortunately, I do not own a mac to reproduce this issue
Pyaudio is wrapper for the portaudio lib. You need to have port audio installed on your mac in order to make this work.
This blog post might help you: Installing PyAudio on MacOs
from wav2vec2-live.
Thanks @oliverguhr for the reply!
So I fixed the Pyaudio issue, but I came across another issue, I am not getting any audio through despite double checking my device and that I am getting the audio stream using pyaudio in some test code.
Upon inspection, it seems these variables LiveWav2Vec2.is_listening.get()
in https://github.com/oliverguhr/wav2vec2-live/blob/main/live_asr.py#L67 and https://github.com/oliverguhr/wav2vec2-live/blob/main/live_asr.py#L84 keep a None
value. They do not get updated with https://github.com/oliverguhr/wav2vec2-live/blob/main/live_asr.py#L31 for whatever reason.
What's the role of https://github.com/oliverguhr/wav2vec2-live/blob/main/live_asr.py#L13? Why not just use https://github.com/oliverguhr/wav2vec2-live/blob/main/live_asr.py#L18?
from wav2vec2-live.
I need a way to tell the ASR and VAD thread that the main program closes. My first attempt was to use L18, a class property to signal that both threads should end. But this is not working since these threads do not have access to the class properties. So I needed a shared, thread-safe variable for this which is the ContextVar in L18.
Long story short - L18 is not used and obsolete.
However, that this lines LiveWav2Vec2.is_listening.set(True)
fails is very strange. Since the ContextVars module is a python build-in feature and should just work.
Which python version are you using?
from wav2vec2-live.
Your explanation makes sense!
I am using Python 3.8.5. Indeed the problem is that LiveWav2Vec2.is_listening.set(True)
does not overwrite is_listening
inside vad_process()
and asr_process()
.
Will be happy to test out things if you have suggestions.
Thanks!
from wav2vec2-live.
Very strange - I am running the same python version - and it works just fine. We could do an online meeting and look at this together.
from wav2vec2-live.
Hi,
I see the same behavior on Python 3.6.12 on Windows.
As a quick workaround, I removed the sync and the program runs.
from wav2vec2-live.
@oliverguhr, yes i will be happy to jump in a quick call. What's the best way to do that?
@arossbach10, could you clarify what you mean by removing the sync?
from wav2vec2-live.
I set it to true before each get()
LiveWav2Vec2.is_listening.set(True)
while LiveWav2Vec2.is_listening.get():
...
from wav2vec2-live.
@arossbach10 thanks! that's an obvious work around.
I am still curious about why running the ContextVars does not work.
But happy to close this issue.
from wav2vec2-live.
It is not a nice solution and in some cases, I would expect synchronization is required.
But I have not worked with contextvars.
from wav2vec2-live.
@arossbach10 Thank you for the hint! This would prevent the threads from being closed if by the stop
function, but it does not matter if you close the program anyway. Really funny is, that my ContextVar implementation does not work either. I need to investigate this.
from wav2vec2-live.
@oliverguhr But it could also go wrong at the start. I would also be interested to know why the ContextVar is not working.
from wav2vec2-live.
If I set the ContextVar to False it will remain True for the other threads. I must have overlooked something. However this blog post recommends using threading.Event()
send the signal, I will give this a try.
from wav2vec2-live.
@arossbach10 @othrif I removed the Contextvar code and added some code to gracefully close the threads. It works on my machine :) I would be happy if you could check that and provide some feedback.
from wav2vec2-live.
Thanks @oliverguhr
Strangely enough, I now get a buffer error:
Exception in thread Thread-2:
Traceback (most recent call last):
File "/Users/othrif/.pyenv/versions/3.8.5/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/Users/othrif/.pyenv/versions/3.8.5/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "live_asr.py", line 66, in vad_process
frame = stream.read(CHUNK)
File "/Users/othrif/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pyaudio.py", line 608, in read
return pa.read_stream(self._stream, num_frames, exception_on_overflow)
OSError: [Errno -9981] Input overflowed
I do not see this error in my linux machine, just my mac. I haven't seen this with the previous version of the code.
One solution might be to increase the CHUNK size but then this will not work with VAD.
Thoughts?
from wav2vec2-live.
@othrif I don't know, this could be a Mac-specific port audio issue. Debugging it on a Mac would be helpful.
from wav2vec2-live.
@othrif Since I don't down a mac, I can not solve this issue. I close this ticket, if you fix it - feel free to reopen it.
from wav2vec2-live.
Related Issues (12)
- Problem when running with combination of wav2vec2 model and 4-grams LM HOT 2
- break in little pause HOT 2
- Live ASR Engine with whisper HOT 2
- use it with local model HOT 2
- Transformers Version Pre-4.8.2 HOT 1
- using custom transformer models throw exception HOT 2
- Inference error: shape mismatch HOT 6
- offline mode feasibility HOT 1
- How to improve the performance? HOT 1
- Optimisation for GPU with CUDA HOT 2
- Performance is not good, only for me? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wav2vec2-live.