[SRILM User List] harmonizing results with/without '-use-server'
Andreas Stolcke
stolcke at icsi.berkeley.edu
Wed Apr 20 23:27:31 PDT 2011
In message <4DACADB5.2060700 at isi.edu>you wrote:
>
> Testing on a rather small language model, I notice that I get
> different results for a given input lattice/pfsg depending on whether
> I interrogate the LM directly on the command line or resident in a
> server.
>
> Precisely, the server is started thus:
>
> ngram -lm data/lm5a.lm -unk -server-port 2525
>
> and then invoked via a command such as
>
> lattice-tool -in-lattice simple.pfsg -use-server 2525 at cent64.isi.edu
> -nbest-decode 10 -out-nbest-dir server-out/
>
> while the command line version is invoked thus:
>
> lattice-tool -unk -in-lattice simple.pfsg -lm data/lm5a.lm
> -nbest-decode 10 -out-nbest-dir cmdline-out/
>
> It's my intention and understanding that these two would be
> equivalent, but they are not. As far as I can tell, the nature of the
> discrepancy is that the server generates only acoustic probabilities,
> no LM probabilities (well, they are all 0). Also the order of
> returned results is different, but that very well could be due to the
> former issue. Finally, the acoustic probabilities are are equal
> (within a 10-best window) in the server-based case, but vary slightly
> in the command line-based case.
>
> I'd like to have results equivalent to the command-line invocation,
> but with the potential speedup provided by the
> -server-port/-use-server case. Is this possible, and if so, which
> parameter adjustments do I need to make?
Andrew,
due to a bug, the -use-server LM was completely ignored in nbest generation.
The patch below will fix this and should give you the expected results.
Andreas
diff -c -r1.155 lattice-tool.cc
*** lattice/src/lattice-tool.cc 29 Jan 2011 05:56:35 -0000 1.155
--- lattice/src/lattice-tool.cc 19 Apr 2011 00:25:54 -0000
***************
*** 544,550 ****
}
if (viterbiDecode) {
! LM *plm = lmFile ? &lm : 0;
if (outputCTM) {
NBestWordInfo *bestwords = new NBestWordInfo[maxWordsPerLine + 1];
--- 544,550 ----
}
if (viterbiDecode) {
! LM *plm = (lmFile || useServer) ? &lm : 0;
if (outputCTM) {
NBestWordInfo *bestwords = new NBestWordInfo[maxWordsPerLine + 1];
***************
*** 610,616 ****
nbestMaxHyps, nbestDuplicates);
}
} else {
! LM *plm = lmFile ? &lm : 0;
lat.decodeNBest(nbestDecode, nbestOut, noiseWords, plm,
order, maxDegree,
beamwidth > 0.0 ?
--- 610,616 ----
nbestMaxHyps, nbestDuplicates);
}
} else {
! LM *plm = (lmFile || useServer) ? &lm : 0;
lat.decodeNBest(nbestDecode, nbestOut, noiseWords, plm,
order, maxDegree,
beamwidth > 0.0 ?
More information about the SRILM-User
mailing list