sherpa-onnx icon indicating copy to clipboard operation
sherpa-onnx copied to clipboard

Obtaining Encoder Features

Open magacc1 opened this issue 1 year ago • 1 comments

I'm looking to use some of the pretrained speech recognizers and compute their encoder output features in real-time.

When I'm looking at the API of _Recognizer / _sherpa_onnx.OnlineRecognizer as defined here

I see only the following methods, and cannot find a way to get access to specifically compute the encoder outputs: 'create_stream', 'decode_stream', 'decode_streams', 'get_result', 'is_endpoint', 'is_ready', 'reset'

Can anyone help provide pointers on how to get the encoder features, or find the code underneath decode_stream and break it down to compute the encoder results?

Thanks!

magacc1 avatar May 19 '24 22:05 magacc1

We don't provide such an API as general users don't need it.

Can anyone help provide pointers on how to get the encoder features

For the online transducers, you can take a look at https://github.com/k2-fsa/sherpa-onnx/blob/8af2af84664d3285ba452bf453bb928a3eb6e978/sherpa-onnx/csrc/online-recognizer-transducer-impl.h#L224-L225

csukuangfj avatar May 20 '24 01:05 csukuangfj

Thanks Fangjun!

magacc1 avatar Jun 13 '24 19:06 magacc1