mirror of
https://github.com/k2-fsa/sherpa-onnx.git
synced 2026-01-09 07:41:06 +08:00
This PR adds RK NPU support for SenseVoice non-streaming ASR models by implementing a new RKNN backend with greedy CTC decoding. - Adds offline RKNN implementation for SenseVoice models including model loading, feature processing, and CTC decoding - Introduces export tools to convert SenseVoice models from PyTorch to ONNX and then to RKNN format - Implements provider-aware validation to prevent mismatched model and provider usage
29 lines
767 B
C++
29 lines
767 B
C++
// sherpa-onnx/csrc/rknn/offline-ctc-greedy-search-decoder-rknn.h
|
|
//
|
|
// Copyright (c) 2025 Xiaomi Corporation
|
|
|
|
#ifndef SHERPA_ONNX_CSRC_RKNN_OFFLINE_CTC_GREEDY_SEARCH_DECODER_RKNN_H_
|
|
#define SHERPA_ONNX_CSRC_RKNN_OFFLINE_CTC_GREEDY_SEARCH_DECODER_RKNN_H_
|
|
|
|
#include <vector>
|
|
|
|
#include "sherpa-onnx/csrc/offline-ctc-decoder.h"
|
|
|
|
namespace sherpa_onnx {
|
|
|
|
class OfflineCtcGreedySearchDecoderRknn {
|
|
public:
|
|
explicit OfflineCtcGreedySearchDecoderRknn(int32_t blank_id)
|
|
: blank_id_(blank_id) {}
|
|
|
|
OfflineCtcDecoderResult Decode(const float *logits, int32_t num_frames,
|
|
int32_t vocab_size);
|
|
|
|
private:
|
|
int32_t blank_id_;
|
|
};
|
|
|
|
} // namespace sherpa_onnx
|
|
|
|
#endif // SHERPA_ONNX_CSRC_RKNN_OFFLINE_CTC_GREEDY_SEARCH_DECODER_RKNN_H_
|