add batch for offline-stream
| | |
| | | int FetchTpass(AudioFrame *&frame); |
| | | int Fetch(float *&dout, int &len, int &flag); |
| | | int Fetch(float *&dout, int &len, int &flag, float &start_time); |
| | | int Fetch(float **&dout, int *&len, int *&flag, float*& start_time, int batch_size, int &batch_in); |
| | | void Padding(); |
| | | void Split(OfflineStream* offline_streamj); |
| | | void CutSplit(OfflineStream* offline_streamj); |
| | |
| | | _FUNASRAPI void CTTransformerUninit(FUNASR_HANDLE handle); |
| | | |
| | | //OfflineStream |
| | | _FUNASRAPI FUNASR_HANDLE FunOfflineInit(std::map<std::string, std::string>& model_path, int thread_num, bool use_gpu=false); |
| | | _FUNASRAPI FUNASR_HANDLE FunOfflineInit(std::map<std::string, std::string>& model_path, int thread_num, bool use_gpu=false, int batch_size=1); |
| | | _FUNASRAPI void FunOfflineReset(FUNASR_HANDLE handle, FUNASR_DEC_HANDLE dec_handle=nullptr); |
| | | // buffer |
| | | _FUNASRAPI FUNASR_RESULT FunOfflineInferBuffer(FUNASR_HANDLE handle, const char* sz_buf, int n_len, |
| | |
| | | virtual void InitLm(const std::string &lm_file, const std::string &lm_config, const std::string &lex_file){}; |
| | | virtual void InitFstDecoder(){}; |
| | | virtual std::string Forward(float *din, int len, bool input_finished, const std::vector<std::vector<float>> &hw_emb={{0.0}}, void* wfst_decoder=nullptr){return "";}; |
| | | virtual std::vector<std::string> Forward(float** din, int* len, bool input_finished, const std::vector<std::vector<float>> &hw_emb={{0.0}}, void* wfst_decoder=nullptr, int batch_in=1) |
| | | {return std::vector<string>();}; |
| | | virtual std::string Rescoring() = 0; |
| | | virtual void InitHwCompiler(const std::string &hw_model, int thread_num){}; |
| | | virtual void InitSegDict(const std::string &seg_dict_model){}; |
| | | virtual std::vector<std::vector<float>> CompileHotwordEmbedding(std::string &hotwords){return std::vector<std::vector<float>>();}; |
| | | virtual std::string GetLang(){return "";}; |
| | | virtual int GetAsrSampleRate() = 0; |
| | | virtual int GetBatchSize() {return 0;}; |
| | | virtual Vocab* GetVocab() {return nullptr;}; |
| | | virtual Vocab* GetLmVocab() {return nullptr;}; |
| | | virtual PhoneSet* GetPhoneSet() {return nullptr;}; |
| | |
| | | namespace funasr { |
| | | class OfflineStream { |
| | | public: |
| | | OfflineStream(std::map<std::string, std::string>& model_path, int thread_num, bool use_gpu=false); |
| | | OfflineStream(std::map<std::string, std::string>& model_path, int thread_num, bool use_gpu=false, int batch_size=1); |
| | | ~OfflineStream(){}; |
| | | |
| | | std::unique_ptr<VadModel> vad_handle= nullptr; |
| | |
| | | bool use_itn=false; |
| | | }; |
| | | |
| | | OfflineStream *CreateOfflineStream(std::map<std::string, std::string>& model_path, int thread_num=1, bool use_gpu=false); |
| | | OfflineStream *CreateOfflineStream(std::map<std::string, std::string>& model_path, int thread_num=1, bool use_gpu=false, int batch_size=1); |
| | | } // namespace funasr |
| | | #endif |