未验证 提交 f6b624dd 编写于 作者: Z zxcd 提交者: GitHub

add encoding=utf8 for text cli. (#2896)

上级 b1d0658e
......@@ -127,7 +127,7 @@ class TextExecutor(BaseExecutor):
if self.task == 'punc':
# punc list
self._punc_list = []
with open(self.vocab_file, 'r') as f:
with open(self.vocab_file, 'r', encoding='utf-8') as f:
for line in f:
self._punc_list.append(line.strip())
......@@ -178,12 +178,12 @@ class TextExecutor(BaseExecutor):
if self.task == 'punc':
# punc list
self._punc_list = []
with open(self.vocab_file, 'r') as f:
with open(self.vocab_file, 'r', encoding='utf-8') as f:
for line in f:
self._punc_list.append(line.strip())
# model
with open(self.cfg_path) as f:
with open(self.cfg_path, 'r', encoding='utf-8') as f:
config = CfgNode(yaml.safe_load(f))
self.model = ErnieLinear(**config["model"])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册