sherpa-onnx
sherpa-onnx copied to clipboard
Confidence scores with Zipformer models
Hi all,
I am decoding a Zipformer model with sherpa-onnx (and K2/icefall) and I am wondering if there is any way to get confidence scores for the hypothesized tokens with sherpa-onnx-offlne or other tools.
If this is not possible, can you please share any hints on where I can get this information from the source-code or how I can generate the confidence scores? Information from K2/icefall scripts and programs will be helpful also.
Many thanks. Bac
Yes, it is possible.
Taking the greedy search as an example,
https://github.com/k2-fsa/sherpa-onnx/blob/03ff9db56e9ed7c0252ae036be333de5db75a746/sherpa-onnx/csrc/offline-transducer-greedy-search-decoder.cc#L52-L55
You can get the log_prob of a token from the above code.
Note that you can compute log_softmax from logit and then get the log_prob of the max token at time t
.
Thanks a lot, Fangjun. It helps!
https://github.com/k2-fsa/sherpa-onnx/pull/571