Spaces:
Sleeping
Sleeping
update
Browse files- examples/wenet/test.py +8 -8
examples/wenet/test.py
CHANGED
|
@@ -54,30 +54,30 @@ def main():
|
|
| 54 |
print(model_filename)
|
| 55 |
|
| 56 |
print("download tokens")
|
| 57 |
-
|
| 58 |
repo_id=args.repo_id,
|
| 59 |
filename=args.tokens_filename,
|
| 60 |
subfolder=".",
|
| 61 |
local_dir=model_dir.as_posix(),
|
| 62 |
)
|
| 63 |
-
print(
|
| 64 |
|
| 65 |
feat_config = sherpa.FeatureConfig(normalize_samples=False)
|
| 66 |
-
feat_config.fbank_opts.frame_opts.samp_freq =
|
| 67 |
feat_config.fbank_opts.mel_opts.num_bins = 80
|
| 68 |
feat_config.fbank_opts.frame_opts.dither = 0
|
| 69 |
|
| 70 |
config = sherpa.OfflineRecognizerConfig(
|
| 71 |
-
nn_model=
|
| 72 |
-
tokens=
|
| 73 |
use_gpu=False,
|
| 74 |
feat_config=feat_config,
|
| 75 |
-
decoding_method=
|
| 76 |
-
num_active_paths=
|
| 77 |
)
|
| 78 |
|
| 79 |
recognizer = sherpa.OfflineRecognizer(config)
|
| 80 |
-
|
| 81 |
return
|
| 82 |
|
| 83 |
|
|
|
|
| 54 |
print(model_filename)
|
| 55 |
|
| 56 |
print("download tokens")
|
| 57 |
+
tokens_filename = huggingface_hub.hf_hub_download(
|
| 58 |
repo_id=args.repo_id,
|
| 59 |
filename=args.tokens_filename,
|
| 60 |
subfolder=".",
|
| 61 |
local_dir=model_dir.as_posix(),
|
| 62 |
)
|
| 63 |
+
print(tokens_filename)
|
| 64 |
|
| 65 |
feat_config = sherpa.FeatureConfig(normalize_samples=False)
|
| 66 |
+
feat_config.fbank_opts.frame_opts.samp_freq = 16000
|
| 67 |
feat_config.fbank_opts.mel_opts.num_bins = 80
|
| 68 |
feat_config.fbank_opts.frame_opts.dither = 0
|
| 69 |
|
| 70 |
config = sherpa.OfflineRecognizerConfig(
|
| 71 |
+
nn_model=model_filename,
|
| 72 |
+
tokens=tokens_filename,
|
| 73 |
use_gpu=False,
|
| 74 |
feat_config=feat_config,
|
| 75 |
+
decoding_method="greedy_search",
|
| 76 |
+
num_active_paths=2,
|
| 77 |
)
|
| 78 |
|
| 79 |
recognizer = sherpa.OfflineRecognizer(config)
|
| 80 |
+
print(recognizer)
|
| 81 |
return
|
| 82 |
|
| 83 |
|