Menu

PocketSphinx Decoder in Multi-threading environment (Python)

Help
G10DRAS
2016-04-08
2016-06-27
  • G10DRAS

    G10DRAS - 2016-04-08

    In my application, I want to create multiple Pocketsphinx decoder instances (Pocketsphinx wrappers with SWIG for Puthon) with various hmm (different languages), dict, lm and alltogether diffrent config parameters.

    I have few queries :

    1. Is there any limitation on number of pocketsphinx decoder instances created in a python application ? or it is limited by Memory available on Machine ?

    2. If a decoder is created in a thread, will it be releasing resources associated with the decoder automatically when thread done with processing ? or do we need to call ps_free() explicitly ?

    3. Can we re-use a decoder again if ps_free() is already called on it ?

    4. Which model is better for python application, create multiple decoder instances at starting of application or create them dynamically on the fly ?

    5. Any mem usage analysis is available for native pocketsphinx decoder ?

    Thanks

     
    • Nickolay V. Shmyrev

      Is there any limitation on number of pocketsphinx decoder instances created in a python application ?

      No

      or it is limited by Memory available on Machine ?

      Yes

      If a decoder is created in a thread, will it be releasing resources associated with the decoder automatically when thread done with processing ? or do we need to call ps_free() explicitly ?

      You need to call ps_free in C code

      Python object will automatically release the decoder

      Can we re-use a decoder again if ps_free() is already called on it ?

      No

      Which model is better for python application, create multiple decoder instances at starting of application or create them dynamically on the fly ?

      It depends on the purpose of your application, usually worker pattern is better

      Any mem usage analysis is available for native pocketsphinx decoder ?

      You have to do it yourself, it depends on the model size mostly

       
  • G10DRAS

    G10DRAS - 2016-04-08

    Thank you Nickolay !! Got it.

     
  • Daniel Wolf

    Daniel Wolf - 2016-06-26

    Is is okay to use a single decoder from multiple threads, as long as I take care of synchronization? That is, can I create a decoder on thread A, then do some decoding with it on thread B, then do some more decoding on thread C?

     
    • Nickolay V. Shmyrev

      It is ok. You can protect decoder with a mutex.

       
      • Daniel Wolf

        Daniel Wolf - 2016-06-27

        Thanks, that's what I was hoping for!

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.