Repository: PaddlePaddle/PaddleSpeech

Issue #1426: TypeError: resample() takes 1 positional argument but 3 were given
Created: 2022-02-08T08:28:20Z
ENV
Ubuntu 18.04.6 LTS
paddleaudio               0.1.0                    pypi_0    pypi
paddlenlp                 2.2.4                    pypi_0    pypi
paddlepaddle              2.2.2                    pypi_0    pypi
paddlespeech              0.1.1                    pypi_0    pypi
paddlespeech-ctcdecoders  0.1.1                    pypi_0    pypi
paddlespeech-feat         0.1.0                    pypi_0    pypi
I dont know why the same code and env can run on another server.
[2022-02-08 16:25:19,939] [   ERROR] - resample() takes 1 positional argument but 3 were given
Traceback (most recent call last):
File "/home/tianrking/anaconda3/envs/fastapi/lib/python3.7/site-packages/paddlespeech/cli/asr/infer.py", line 414, in execute
decode_method, force_yes, device)
File "/home/tianrking/anaconda3/envs/fastapi/lib/python3.7/site-packages/paddlespeech/cli/utils.py", line 335, in _warpper
return executor_func(self, *args, **kwargs)
File "/home/tianrking/anaconda3/envs/fastapi/lib/python3.7/site-packages/paddlespeech/cli/asr/infer.py", line 439, in call
self.preprocess(model, audio_file)
File "/home/tianrking/anaconda3/envs/fastapi/lib/python3.7/site-packages/paddlespeech/cli/asr/infer.py", line 256, in preprocess
self.sample_rate)
TypeError: resample() takes 1 positional argument but 3 were given

Duplicate issue #1435: TypeError: resample() takes 1 positional argument but 3 were given
Created: 2022-02-10T07:05:29Z
Input
paddlespeech asr --model transformer_librispeech --lang en --input ./output_from_your_TTS_code.wav 
Log
[2022-02-10 14:53:08,504] [    INFO] - checking the audio file format...... [2022-02-10 14:53:08,504] [    INFO] - The sample rate is 22050 [2022-02-10 14:53:08,504] [ WARNING] - The sample rate of the input file is not 16000. The program will resample the wav file to 16000. If the result does not meet your expectations， Please input the 16k 16 bit 1 channel wav file.                          [2022-02-10 14:53:08,504] [    INFO] - Whether to change the sample rate and the channel. Y: change the sample. N: exit the prgream. Input(Y/N):y [2022-02-10 14:53:26,614] [    INFO] - change the sampele rate, channel to 16k and 1 channel [2022-02-10 14:53:26,614] [    INFO] - File /home/xxx/.paddlespeech/models/transformer_librispeech-en-16k/asr1_transformer_librispeech_ckpt_0.1.1.model.tar.gz md5 checking... [2022-02-10 14:53:27,976] [    INFO] - Use pretrained model stored in: /home/xxx/.paddlespeech/models/transformer_librispeech-en-16k/asr1_transformer_librispeech_ckpt_0.1.1.model.tar [2022-02-10 14:53:27,976] [    INFO] - /home/xxx/.paddlespeech/models/transformer_librispeech-en-16k/asr1_transformer_librispeech_ckpt_0.1.1.model.tar [2022-02-10 14:53:27,976] [    INFO] - /home/xxx/.paddlespeech/models/transformer_librispeech-en-16k/asr1_transformer_librispeech_ckpt_0.1.1.model.tar/model.yaml [2022-02-10 14:53:27,976] [    INFO] - /home/xxx/.paddlespeech/models/transformer_librispeech-en-16k/asr1_transformer_librispeech_ckpt_0.1.1.model.tar/exp/transformer/checkpoints/avg_10.pdparams [2022-02-10 14:53:29,345] [    INFO] - Preprocess audio_file:/home/xxx/Projects/Paddle-speech/output.wav [2022-02-10 14:53:29,345] [    INFO] - get the preprocess conf [2022-02-10 14:53:29,368] [    INFO] - read the audio file [2022-02-10 14:53:29,369] [   ERROR] - resample() takes 1 positional argument but 3 were given Traceback (most recent call last): File "/home/xxx/miniconda3/envs/paddle-speech/lib/python3.7/site-packages/paddlespeech/cli/asr/infer.py", line 414, in execute decode_method, force_yes, device) File "/home/xxx/miniconda3/envs/paddle-speech/lib/python3.7/site-packages/paddlespeech/cli/utils.py", line 335, in _warpper return executor_func(self, *args, **kwargs) File "/home/xxx/miniconda3/envs/paddle-speech/lib/python3.7/site-packages/paddlespeech/cli/asr/infer.py", line 439, in __call__ self.preprocess(model, audio_file) File "/home/xxx/miniconda3/envs/paddle-speech/lib/python3.7/site-packages/paddlespeech/cli/asr/infer.py", line 256, in preprocess self.sample_rate) TypeError: resample() takes 1 positional argument but 3 were given 
In a word, when the audio sample rate is not 8000 or 16000, it has to be resampled to 16000, then a TypeError appears.

Closing comment (2022-02-10T07:24:15Z): Duplicate of #1426