Menu

How much memory should be required?

Help
2009-03-09
2012-09-22
  • Mitchell Garnaat

    Hi -

    I have sphinx4 installed and have successfully run several of the demos. I also reconfigured test/performance/an4 to use the WSJ dictionary and that ran correctly although this was still using the simple wordlist grammar.

    Now, I'm trying to reconfigure the wavfile demo to also use the WSJ dictionary and acoustic model with a LexTreeLinguist. Everything now compiles and runs but I always run out Java heap space. The stack trace is shown below:

    java -Xms1424m -Xmx1424m -jar bin/WavFile.jar
    Loading Recognizer as defined in 'jar:file:/root/sphinx4/bin/WavFile.jar!/edu/cmu/sphinx/demo/wavfile/config.xml'...

    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at edu.cmu.sphinx.linguist.lextree.LexTreeLinguist$LexTreeState.createUnitStateArc(LexTreeLinguist.java:695)
    at edu.cmu.sphinx.linguist.lextree.LexTreeLinguist$LexTreeWordState.getSuccessors(LexTreeLinguist.java:1390)
    at edu.cmu.sphinx.linguist.util.LinguistStats.run(LinguistStats.java:36)
    at edu.cmu.sphinx.instrumentation.RecognizerMonitor.statusChanged(RecognizerMonitor.java:88)
    at edu.cmu.sphinx.recognizer.Recognizer.setState(Recognizer.java:142)
    at edu.cmu.sphinx.recognizer.Recognizer.allocate(Recognizer.java:158)
    at edu.cmu.sphinx.demo.wavfile.WavFile.main(WavFile.java:46)

    The more memory I allocate, the long it takes to generate this error but I'm wondering if it really is just a problem of needing more memory or if there is something wrong with my configuration. I'm very new to this and could quite easily have something silly in my config file (see below).

    Any ideas? How much memory should I expect this to require? Thanks,

    Mitch

    <?xml version="1.0" encoding="UTF-8"?>

    <!--
    Sphinx-4 Configuration file
    -->

    <!-- ******** -->
    <!-- tidigits configuration file -->
    <!-- ******** -->

    <config>

    &lt;!-- ******************************************************** --&gt;
    &lt;!-- frequently tuned properties                              --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;property name=&quot;absoluteBeamWidth&quot; value=&quot;800&quot;/&gt;
    &lt;property name=&quot;relativeBeamWidth&quot; value=&quot;1E-50&quot;/&gt;
    &lt;property name=&quot;absoluteWordBeamWidth&quot; value=&quot;20&quot;/&gt;
    &lt;property name=&quot;relativeWordBeamWidth&quot; value=&quot;1E-60&quot;/&gt;
    &lt;property name=&quot;wordInsertionProbability&quot; value=&quot;1E-26&quot;/&gt;
    &lt;property name=&quot;languageWeight&quot; value=&quot;20&quot;/&gt;
    &lt;property name=&quot;silenceInsertionProbability&quot; value=&quot;1&quot;/&gt;
    &lt;property name=&quot;skip&quot; value=&quot;0&quot;/&gt;
    &lt;property name=&quot;logLevel&quot; value=&quot;WARNING&quot;/&gt;
    
    &lt;property name=&quot;recognizer&quot; value=&quot;recognizer&quot;/&gt;
    &lt;property name=&quot;linguist&quot; value=&quot;lexTreeLinguist&quot;/&gt;
    &lt;property name=&quot;frontend&quot; value=&quot;mfcFrontEnd&quot;/&gt;
    
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The Recognizer configuration                             --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;recognizer&quot;
               type=&quot;edu.cmu.sphinx.recognizer.Recognizer&quot;&gt;
        &lt;property name=&quot;decoder&quot; value=&quot;decoder&quot;/&gt;
        &lt;propertylist name=&quot;monitors&quot;&gt;
      &lt;item&gt;accuracyTracker&lt;/item&gt;
      &lt;item&gt;speedTracker&lt;/item&gt;
      &lt;item&gt;memoryTracker&lt;/item&gt;
      &lt;item&gt;recognizerMonitor&lt;/item&gt;
        &lt;/propertylist&gt;
    &lt;/component&gt;
    
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The Decoder   configuration                              --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;decoder&quot; type=&quot;edu.cmu.sphinx.decoder.Decoder&quot;&gt;
        &lt;property name=&quot;searchManager&quot; value=&quot;wordPruningSearchManager&quot;/&gt;
    &lt;property name=&quot;featureBlockSize&quot; value=&quot;50&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;wordPruningSearchManager&quot; 
              type=&quot;edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstSearchManager&quot;&gt;
        &lt;property name=&quot;logMath&quot; value=&quot;logMath&quot;/&gt;
        &lt;property name=&quot;linguist&quot; value=&quot;lexTreeLinguist&quot;/&gt;
        &lt;property name=&quot;pruner&quot; value=&quot;trivialPruner&quot;/&gt;
        &lt;property name=&quot;scorer&quot; value=&quot;threadedScorer&quot;/&gt;
        &lt;property name=&quot;activeListManager&quot; value=&quot;activeListManager&quot;/&gt;
        &lt;property name=&quot;growSkipInterval&quot; value=&quot;0&quot;/&gt;
        &lt;property name=&quot;checkStateOrder&quot; value=&quot;false&quot;/&gt;
        &lt;property name=&quot;buildWordLattice&quot; value=&quot;false&quot;/&gt;
        &lt;property name=&quot;acousticLookaheadFrames&quot; value=&quot;1.7&quot;/&gt;
        &lt;property name=&quot;relativeBeamWidth&quot; value=&quot;${relativeBeamWidth}&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;trivialPruner&quot;
               type=&quot;edu.cmu.sphinx.decoder.pruner.SimplePruner&quot;/&gt;
    
    &lt;component name=&quot;threadedScorer&quot; 
                type=&quot;edu.cmu.sphinx.decoder.scorer.ThreadedAcousticScorer&quot;&gt;
        &lt;property name=&quot;frontend&quot; value=&quot;${frontend}&quot;/&gt;
        &lt;property name=&quot;isCpuRelative&quot; value=&quot;true&quot;/&gt;
        &lt;property name=&quot;numThreads&quot; value=&quot;0&quot;/&gt;
        &lt;property name=&quot;minScoreablesPerThread&quot; value=&quot;10&quot;/&gt;
        &lt;property name=&quot;scoreablesKeepFeature&quot; value=&quot;true&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;activeListManager&quot; 
               type=&quot;edu.cmu.sphinx.decoder.search.SimpleActiveListManager&quot;&gt;
      &lt;propertylist name=&quot;activeListFactories&quot;&gt;
    &lt;item&gt;standardActiveListFactory&lt;/item&gt;
    &lt;item&gt;wordActiveListFactory&lt;/item&gt;
    &lt;item&gt;wordActiveListFactory&lt;/item&gt;
    &lt;item&gt;standardActiveListFactory&lt;/item&gt;
    &lt;item&gt;standardActiveListFactory&lt;/item&gt;
    &lt;item&gt;standardActiveListFactory&lt;/item&gt;
      &lt;/propertylist&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;standardActiveListFactory&quot; 
             type=&quot;edu.cmu.sphinx.decoder.search.PartitionActiveListFactory&quot;&gt;
        &lt;property name=&quot;logMath&quot; value=&quot;logMath&quot;/&gt;
        &lt;property name=&quot;absoluteBeamWidth&quot; value=&quot;${absoluteBeamWidth}&quot;/&gt;
        &lt;property name=&quot;relativeBeamWidth&quot; value=&quot;${relativeBeamWidth}&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;wordActiveListFactory&quot; 
             type=&quot;edu.cmu.sphinx.decoder.search.PartitionActiveListFactory&quot;&gt;
        &lt;property name=&quot;logMath&quot; value=&quot;logMath&quot;/&gt;
        &lt;property name=&quot;absoluteBeamWidth&quot; value=&quot;${absoluteWordBeamWidth}&quot;/&gt;
        &lt;property name=&quot;relativeBeamWidth&quot; value=&quot;${relativeWordBeamWidth}&quot;/&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The linguist  configuration                              --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;lexTreeLinguist&quot; 
               type=&quot;edu.cmu.sphinx.linguist.lextree.LexTreeLinguist&quot;&gt;
        &lt;property name=&quot;logMath&quot; value=&quot;logMath&quot;/&gt;
        &lt;property name=&quot;acousticModel&quot; value=&quot;wsj&quot;/&gt;
        &lt;property name=&quot;languageModel&quot; value=&quot;trigramModel&quot;/&gt;
        &lt;property name=&quot;dictionary&quot; value=&quot;dictionary&quot;/&gt;
        &lt;property name=&quot;addFillerWords&quot; value=&quot;false&quot;/&gt;
        &lt;property name=&quot;fillerInsertionProbability&quot; value=&quot;1E-10&quot;/&gt;
        &lt;property name=&quot;generateUnitStates&quot; value=&quot;false&quot;/&gt;
        &lt;property name=&quot;wantUnigramSmear&quot; value=&quot;true&quot;/&gt;
        &lt;property name=&quot;unigramSmearWeight&quot; value=&quot;1&quot;/&gt;
        &lt;property name=&quot;wordInsertionProbability&quot; 
                  value=&quot;${wordInsertionProbability}&quot;/&gt;
        &lt;property name=&quot;silenceInsertionProbability&quot; 
                  value=&quot;${silenceInsertionProbability}&quot;/&gt;
        &lt;property name=&quot;languageWeight&quot; value=&quot;${languageWeight}&quot;/&gt;
    &lt;property name=&quot;unitManager&quot; value=&quot;unitManager&quot;/&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The Dictionary configuration                            --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;dictionary&quot; 
               type=&quot;edu.cmu.sphinx.linguist.dictionary.FastDictionary&quot;&gt;
      &lt;property name=&quot;dictionaryPath&quot;
                  value=&quot;resource:/edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model!/edu/cmu/sphinx/model/acoustic/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz/dict/cmudict.0.6d&quot;/&gt;
      &lt;property name=&quot;fillerPath&quot;
                  value=&quot;resource:/edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model!/edu/cmu/sphinx/model/acoustic/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz/dict/fillerdict&quot;/&gt;
      &lt;property name=&quot;addSilEndingPronunciation&quot; value=&quot;false&quot;/&gt;
      &lt;property name=&quot;wordReplacement&quot; value=&quot;&amp;lt;sil&amp;gt;&quot;/&gt;
      &lt;property name=&quot;allowMissingWords&quot; value=&quot;true&quot;/&gt;
      &lt;property name=&quot;unitManager&quot; value=&quot;unitManager&quot;/&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The acoustic model configuration                         --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;wsj&quot; type=&quot;edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model&quot;&gt;
        &lt;property name=&quot;loader&quot; value=&quot;sphinx3LoaderWSJ&quot;/&gt;
        &lt;property name=&quot;unitManager&quot; value=&quot;unitManager&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;sphinx3LoaderWSJ&quot;
               type=&quot;edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.ModelLoader&quot;&gt;
        &lt;property name=&quot;logMath&quot; value=&quot;logMath&quot;/&gt;
        &lt;property name=&quot;unitManager&quot; value=&quot;unitManager&quot;/&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The unit manager configuration                           --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;unitManager&quot; 
        type=&quot;edu.cmu.sphinx.linguist.acoustic.UnitManager&quot;/&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The language model configuration                         --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;trigramModel&quot; 
        type=&quot;edu.cmu.sphinx.linguist.language.ngram.SimpleNGramModel&quot;&gt;
        &lt;property name=&quot;location&quot; 
            value=&quot;resource:/edu.cmu.sphinx.demo.wavfile.WavFile!/edu/cmu/sphinx/demo/wavfile/hellongram.trigram.lm&quot;/&gt;
        &lt;property name=&quot;logMath&quot; value=&quot;logMath&quot;/&gt;
        &lt;property name=&quot;dictionary&quot; value=&quot;dictionary&quot;/&gt;
        &lt;property name=&quot;maxDepth&quot; value=&quot;3&quot;/&gt;
        &lt;property name=&quot;unigramWeight&quot; value=&quot;.7&quot;/&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The frontend configuration                               --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;mfcFrontEnd&quot; type=&quot;edu.cmu.sphinx.frontend.FrontEnd&quot;&gt;
        &lt;propertylist name=&quot;pipeline&quot;&gt;
            &lt;item&gt;audioFileDataSource&lt;/item&gt;
            &lt;item&gt;premphasizer&lt;/item&gt;
            &lt;item&gt;dither&lt;/item&gt;
            &lt;item&gt;windower&lt;/item&gt;
            &lt;item&gt;fft&lt;/item&gt;
            &lt;item&gt;melFilterBank&lt;/item&gt;
            &lt;item&gt;dct&lt;/item&gt;
            &lt;item&gt;batchCMN&lt;/item&gt;
            &lt;item&gt;featureExtraction&lt;/item&gt;
        &lt;/propertylist&gt;
    &lt;/component&gt;
    
    
    &lt;component name=&quot;audioFileDataSource&quot; type=&quot;edu.cmu.sphinx.frontend.util.AudioFileDataSource&quot;/&gt;
    
    &lt;component name=&quot;premphasizer&quot;
               type=&quot;edu.cmu.sphinx.frontend.filter.Preemphasizer&quot;/&gt;
    
    &lt;component name=&quot;dither&quot;
               type=&quot;edu.cmu.sphinx.frontend.filter.Dither&quot;/&gt;
    
    &lt;component name=&quot;windower&quot;
               type=&quot;edu.cmu.sphinx.frontend.window.RaisedCosineWindower&quot;/&gt;
    
    &lt;component name=&quot;fft&quot;
               type=&quot;edu.cmu.sphinx.frontend.transform.DiscreteFourierTransform&quot;/&gt;
    
    &lt;component name=&quot;melFilterBank&quot;
               type=&quot;edu.cmu.sphinx.frontend.frequencywarp.MelFrequencyFilterBank&quot;/&gt;
    
    &lt;component name=&quot;dct&quot;
               type=&quot;edu.cmu.sphinx.frontend.transform.DiscreteCosineTransform&quot;/&gt;
    
    &lt;component name=&quot;batchCMN&quot;
               type=&quot;edu.cmu.sphinx.frontend.feature.BatchCMN&quot;/&gt;
    
    &lt;component name=&quot;featureExtraction&quot;
               type=&quot;edu.cmu.sphinx.frontend.feature.DeltasFeatureExtractor&quot;/&gt;
    
    
    &lt;!-- ******************************************************* --&gt;
    &lt;!--  monitors                                               --&gt;
    &lt;!-- ******************************************************* --&gt;
    
    &lt;component name=&quot;accuracyTracker&quot;
               type=&quot;edu.cmu.sphinx.instrumentation.BestPathAccuracyTracker&quot;&gt;
        &lt;property name=&quot;recognizer&quot; value=&quot;${recognizer}&quot;/&gt;
        &lt;property name=&quot;showAlignedResults&quot; value=&quot;false&quot;/&gt;
        &lt;property name=&quot;showRawResults&quot; value=&quot;false&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;rejectionTracker&quot;
               type=&quot;edu.cmu.sphinx.instrumentation.RejectionTracker&quot;&gt;
        &lt;property name=&quot;recognizer&quot; value=&quot;${recognizer}&quot;/&gt;
        &lt;property name=&quot;showSummary&quot; value=&quot;true&quot;/&gt;
        &lt;property name=&quot;showDetails&quot; value=&quot;true&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;memoryTracker&quot;
               type=&quot;edu.cmu.sphinx.instrumentation.MemoryTracker&quot;&gt;
        &lt;property name=&quot;recognizer&quot; value=&quot;${recognizer}&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;speedTracker&quot;
               type=&quot;edu.cmu.sphinx.instrumentation.SpeedTracker&quot;&gt;
        &lt;property name=&quot;recognizer&quot; value=&quot;${recognizer}&quot;/&gt;
        &lt;property name=&quot;frontend&quot; value=&quot;${frontend}&quot;/&gt;
        &lt;property name=&quot;showTimers&quot; value=&quot;false&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;recognizerMonitor&quot;
               type=&quot;edu.cmu.sphinx.instrumentation.RecognizerMonitor&quot;&gt;
        &lt;property name=&quot;recognizer&quot; value=&quot;${recognizer}&quot;/&gt;
        &lt;propertylist name=&quot;allocatedMonitors&quot;&gt;
            &lt;item&gt;linguistStats&lt;/item&gt;
            &lt;item&gt;configMonitor&lt;/item&gt;
        &lt;/propertylist&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;configMonitor&quot;
               type=&quot;edu.cmu.sphinx.instrumentation.ConfigMonitor&quot;&gt;
        &lt;property name=&quot;showConfig&quot; value=&quot;false&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;linguistStats&quot;
               type=&quot;edu.cmu.sphinx.linguist.util.LinguistStats&quot;&gt;
        &lt;property name=&quot;linguist&quot; value=&quot;${linguist}&quot;/&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************* --&gt;
    &lt;!--  Miscellaneous components                               --&gt;
    &lt;!-- ******************************************************* --&gt;
    
    &lt;component name=&quot;logMath&quot; type=&quot;edu.cmu.sphinx.util.LogMath&quot;&gt;
        &lt;property name=&quot;logBase&quot; value=&quot;1.0001&quot;/&gt;
        &lt;property name=&quot;useAddTable&quot; value=&quot;true&quot;/&gt;
    &lt;/component&gt;
    

    </config>

     
    • Mitchell Garnaat

      I am running from subversion but hadn't updated recently. I'm now at r9059. I removed linguistStats from the recognizerMonitor and recompiled everything and it now seems to work:

      >:~/sphinx4# java -Xms1024m -Xmx1024m -jar bin/WavFile.jarLoading Recognizer as defined in 'jar:file:/root/sphinx4/bin/WavFile.jar!/edu/cmu/sphinx/demo/wavfile/config.xml'...

      Decoding jar:file:/root/sphinx4/bin/WavFile.jar!/edu/cmu/sphinx/demo/wavfile/12345.wav
      This Time Audio: 2.88s Proc: 0.40s Speed: 0.14 X real time
      Total Time Audio: 2.88s Proc: 0.40s Speed: 0.14 X real time
      Mem Total: 1016.12 Mb Free: 903.10 Mb
      Used: This: 113.03 Mb Avg: 113.03 Mb Max: 113.03 Mb
      Result: on am

      Or at least it didn't run out of heap space. Thanks! Was the problem that my code was somewhat out of date or was it the linguistStat that was causing the problem?

      Mitch

       
      • Nickolay V. Shmyrev

        After some investigation I think it's not a bug. The idea of LinguistStats component is to traverse all search states of Linguist and collect the statistics. It's possible with small jsgf, while with lexTreeLinguist the search graph is huge and it's impossible to traverse it without prunning. So basically the application of this monitor to lexTreeLinguist is not practical.

         
      • Nickolay V. Shmyrev

        >I am running from subversion but hadn't updated recently. I'm now at r9059. I removed linguistStats from the recognizerMonitor and recompiled everything and it now seems to work

        It looks like a bug that would be nice to fix.

         
    • Nickolay V. Shmyrev

      What version are you talking about? Are you using nightly build?

      Can you remove recognizerMonitor from monitors?
      <item>linguistStats</item>

       

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.