Example #1
0
 def __init__(self, model_dir, emb_file):
     """初始化TWE对象
     Args:
         model_dir: 模型目录路径
         emb_file: topical word embeddings模型文件
     """
     self._twe = familia.init_twe(model_dir, emb_file)
Example #2
0
    def __init__(self, model_dir, conf_file, emb_file = None):
        """
        初始化InferenceEngine,Tokenizer,TopicalWordEmbeddings对象指针

        Args:
            model_dir: 模型目录
            conf_file: 模型配置文件
            emb_file: TWE模型文件,可选参数
        """
        self._emb_file = emb_file
        self._inference_engine = familia.init_inference_engine(model_dir, conf_file, 1)
        self._tokenizer = familia.init_tokenizer(model_dir + "/vocab_info.txt")
        if self._emb_file is None:
            return
        self._twe = familia.init_twe(model_dir, emb_file)