Add timestamps for offline paraformer (#310)

This commit is contained in:
Fangjun Kuang
2023-09-14 19:33:41 +08:00
committed by GitHub
parent 47184f9db7
commit e2be532b32
11 changed files with 175 additions and 33 deletions

View File

@@ -14,6 +14,11 @@ namespace sherpa_onnx {
struct OfflineParaformerDecoderResult {
/// The decoded token IDs
std::vector<int64_t> tokens;
// it contains the start time of each token in seconds
//
// len(timestamps) == len(tokens)
std::vector<float> timestamps;
};
class OfflineParaformerDecoder {
@@ -28,7 +33,8 @@ class OfflineParaformerDecoder {
* @return Return a vector of size `N` containing the decoded results.
*/
virtual std::vector<OfflineParaformerDecoderResult> Decode(
Ort::Value log_probs, Ort::Value token_num) = 0;
Ort::Value log_probs, Ort::Value token_num,
Ort::Value us_cif_peak = Ort::Value(nullptr)) = 0;
};
} // namespace sherpa_onnx