DeepSpeech2 implementation detail not consistent with paper
https://github.com/PaddlePaddle/models/blob/develop/deep_speech_2/decoders/scorer_deprecated.py#L67
score = self._alpha * np.log(lm) + self._beta * np.log(word_cnt)
While in the original paper, there is no log with word_cnt.
@lispc Please note the if...else... condition outside this line. Users can set the flag log to choose whether return the score in log scale or in the original format. When in log scale, there should be a log operation with the word insertion term.
@kuke
no. the original formula is
so, maybe the correct code is
if log == False:
score = np.power(lm, self._alpha) * np.power(10, word_cnt * self._beta) # in exp format
else:
score = self._alpha * np.log(lm) + self._beta * word_cnt # as is original paper
?
@lispc I see.
Actually the deprecated Python decoder is based on the prefix beam search paper, which we have declared in the comments. For the right code of the formula above, you should refer to the corresponding line in the C++ decoder that we are using.
They two have difference in the word insertion term.
ok. got. Thanks~