HoneyTian commited on
Commit
d39598e
1 Parent(s): 26dfa9a
examples/wenet/infer.py CHANGED
@@ -39,8 +39,11 @@ def main():
39
  args = get_args()
40
 
41
  model_dir = Path(args.model_dir)
42
- model_filename = model_dir / "final.zip"
43
- tokens_filename = model_dir / "units.txt"
 
 
 
44
 
45
  feat_config = sherpa.FeatureConfig(normalize_samples=False)
46
  feat_config.fbank_opts.frame_opts.samp_freq = args.sample_rate
@@ -48,8 +51,8 @@ def main():
48
  feat_config.fbank_opts.frame_opts.dither = 0
49
 
50
  config = sherpa.OfflineRecognizerConfig(
51
- nn_model=model_filename.as_posix(),
52
- tokens=tokens_filename.as_posix(),
53
  use_gpu=False,
54
  feat_config=feat_config,
55
  decoding_method="greedy_search",
 
39
  args = get_args()
40
 
41
  model_dir = Path(args.model_dir)
42
+ nn_model_file = model_dir / "final.zip"
43
+ tokens_file = model_dir / "units.txt"
44
+
45
+ print("nn_model_file: {}".format(nn_model_file))
46
+ print("tokens_file: {}".format(tokens_file))
47
 
48
  feat_config = sherpa.FeatureConfig(normalize_samples=False)
49
  feat_config.fbank_opts.frame_opts.samp_freq = args.sample_rate
 
51
  feat_config.fbank_opts.frame_opts.dither = 0
52
 
53
  config = sherpa.OfflineRecognizerConfig(
54
+ nn_model=nn_model_file.as_posix(),
55
+ tokens=tokens_file.as_posix(),
56
  use_gpu=False,
57
  feat_config=feat_config,
58
  decoding_method="greedy_search",
toolbox/k2_sherpa/models.py CHANGED
@@ -103,6 +103,11 @@ def load_recognizer(repo_id: str,
103
  )
104
 
105
  if recognizer_type == EnumRecognizerType.sherpa_offline_recognizer.value:
 
 
 
 
 
106
  recognizer = load_sherpa_offline_recognizer(
107
  nn_model_file=nn_model_file,
108
  tokens_file=tokens_file,
@@ -110,7 +115,7 @@ def load_recognizer(repo_id: str,
110
  num_active_paths=num_active_paths,
111
  )
112
  else:
113
- raise NotImplementedError("recognizer_type not support: {}".format(recognizer_type.value))
114
  return recognizer
115
 
116
 
 
103
  )
104
 
105
  if recognizer_type == EnumRecognizerType.sherpa_offline_recognizer.value:
106
+ print("nn_model_file: {}".format(nn_model_file))
107
+ print("tokens_file: {}".format(tokens_file))
108
+ print("decoding_method: {}".format(decoding_method))
109
+ print("num_active_paths: {}".format(num_active_paths))
110
+
111
  recognizer = load_sherpa_offline_recognizer(
112
  nn_model_file=nn_model_file,
113
  tokens_file=tokens_file,
 
115
  num_active_paths=num_active_paths,
116
  )
117
  else:
118
+ raise NotImplementedError("recognizer_type not support: {}".format(recognizer_type))
119
  return recognizer
120
 
121