Begin to support CTC models (#119)
Please see https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-ctc/nemo/index.html for a list of pre-trained CTC models from NeMo.
This commit is contained in:
28
sherpa-onnx/csrc/offline-ctc-greedy-search-decoder.h
Normal file
28
sherpa-onnx/csrc/offline-ctc-greedy-search-decoder.h
Normal file
@@ -0,0 +1,28 @@
|
||||
// sherpa-onnx/csrc/offline-ctc-greedy-search-decoder.h
|
||||
//
|
||||
// Copyright (c) 2023 Xiaomi Corporation
|
||||
|
||||
#ifndef SHERPA_ONNX_CSRC_OFFLINE_CTC_GREEDY_SEARCH_DECODER_H_
|
||||
#define SHERPA_ONNX_CSRC_OFFLINE_CTC_GREEDY_SEARCH_DECODER_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "sherpa-onnx/csrc/offline-ctc-decoder.h"
|
||||
|
||||
namespace sherpa_onnx {
|
||||
|
||||
class OfflineCtcGreedySearchDecoder : public OfflineCtcDecoder {
|
||||
public:
|
||||
explicit OfflineCtcGreedySearchDecoder(int32_t blank_id)
|
||||
: blank_id_(blank_id) {}
|
||||
|
||||
std::vector<OfflineCtcDecoderResult> Decode(
|
||||
Ort::Value log_probs, Ort::Value log_probs_length) override;
|
||||
|
||||
private:
|
||||
int32_t blank_id_;
|
||||
};
|
||||
|
||||
} // namespace sherpa_onnx
|
||||
|
||||
#endif // SHERPA_ONNX_CSRC_OFFLINE_CTC_GREEDY_SEARCH_DECODER_H_
|
||||
Reference in New Issue
Block a user