-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wenet] Add the context decoding graph, which supports context biasin… #1931
Conversation
…g during the ctc_prefix_beam_search and attention_rescoring
wenet/transformer/asr_model.py
Outdated
@@ -433,6 +434,101 @@ def _ctc_prefix_beam_search( | |||
hyps = [(y[0], log_add([y[1][0], y[1][1]])) for y in cur_hyps] | |||
return hyps, encoder_out | |||
|
|||
def _ctc_prefix_beam_search_with_bias( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add context_graph directly in _ctc_prefix_beam_search?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I directly add the context_graph into _ctc_prefix_beam_search in the new commit
@pengzhendong please follow the PR. |
wenet/transformer/asr_model.py
Outdated
reverse=True) | ||
cur_hyps = next_hyps[:beam_size] | ||
hyps = [(y[0], log_add([y[1][0], y[1][1]])) for y in cur_hyps] | ||
if context_graph is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we refer https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/ctc_prefix_beam_search.cc#L168 for how to combine the logic with/without context together?
Great job! |
哦,我找到3838条词表了,在你上传的bias_model 里有 |
3838热词是我通过合并test other上的所有真实热词得到的结果,这里2000的ref是对每条数据构建的,里面有很多干扰项。如果要用这个2000的热词列表,需要改下代码为每条数据构建一个热词解码图。你没有改的话很可能只是用了第一条数据的热词列表,这样实际上对于后面的句子都完全没有增强,你的结果中的整体wer和baseline比确实也没什么变化。关于你的uwer、bwer结果,我建议也测一个不带热词的结果来进行比较,因为大家算uwer和bwer的代码好像得出来的结果都不太一样,所以和自己测的BWER比会比较稳妥。 |
嗯,理解了 |
添加python版本的基于热词图的热词偏置代码,均使用wenet给出的预训练模型进行测试,U-WER和B-WER分别指热词之外单词的词错误率和在热词上的词错误率
WenetSpeech biasing子集organization-name测试集,使用attention rescoring解码应用热词图前后结果:
热词列表大小298,context score=2.0
数据集、热词列表路径:https://github.com/thuhcsi/Contextual-Biasing-Dataset/
Librispeech test-other测试集,使用attention rescoring解码应用热词图前后结果:
热词列表大小3838,合并了test-other每条数据包含的热词,context score=2.0
热词列表路径:https://github.com/facebookresearch/fbai-speech/tree/main/is21_deep_bias