Using custom beam scorer in TensorFlow CTC (language model)

回眸只為那壹抹淺笑 提交于 2019-12-03 14:57:31

There's currently no API for Python to use language model with a custom scorer. Contributions are welcome, but there's some difficulty in making this possible in the Python API as it would require running the TF LM sub-graph in an independent session inside the decoder op, and those wouldn't blend nicely together.

The easiest way of doing this is in C++ and requires extending the BaseBeamScorer class along with a BeamState (similar to what can be seen in tests) and further run CTCBeamSearchDecoder::Decode on top of the outputs from the tensorflow graph that would normally go in the ctc_beam_search_decoder op.

By doing this, your BeamScorer implementation could make use of any language model you have at hand and simply needs to return the appropriate scores when expanding the beam from one state to another.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!