sandrohanea / whisper.net

Whisper.net. Speech to text made simple using Whisper Models
MIT License
547 stars 84 forks source link

Using WhisperProcessor.ProcessAsync more than once #57

Closed jdluzen closed 1 year ago

jdluzen commented 1 year ago

Thanks for this great project! I am attempting to use a WhisperProcessor instance more than once, calling ProcessAsync serially. However, after the first successful recognition, it only sometimes returns SegmentDatas. It appears that OnSegmentHandler is not being called while in whisper_full_with_state.

To work around this, I save the builder and then Build() before every ProcessAsync. Everything gets recognized successfully.

sandrohanea commented 1 year ago

Hello @jdluzen , Thanks for reporting the issue. Indeed, there was a bug in the Process and ProcessAsync methods which was not calling the handlers on subsequential calls. It will come with the next version of Whisper, but yes, in the meantime, the workaround proposed (to call Build multiple times) should be goon.

Also, if you want to execute multiple transformation in parallel, not only serially => the approach with multiple processors and keeping the builder is needed.