asr.transcribe() freezes inside multiprocessing class - rabbitmq queues
@titu1994 have you worked something similar before?  Is your model on Cuda ? 

Cuda does not work with multi threading, only with multi processing. It simply does not support instantiating two separate cuda contexts (that's why all data loaders are multi process) on the same process. That can be one reason why it's hanging. 

By default, ASR transcribe does not use worker processes. But it does use a PT data loader with 0 workers. 

I haven't implemented the queueing step but I have simply Fast API based inference pipeline that loads a single model and keeps it in memory calling transcribe one by one with async coroutine. But if you use multiple workers then your model gets replicated due to guvicorn. 

What about rearchitecing your solution a bit ? Have two async coroutines - one that queues your input audio and one that runs your model ? Don't put your model on a separate process, keep it on main process, but keep the queueing of input output only via rabbitmq under async coroutines 

Personally I've never seen a single process class used to launch 3 processes.  This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. This issue was closed because it has been inactive for 7 days since being marked as stale.
Hi everybody, 

I have an application that communicates through rabbitmq queues. I am using a class that inherits multiprocessing.Process:
`class ThreadedConsumer(multiprocessing.Process)`

In this class, I would like to instantiate 3 processes, where each process transcribes an input file. 

Now, in order to use as little memory as possible, I would like to only create the 'asr_model' once, in the constructor of the ThreadedConsumer class, and each process to share the same model.

I have the following problem: when I create the self.asr_model inside the __init__ class, when i do asr.transcribe() inside the callback (when I receive a message) everything freezes. (probably a thread gets latched or something) When I create the self.asr_model each time I receive a new message in the queue, everything works fine. However, in this way I would have 3 models loaded into the memory.. I do not understand why declaring the model inside the constructor results in the pipeline getting stuck. 

Could you please help me with an idea for model sharing, is it possible for ASR models? I know that it would be a solution to use a model with batch_size=3, however once new message come into the queue, I would like another queue that's free to transcribe them and not continously wait for 3 messages.

If anybody has any insights or ideas on how to share the model/ use transcriber with multiprocessing.Process class, I would greatly appreciate any help!

Thank you in advance,
Gabi