Skip to content

Commit f6b624d

Browse files
authored
add encoding=utf8 for text cli. (#2896)
1 parent b1d0658 commit f6b624d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

paddlespeech/cli/text/infer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def _init_from_path(self,
127127
if self.task == 'punc':
128128
# punc list
129129
self._punc_list = []
130-
with open(self.vocab_file, 'r') as f:
130+
with open(self.vocab_file, 'r', encoding='utf-8') as f:
131131
for line in f:
132132
self._punc_list.append(line.strip())
133133

@@ -178,12 +178,12 @@ def _init_from_path_new(self,
178178
if self.task == 'punc':
179179
# punc list
180180
self._punc_list = []
181-
with open(self.vocab_file, 'r') as f:
181+
with open(self.vocab_file, 'r', encoding='utf-8') as f:
182182
for line in f:
183183
self._punc_list.append(line.strip())
184184

185185
# model
186-
with open(self.cfg_path) as f:
186+
with open(self.cfg_path, 'r', encoding='utf-8') as f:
187187
config = CfgNode(yaml.safe_load(f))
188188
self.model = ErnieLinear(**config["model"])
189189

0 commit comments

Comments
 (0)