csukuangfj Haujet commited on
Commit
f2de7e7
1 Parent(s): 3ace62f

Add utf-8 encoding parameter when opening text files, to prevent gbk errors on Windows when language is Chinese (#1)

Browse files

- Add utf-8 encoding parameter when opening text files, to prevent gbk errors on Windows when language is Chinese (5fdef6e33d87182d1dd4f9d9a99e3e9262825977)


Co-authored-by: Haujet Zhao <Haujet@users.noreply.huggingface.co>

Files changed (1) hide show
  1. add-model-metadata.py +2 -2
add-model-metadata.py CHANGED
@@ -28,7 +28,7 @@ def load_cmvn():
28
 
29
 
30
  def load_lfr_params():
31
- with open("config.yaml") as f:
32
  for line in f:
33
  if "lfr_m" in line:
34
  lfr_m = int(line.split()[-1])
@@ -41,7 +41,7 @@ def load_lfr_params():
41
 
42
 
43
  def get_vocab_size():
44
- with open("tokens.txt") as f:
45
  return len(f.readlines())
46
 
47
 
 
28
 
29
 
30
  def load_lfr_params():
31
+ with open("config.yaml", encoding="utf-8") as f:
32
  for line in f:
33
  if "lfr_m" in line:
34
  lfr_m = int(line.split()[-1])
 
41
 
42
 
43
  def get_vocab_size():
44
+ with open("tokens.txt", encoding="utf-8") as f:
45
  return len(f.readlines())
46
 
47