sandrohanea / whisper.net

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

The lib hangs if processing concurrently #195

Open atmoraes1 opened 1 month ago

atmoraes1 commented 1 month ago

When spawning multiple transcriptions at the same time, the lib hangs and keeps using CPU forever.

It seems something is not thread safe but I'm not sure. What could be causing that?

sandrohanea commented 1 month ago

Probably you reused some WhisperProcessor across multiple threads.

You should be able to run parallel transcoding without any locking and loading the model only once, if creating one WhisperFactory that you're going to reuse, but for each thread / task, use a different WhisperProcessor

atmoraes1 commented 2 weeks ago

That's exactly what I'm doing. The factory is static and each audio input creates a new processor.