Skip to content

Commit

Permalink
add encoding=utf8 for text cli. (#2896)
Browse files Browse the repository at this point in the history
  • Loading branch information
zxcd authored Feb 8, 2023
1 parent b1d0658 commit f6b624d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions paddlespeech/cli/text/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _init_from_path(self,
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())

Expand Down Expand Up @@ -178,12 +178,12 @@ def _init_from_path_new(self,
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"])

Expand Down

0 comments on commit f6b624d

Please sign in to comment.