Skip to content

Commit 8da993b

Browse files
committed
fix fs bug
1 parent 788a306 commit 8da993b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

paddlespeech/cli/tts/infer.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ def __init__(self):
172172
type=str2bool,
173173
default=False,
174174
help="whether to usen onnxruntime inference.")
175+
self.parser.add_argument(
176+
'--fs',
177+
type=int,
178+
default=24000,
179+
help='sample rate for onnx models when use specified model files.')
175180

176181
def _init_from_path(
177182
self,
@@ -581,6 +586,7 @@ def execute(self, argv: List[str]) -> bool:
581586
spk_id = args.spk_id
582587
use_onnx = args.use_onnx
583588
cpu_threads = args.cpu_threads
589+
fs = args.fs
584590

585591
if not args.verbose:
586592
self.disable_task_loggers()
@@ -619,7 +625,8 @@ def execute(self, argv: List[str]) -> bool:
619625
device=device,
620626
output=output,
621627
use_onnx=use_onnx,
622-
cpu_threads=cpu_threads)
628+
cpu_threads=cpu_threads,
629+
fs=fs)
623630
task_results[id_] = res
624631
except Exception as e:
625632
has_exceptions = True
@@ -653,7 +660,8 @@ def __call__(self,
653660
device: str=paddle.get_device(),
654661
output: str='output.wav',
655662
use_onnx: bool=False,
656-
cpu_threads: int=2):
663+
cpu_threads: int=2,
664+
fs: int=24000):
657665
"""
658666
Python API to call an executor.
659667
"""
@@ -695,7 +703,8 @@ def __call__(self,
695703
voc_ckpt=voc_ckpt,
696704
lang=lang,
697705
device=device,
698-
cpu_threads=cpu_threads)
706+
cpu_threads=cpu_threads,
707+
fs=fs)
699708
self.infer_onnx(text=text, lang=lang, am=am, spk_id=spk_id)
700709
res = self.postprocess_onnx(output=output)
701710
return res

0 commit comments

Comments
 (0)