Menu

pocketsphinx, ppc, and wsj1 hmm byte ordering

Help
2009-06-05
2012-09-22
  • Mike Medved

    Mike Medved - 2009-06-05

    Hi -

    So here it goes - I'd like to run the pocketsphinx programs on a powerpc in an embedded environment and I've got the programs compiling and working just fine on windows on an x86. The programs also compile and run just fine on PPC based system (on QNX), however when I run the docoder (through pocketsphinx_batch), I get an error message saying that my hmm is the wrong endianness, and then something about my transition matricies being the wrong size. I'll post the actual text of the error later (need to go to the lab to get it), just wondering if anyone out there knows about the hmms for wsj1 that come in the SVN checkout with pocketsphinx (under pocketsphinx\model\hmm\wsj1)... are these little endian by default? Is there some standard way to transform them? Does what I am saying make any sense at all?

    Thanks,
    M

     
    • Mike Medved

      Mike Medved - 2009-06-05

      INFO: cmd_ln.c(510): Parsing command line:
      PocketSphinx_gmedvedm1244218209375 \
      -argfile /sphinx/evatest.args

      Current configuration:
      [NAME] [DEFLT] [VALUE]
      -adchdr 0 0
      -adcin no no
      -agc none none
      -agcthresh 2.0 2.000000e+00
      -alpha 0.97 9.700000e-01
      -argfile /sphinx/evatest.args
      -ascale 20.0 2.000000e+01
      -backtrace no no
      -beam 1e-48 1.000000e-48
      -bestpath yes yes
      -bestpathlw 9.5 9.500000e+00
      -cep2spec no no
      -cepdir
      -cepext .mfc .mfc
      -ceplen 13 13
      -cmn current current
      -cmninit 8.0 8.0
      -compallsen no no
      -ctl
      -ctlcount -1 -1
      -ctlincr 1 1
      -ctloffset 0 0
      -dict
      -dictcase no no
      -dither no no
      -doublebw no no
      -ds 1 1
      -fdict
      -feat 1s_c_d_dd 1s_c_d_dd
      -featparams
      -fillprob 1e-8 1.000000e-08
      -frate 100 100
      -fsg
      -fsgusealtpron yes yes
      -fsgusefiller yes yes
      -fwdflat yes yes
      -fwdflatbeam 1e-64 1.000000e-64
      -fwdflatefwid 4 4
      -fwdflatlw 8.5 8.500000e+00
      -fwdflatsfwin 25 25
      -fwdflatwbeam 7e-29 7.000000e-29
      -fwdtree yes yes
      -hmm
      -hyp
      -hypconf
      -hypseg
      -input_endian little little
      -jsgf
      -kdmaxbbi -1 -1
      -kdmaxdepth 0 0
      -kdtree
      -latsize 5000 5000
      -lda
      -ldadim 0 0
      -lifter 0 0
      -lm
      -lmctl
      -lmname default default
      -logbase 1.0001 1.000100e+00
      -logfn
      -logspec no no
      -lowerf 133.33334 1.333333e+02
      -lpbeam 1e-40 1.000000e-40
      -lponlybeam 7e-29 7.000000e-29
      -lw 6.5 6.500000e+00
      -maxhistpf 100 100
      -maxhmmpf -1 -1
      -maxnewoov 20 20
      -maxwpf -1 -1
      -mdef
      -mean
      -mfclogdir
      -mixw
      -mixwfloor 0.0000001 1.000000e-07
      -mllr
      -mllrctl
      -mllrdir
      -mmap yes yes
      -nbest 0 0
      -nbestdir
      -nbestext .hyp .hyp
      -ncep 13 13
      -nfft 512 512
      -nfilt 40 40
      -nwpen 1.0 1.000000e+00
      -outlatdir
      -pbeam 1e-48 1.000000e-48
      -pip 1.0 1.000000e+00
      -pl_beam 1e-10 1.000000e-10
      -pl_pbeam 1e-5 1.000000e-05
      -pl_window 0 0
      -rawlogdir
      -remove_dc no no
      -round_filters yes yes
      -samprate 16000 1.600000e+04
      -seed -1 -1
      -sendump
      -silprob 0.005 5.000000e-03
      -smoothspec no no
      -spec2cep no no
      -svspec
      -tmat
      -tmatfloor 0.0001 1.000000e-04
      -topn 4 4
      -topn_beam 0 0
      -toprule
      -transform legacy legacy
      -unit_area yes yes
      -upperf 6855.4976 6.855498e+03
      -usewdphones no no
      -uw 1.0 1.000000e+00
      -var
      -varfloor 0.0001 1.000000e-04
      -varnorm no no
      -verbose no no
      -warp_params
      -warp_type inverse_linear inverse_linear
      -wbeam 7e-29 7.000000e-29
      -wip 0.65 6.500000e-01
      -wlen 0.025625 2.562500e-02

      INFO: cmd_ln.c(510): Parsing command line:
      \
      -hmm /sphinx/wsj1 \
      -lm /sphinx/7647/7647.lm \
      -dict /sphinx/7647/7647.dic \
      -ctl /sphinx/eva_test.fileids \
      -cepext .wav \
      -adcin yes \
      -hyp /tmp/words.out \
      -samprate 8000

      Current configuration:
      [NAME] [DEFLT] [VALUE]
      -adchdr 0 0
      -adcin no yes
      -agc none none
      -agcthresh 2.0 2.000000e+00
      -alpha 0.97 9.700000e-01
      -argfile /sphinx/evatest.args
      -ascale 20.0 2.000000e+01
      -backtrace no no
      -beam 1e-48 1.000000e-48
      -bestpath yes yes
      -bestpathlw 9.5 9.500000e+00
      -cep2spec no no
      -cepdir
      -cepext .mfc .wav
      -ceplen 13 13
      -cmn current current
      -cmninit 8.0 8.0
      -compallsen no no
      -ctl /sphinx/eva_test.fileids
      -ctlcount -1 -1
      -ctlincr 1 1
      -ctloffset 0 0
      -dict /sphinx/7647/7647.dic
      -dictcase no no
      -dither no no
      -doublebw no no
      -ds 1 1
      -fdict
      -feat 1s_c_d_dd 1s_c_d_dd
      -featparams
      -fillprob 1e-8 1.000000e-08
      -frate 100 100
      -fsg
      -fsgusealtpron yes yes
      -fsgusefiller yes yes
      -fwdflat yes yes
      -fwdflatbeam 1e-64 1.000000e-64
      -fwdflatefwid 4 4
      -fwdflatlw 8.5 8.500000e+00
      -fwdflatsfwin 25 25
      -fwdflatwbeam 7e-29 7.000000e-29
      -fwdtree yes yes
      -hmm /sphinx/wsj1
      -hyp /tmp/words.out
      -hypconf
      -hypseg
      -input_endian little little
      -jsgf
      -kdmaxbbi -1 -1
      -kdmaxdepth 0 0
      -kdtree
      -latsize 5000 5000
      -lda
      -ldadim 0 0
      -lifter 0 0
      -lm /sphinx/7647/7647.lm
      -lmctl
      -lmname default default
      -logbase 1.0001 1.000100e+00
      -logfn
      -logspec no no
      -lowerf 133.33334 1.333333e+02
      -lpbeam 1e-40 1.000000e-40
      -lponlybeam 7e-29 7.000000e-29
      -lw 6.5 6.500000e+00
      -maxhistpf 100 100
      -maxhmmpf -1 -1
      -maxnewoov 20 20
      -maxwpf -1 -1
      -mdef
      -mean
      -mfclogdir
      -mixw
      -mixwfloor 0.0000001 1.000000e-07
      -mllr
      -mllrctl
      -mllrdir
      -mmap yes yes
      -nbest 0 0
      -nbestdir
      -nbestext .hyp .hyp
      -ncep 13 13
      -nfft 512 512
      -nfilt 40 40
      -nwpen 1.0 1.000000e+00
      -outlatdir
      -pbeam 1e-48 1.000000e-48
      -pip 1.0 1.000000e+00
      -pl_beam 1e-10 1.000000e-10
      -pl_pbeam 1e-5 1.000000e-05
      -pl_window 0 0
      -rawlogdir
      -remove_dc no no
      -round_filters yes yes
      -samprate 16000 8.000000e+03
      -seed -1 -1
      -sendump
      -silprob 0.005 5.000000e-03
      -smoothspec no no
      -spec2cep no no
      -svspec
      -tmat
      -tmatfloor 0.0001 1.000000e-04
      -topn 4 4
      -topn_beam 0 0
      -toprule
      -transform legacy legacy
      -unit_area yes yes
      -upperf 6855.4976 6.855498e+03
      -usewdphones no no
      -uw 1.0 1.000000e+00
      -var
      -varfloor 0.0001 1.000000e-04
      -varnorm no no
      -verbose no no
      -warp_params
      -warp_type inverse_linear inverse_linear
      -wbeam 7e-29 7.000000e-29
      -wip 0.65 6.500000e-01
      -wlen 0.025625 2.562500e-02

      INFO: cmd_ln.c(510): Parsing command line:
      \
      -lowerf 1 \
      -upperf 4000 \
      -nfilt 20 \
      -transform dct \
      -round_filters no \
      -remove_dc yes \
      -feat s2_4x

      Current configuration:
      [NAME] [DEFLT] [VALUE]
      -agc none none
      -agcthresh 2.0 2.000000e+00
      -alpha 0.97 9.700000e-01
      -cep2spec no no
      -ceplen 13 13
      -cmn current current
      -cmninit 8.0 8.0
      -dither no no
      -doublebw no no
      -feat 1s_c_d_dd s2_4x
      -frate 100 100
      -input_endian little little
      -lda
      -ldadim 0 0
      -lifter 0 0
      -logspec no no
      -lowerf 133.33334 1.000000e+00
      -ncep 13 13
      -nfft 512 512
      -nfilt 40 20
      -remove_dc no yes
      -round_filters yes no
      -samprate 16000 8.000000e+03
      -seed -1 -1
      -smoothspec no no
      -spec2cep no no
      -svspec
      -transform legacy dct
      -unit_area yes yes
      -upperf 6855.4976 4.000000e+03
      -varnorm no no
      -verbose no no
      -warp_params
      -warp_type inverse_linear inverse_linear
      -wlen 0.025625 2.562500e-02

      INFO: acmod.c(232): Parsed model-specific feature parameters from /sphinx/wsj1/feat.params
      INFO: feat.c(848): Initializing feature stream to type: 's2_4x', ceplen=13, CMN='current', VARNORM='no', AGC='none'
      INFO: cmn.c(142): mean[0]= 12.00, mean[1..12]= 0.0
      INFO: mdef.c(520): Reading model definition: /sphinx/wsj1/mdef
      INFO: mdef.c(531): Found byte-order mark BMDF, assuming this is a binary mdef file
      INFO: bin_mdef.c(316): Reading binary model definition: /sphinx/wsj1/mdef
      INFO: bin_mdef.c(326): Must byte-swap /sphinx/wsj1/mdef
      WARNING: "bin_mdef.c", line 386: -mmap specified, but mdef is other-endian. Will not memory-map.
      INFO: bin_mdef.c(495): 44 CI-phone, 66516 CD-phone, 5 emitstate/phone, 220 CI-sen, 5220 Sen, 18660 Sen-Seq
      INFO: tmat.c(205): Reading HMM transition probability matrices: /sphinx/wsj1/transition_matrices
      FATAL_ERROR: "tmat.c", line 254: /sphinx/wsj1/transition_matrices: #float32s(1320) doesn't match dimensions: 0 x 5 x 6

       
      • Nickolay V. Shmyrev

        It doesn't look like a byteorder problem:

        /* Read #tmat, #from-states, #to-states, arraysize */
        if ((bio_fread(&(t->n_tmat), sizeof(int32), 1, fp, byteswap, &chksum)
             != 1)
            || (bio_fread(&n_src, sizeof(int32), 1, fp, byteswap, &chksum) !=
                1)
            || (bio_fread(&n_dst, sizeof(int32), 1, fp, byteswap, &chksum) !=
                1)
            || (bio_fread(&i, sizeof(int32), 1, fp, byteswap, &chksum) != 1)) {
            E_FATAL("bio_fread(%s) (arraysize) failed\n", file_name);
        }
        

        n_tmat is read as 0, n_src and n_dst is read as 5 and 6 as expected. More likely it's some bug related to ppc. It needs additional debugging but I think it's easy to fix.

         

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.