Merge branch 'main' of github.com:alibaba-damo-academy/FunASR

add
This commit is contained in:
游雁 2023-11-09 11:33:29 +08:00
commit 6985a4626b
6 changed files with 17 additions and 10 deletions

View File

@ -17,7 +17,7 @@
| [**Quick Start**](#quick-start) | [**Quick Start**](#quick-start)
| [**Runtime**](./runtime/readme.md) | [**Runtime**](./runtime/readme.md)
| [**Model Zoo**](#model-zoo) | [**Model Zoo**](#model-zoo)
| [**Contact**](#community-communication) | [**Contact**](#contact)
<a name="highlights"></a> <a name="highlights"></a>
@ -126,7 +126,7 @@ FunASR supports deploying pre-trained or further fine-tuned models for service.
For more detailed information, please refer to the [service deployment documentation](runtime/readme.md). For more detailed information, please refer to the [service deployment documentation](runtime/readme.md).
<a name="Community Communication"></a> <a name="contact"></a>
## Community Communication ## Community Communication
If you encounter problems in use, you can directly raise Issues on the github page. If you encounter problems in use, you can directly raise Issues on the github page.

View File

@ -548,7 +548,10 @@ def build_trainer(modelscope_dict,
init_param = modelscope_dict['init_model'] init_param = modelscope_dict['init_model']
cmvn_file = modelscope_dict['cmvn_file'] cmvn_file = modelscope_dict['cmvn_file']
seg_dict_file = modelscope_dict['seg_dict'] seg_dict_file = modelscope_dict['seg_dict']
if 'bpemodel' in modelscope_dict:
bpemodel = modelscope_dict['bpemodel'] bpemodel = modelscope_dict['bpemodel']
else:
bpemodel = None
# overwrite parameters # overwrite parameters
with open(config) as f: with open(config) as f:
@ -582,7 +585,7 @@ def build_trainer(modelscope_dict,
args.seg_dict_file = seg_dict_file args.seg_dict_file = seg_dict_file
else: else:
args.seg_dict_file = None args.seg_dict_file = None
if os.path.exists(bpemodel): if bpemodel is not None and os.path.exists(bpemodel):
args.bpemodel = bpemodel args.bpemodel = bpemodel
else: else:
args.bpemodel = None args.bpemodel = None

View File

@ -279,7 +279,7 @@ int main(int argc, char** argv)
// hotword file // hotword file
unordered_map<string, int> hws_map; unordered_map<string, int> hws_map;
std::string nn_hotwords_ = ""; std::string nn_hotwords_ = "";
std::string hotword_path = model_path.at(HOTWORD); std::string hotword_path = hotword.getValue();
LOG(INFO) << "hotword path: " << hotword_path; LOG(INFO) << "hotword path: " << hotword_path;
funasr::ExtractHws(hotword_path, hws_map, nn_hotwords_); funasr::ExtractHws(hotword_path, hws_map, nn_hotwords_);

View File

@ -113,7 +113,7 @@ int main(int argc, char** argv)
// hotword file // hotword file
unordered_map<string, int> hws_map; unordered_map<string, int> hws_map;
std::string nn_hotwords_ = ""; std::string nn_hotwords_ = "";
std::string hotword_path = model_path.at(HOTWORD); std::string hotword_path = hotword.getValue();
LOG(INFO) << "hotword path: " << hotword_path; LOG(INFO) << "hotword path: " << hotword_path;
funasr::ExtractHws(hotword_path, hws_map, nn_hotwords_); funasr::ExtractHws(hotword_path, hws_map, nn_hotwords_);

View File

@ -17,8 +17,12 @@ CTokenizer::CTokenizer():m_ready(false)
CTokenizer::~CTokenizer() CTokenizer::~CTokenizer()
{ {
if (jieba_dict_trie_){
delete jieba_dict_trie_; delete jieba_dict_trie_;
}
if (jieba_model_){
delete jieba_model_; delete jieba_model_;
}
} }
void CTokenizer::SetJiebaRes(cppjieba::DictTrie *dict, cppjieba::HMMModel *hmm) { void CTokenizer::SetJiebaRes(cppjieba::DictTrie *dict, cppjieba::HMMModel *hmm) {

View File

@ -17,8 +17,8 @@ private:
vector<string> m_id2token,m_id2punc; vector<string> m_id2token,m_id2punc;
map<string, int> m_token2id,m_punc2id; map<string, int> m_token2id,m_punc2id;
cppjieba::DictTrie *jieba_dict_trie_; cppjieba::DictTrie *jieba_dict_trie_=nullptr;
cppjieba::HMMModel *jieba_model_; cppjieba::HMMModel *jieba_model_=nullptr;
cppjieba::Jieba jieba_processor_; cppjieba::Jieba jieba_processor_;
public: public: