mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
* add cmakelist * add paraformer-torch * add debug for funasr-onnx-offline * fix redefinition of jieba StdExtension.hpp * add loading torch models * update funasr-onnx-offline * add SwitchArg for wss-server * add SwitchArg for funasr-onnx-offline * update cmakelist * update funasr-onnx-offline-rtf * add define condition * add gpu define for offlne-stream * update com define * update offline-stream * update cmakelist * update func CompileHotwordEmbedding * add timestamp for paraformer-torch * add C10_USE_GLOG for paraformer-torch * update paraformer-torch * fix func FunASRWfstDecoderInit * update model.h * fix func FunASRWfstDecoderInit * fix tpass_stream * update paraformer-torch * add bladedisc for funasr-onnx-offline * update comdefine * update funasr-wss-server * add log for torch * fix GetValue BLADEDISC * fix log * update cmakelist * update warmup to 10 * update funasrruntime * add batch_size for wss-server * add batch for bins * add batch for offline-stream * add batch for paraformer * add batch for offline-stream * fix func SetBatchSize * add SetBatchSize for model * add SetBatchSize for model * fix func Forward * fix padding * update funasrruntime * add dec reset for batch * set batch default value * add argv for CutSplit * sort frame_queue * sorted msgs * fix FunOfflineInfer * add dynamic batch for fetch * fix FetchDynamic * update run_server.sh * update run_server.sh * cpp http post server support (#1739) * add cpp http server * add some comment * remove some comments * del debug infos * restore run_server.sh * adapt to new model struct * 修复了onnxruntime在macos下编译失败的错误 (#1748) * Add files via upload 增加macos的编译支持 * Add files via upload 增加macos支持 * Add files via upload target_link_directories(funasr PUBLIC ${ONNXRUNTIME_DIR}/lib) target_link_directories(funasr PUBLIC ${FFMPEG_DIR}/lib) 添加 if(APPLE) 限制 --------- Co-authored-by: Yabin Li <wucong.lyb@alibaba-inc.com> * Delete docs/images/wechat.png * Add files via upload * fixed the issues about seaco-onnx timestamp * fix bug (#1764) 当语音识别结果包含 `http` 时,标点符号预测会把它会被当成 url * fix empty asr result (#1765) 解码结果为空的语音片段,text 用空字符串 * docs * docs * docs * docs * docs * keep empty speech result (#1772) * docs * docs * update wechat QRcode * Add python funasr api support for websocket srv (#1777) * add python funasr_api supoort * change little to README.md * add core tools stream * modified a little * fix bug for timeout * support for buffer decode * add ffmpeg decode for buffer * auto frontend * auto frontend --------- Co-authored-by: 雾聪 <wucong.lyb@alibaba-inc.com> Co-authored-by: zhaomingwork <61895407+zhaomingwork@users.noreply.github.com> Co-authored-by: szsteven008 <97944818+szsteven008@users.noreply.github.com> Co-authored-by: Ephemeroptera <605686962@qq.com> Co-authored-by: 彭震东 <zhendong.peng@qq.com> Co-authored-by: Shi Xian <40013335+R1ckShi@users.noreply.github.com> Co-authored-by: 维石 <shixian.shi@alibaba-inc.com>
158 lines
3.0 KiB
C++
158 lines
3.0 KiB
C++
#ifndef LIMONP_STD_EXTEMSION_HPP
|
|
#define LIMONP_STD_EXTEMSION_HPP
|
|
|
|
#include <map>
|
|
|
|
#ifdef __APPLE__
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#elif(__cplusplus >= 201103L)
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#elif defined _MSC_VER
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#else
|
|
#include <tr1/unordered_map>
|
|
#include <tr1/unordered_set>
|
|
namespace std {
|
|
using std::tr1::unordered_map;
|
|
using std::tr1::unordered_set;
|
|
}
|
|
|
|
#endif
|
|
|
|
#include <set>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <deque>
|
|
#include <fstream>
|
|
#include <sstream>
|
|
|
|
namespace std {
|
|
|
|
template<typename T>
|
|
ostream& operator << (ostream& os, const vector<T>& v) {
|
|
if(v.empty()) {
|
|
return os << "[]";
|
|
}
|
|
os<<"["<<v[0];
|
|
for(size_t i = 1; i < v.size(); i++) {
|
|
os<<", "<<v[i];
|
|
}
|
|
os<<"]";
|
|
return os;
|
|
}
|
|
|
|
template<>
|
|
inline ostream& operator << (ostream& os, const vector<string>& v) {
|
|
if(v.empty()) {
|
|
return os << "[]";
|
|
}
|
|
os<<"[\""<<v[0];
|
|
for(size_t i = 1; i < v.size(); i++) {
|
|
os<<"\", \""<<v[i];
|
|
}
|
|
os<<"\"]";
|
|
return os;
|
|
}
|
|
|
|
template<typename T>
|
|
ostream& operator << (ostream& os, const deque<T>& dq) {
|
|
if(dq.empty()) {
|
|
return os << "[]";
|
|
}
|
|
os<<"[\""<<dq[0];
|
|
for(size_t i = 1; i < dq.size(); i++) {
|
|
os<<"\", \""<<dq[i];
|
|
}
|
|
os<<"\"]";
|
|
return os;
|
|
}
|
|
|
|
#ifndef USE_GPU
|
|
template<class T1, class T2>
|
|
ostream& operator << (ostream& os, const pair<T1, T2>& pr) {
|
|
os << pr.first << ":" << pr.second ;
|
|
return os;
|
|
}
|
|
#endif
|
|
|
|
template<class T>
|
|
string& operator << (string& str, const T& obj) {
|
|
stringstream ss;
|
|
ss << obj; // call ostream& operator << (ostream& os,
|
|
return str = ss.str();
|
|
}
|
|
|
|
template<class T1, class T2>
|
|
ostream& operator << (ostream& os, const map<T1, T2>& mp) {
|
|
if(mp.empty()) {
|
|
os<<"{}";
|
|
return os;
|
|
}
|
|
os<<'{';
|
|
typename map<T1, T2>::const_iterator it = mp.begin();
|
|
os<<*it;
|
|
it++;
|
|
while(it != mp.end()) {
|
|
os<<", "<<*it;
|
|
it++;
|
|
}
|
|
os<<'}';
|
|
return os;
|
|
}
|
|
template<class T1, class T2>
|
|
ostream& operator << (ostream& os, const std::unordered_map<T1, T2>& mp) {
|
|
if(mp.empty()) {
|
|
return os << "{}";
|
|
}
|
|
os<<'{';
|
|
typename std::unordered_map<T1, T2>::const_iterator it = mp.begin();
|
|
os<<*it;
|
|
it++;
|
|
while(it != mp.end()) {
|
|
os<<", "<<*it++;
|
|
}
|
|
return os<<'}';
|
|
}
|
|
|
|
template<class T>
|
|
ostream& operator << (ostream& os, const set<T>& st) {
|
|
if(st.empty()) {
|
|
os << "{}";
|
|
return os;
|
|
}
|
|
os<<'{';
|
|
typename set<T>::const_iterator it = st.begin();
|
|
os<<*it;
|
|
it++;
|
|
while(it != st.end()) {
|
|
os<<", "<<*it;
|
|
it++;
|
|
}
|
|
os<<'}';
|
|
return os;
|
|
}
|
|
|
|
template<class KeyType, class ContainType>
|
|
bool IsIn(const ContainType& contain, const KeyType& key) {
|
|
return contain.end() != contain.find(key);
|
|
}
|
|
|
|
template<class T>
|
|
basic_string<T> & operator << (basic_string<T> & s, ifstream & ifs) {
|
|
return s.assign((istreambuf_iterator<T>(ifs)), istreambuf_iterator<T>());
|
|
}
|
|
|
|
template<class T>
|
|
ofstream & operator << (ofstream & ofs, const basic_string<T>& s) {
|
|
ostreambuf_iterator<T> itr (ofs);
|
|
copy(s.begin(), s.end(), itr);
|
|
return ofs;
|
|
}
|
|
|
|
} // namespace std
|
|
|
|
#endif
|