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

pull/2900/head
zxcd 2 years ago committed by GitHub
parent b1d0658ef8
commit f6b624ddc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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"])

Loading…
Cancel
Save