PaddlePaddle / PaddleSpeech

Easy-to-use Speech Toolkit including Self-Supervised Learning model, SOTA/Streaming ASR with punctuation, Streaming TTS with text frontend, Speaker Verification System, End-to-End Speech Translation and Keyword Spotting. Won NAACL2022 Best Demo Award.
https://paddlespeech.readthedocs.io
Apache License 2.0
11.07k stars 1.85k forks source link

运行时报错list index out of range #3381

Open goudemaoningsir opened 1 year ago

goudemaoningsir commented 1 year ago

运行语音识别时报错:

from paddlespeech.cli.asr.infer import ASRExecutor asr = ASRExecutor() result = asr(audio_file="zh.wav") print(result) 我认为跑步最重要的就是给我带来了身体健康

[2023-07-07 08:27:47,581] [ ERROR] - list index out of range Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/paddlespeech/cli/asr/infer.py", line 323, in infer simulate_streaming=cfg.simulate_streaming) File "/usr/local/lib/python3.7/site-packages/decorator.py", line 232, in fun return caller(func, *(extras + args), kw) File "/usr/local/lib/python3.7/site-packages/paddle/fluid/dygraph/base.py", line 347, in _decorate_function return func(*args, *kwargs) File "/usr/local/lib/python3.7/site-packages/paddlespeech/s2t/models/u2/u2.py", line 826, in decode reverse_weight=reverse_weight) File "/usr/local/lib/python3.7/site-packages/paddlespeech/s2t/models/u2/u2.py", line 532, in attention_rescoring assert speech.shape[0] == speech_lengths.shape[0] IndexError: list index out of range Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.7/site-packages/paddlespeech/cli/utils.py", line 328, in _warpper return executor_func(self, args, kwargs) File "/usr/local/lib/python3.7/site-packages/paddlespeech/cli/asr/infer.py", line 512, in call res = self.postprocess() # Retrieve result of asr. File "/usr/local/lib/python3.7/site-packages/paddlespeech/cli/asr/infer.py", line 335, in postprocess return self._outputs["result"] KeyError: 'result'

gotoolkits commented 1 year ago

运行speech_web时出现同样的问题,不知道如何解决?

/demos/speech_web/speech_server$ python main.py --port 8010

2023-07-08 19:36:26.194 | INFO | paddlespeech.s2t.modules.embedding:init:150 - max len: 5000 [2023-07-08 19:36:28,923] [ 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.
[2023-07-08 19:36:29,492] [ ERROR] - list index out of range Traceback (most recent call last): File "/home/ubuntu/software/paddleSpeech/PaddleSpeech/.venv/lib/python3.8/site-packages/paddlespeech/cli/asr/infer.py", line 314, in infer result_transcripts = self.model.decode( File "/home/ubuntu/software/paddleSpeech/PaddleSpeech/.venv/lib/python3.8/site-packages/decorator.py", line 232, in fun return caller(func, *(extras + args), kw) File "/home/ubuntu/software/paddleSpeech/PaddleSpeech/.venv/lib/python3.8/site-packages/paddle/fluid/dygraph/base.py", line 347, in _decorate_function return func(*args, *kwargs) File "/home/ubuntu/software/paddleSpeech/PaddleSpeech/.venv/lib/python3.8/site-packages/paddlespeech/s2t/models/u2/u2.py", line 818, in decode hyp = self.attention_rescoring( File "/home/ubuntu/software/paddleSpeech/PaddleSpeech/.venv/lib/python3.8/site-packages/paddlespeech/s2t/models/u2/u2.py", line 532, in attention_rescoring assert speech.shape[0] == speech_lengths.shape[0] IndexError: list index out of range Traceback (most recent call last): File "main.py", line 65, in chatbot = Robot( File "/home/ubuntu/software/paddleSpeech/PaddleSpeech/demos/speech_web/speech_server/src/robot.py", line 26, in init self.warm_up_asrmodel(asr_init_path) File "/home/ubuntu/software/paddleSpeech/PaddleSpeech/demos/speech_web/speech_server/src/robot.py", line 39, in warm_up_asrmodel self.asr_model( File "/home/ubuntu/software/paddleSpeech/PaddleSpeech/.venv/lib/python3.8/site-packages/paddlespeech/cli/utils.py", line 328, in _warpper return executor_func(self, args, kwargs) File "/home/ubuntu/software/paddleSpeech/PaddleSpeech/.venv/lib/python3.8/site-packages/paddlespeech/cli/asr/infer.py", line 512, in call res = self.postprocess() # Retrieve result of asr. File "/home/ubuntu/software/paddleSpeech/PaddleSpeech/.venv/lib/python3.8/site-packages/paddlespeech/cli/asr/infer.py", line 335, in postprocess return self._outputs["result"] KeyError: 'result'

yaowt05 commented 1 year ago

paddlepaddle降级到2.4.2,或者手动编译最新的paddlespeech源代码均可

gotoolkits commented 1 year ago

@yaowt05 paddlepaddle降级到2.4.2后,已能正常启动。

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

sunqinbo commented 10 months ago

安装版本 (speech_env) dongao@deepin207:/data/works/html/data/source$ pip list|grep paddle paddle-bfloat 0.1.7 paddle2onnx 1.1.0 paddleaudio 1.1.0 paddlefsl 1.1.0 paddlenlp 2.5.2 paddlepaddle 2.5.2 paddlesde 0.2.5 paddleslim 2.4.1 paddlespeech 1.4.1 paddlespeech-ctcdecoders 0.2.0 paddlespeech-feat 0.1.0

问题处理: 1 AttributeError: module 'numpy' has no attribute 'complex'. np.complex was a deprecated alias for the builtin complex. To avoid this error in existing code, use complex by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.complex128 here. The aliases was originally deprecated in NumPy 1.20; 由于 paddlespeech 依赖中要求 librosa 版本0.8.1,而且 librosa库使用个了NumPy1.20之前的API导致的

pip install librosa==0.10.1

2 报错信息提示:ModuleNotFoundError: No module named 'paddle.nn.layer.layers' 报错信息:IndexError: list index out of range 由于 paddlepaddle 2.6.1版本 ,降级 paddlenlp 版本到 2.5.2问题得到解决 pip install paddlenlp==2.5.2

运行例子 paddlespeech text --task punc -v --input "你知道吗大部分时候你都在假装学习你在年初提出了一整面墙的todo list到了九月还没打上几个钩你的书架上陈列着全网最畅销的专业书籍" [2023-12-20 17:56:18,543] [ INFO] - loading configuration file /home/dongao/.paddlespeech/models/ernie_linear_p7_wudao-punc-zh/1.0/ernie_linear_p7_wudao-punc-zh.tar/ckpt/config.json [2023-12-20 17:56:18,545] [ INFO] - Model config ErnieConfig { "architectures": [ "ErnieForTokenClassification" ], "attention_probs_dropout_prob": 0.1, "enable_recompute": false, "fuse": false, "hidden_act": "relu", "hidden_dropout_prob": 0.1, "hidden_size": 768, "id2label": { "0": "LABEL_0", "1": "LABEL_1", "2": "LABEL_2", "3": "LABEL_3", "4": "LABEL_4", "5": "LABEL_5", "6": "LABEL_6", "7": "LABEL_7" }, "initializer_range": 0.02, "intermediate_size": 3072, "label2id": { "LABEL_0": 0, "LABEL_1": 1, "LABEL_2": 2, "LABEL_3": 3, "LABEL_4": 4, "LABEL_5": 5, "LABEL_6": 6, "LABEL_7": 7 }, "layer_norm_eps": 1e-12, "max_position_embeddings": 513, "model_type": "ernie", "num_attention_heads": 12, "num_hidden_layers": 12, "pad_token_id": 0, "paddlenlp_version": null, "pool_act": "tanh", "task_id": 0, "task_type_vocab_size": 3, "type_vocab_size": 2, "use_task_id": false, "vocab_size": 18000 }

[2023-12-20 17:56:33,740] [ INFO] - All model checkpoint weights were used when initializing ErnieForTokenClassification.

[2023-12-20 17:56:33,740] [ INFO] - All the weights of ErnieForTokenClassification were initialized from the model checkpoint at /home/dongao/.paddlespeech/models/ernie_linear_p7_wudao-punc-zh/1.0/ernie_linear_p7_wudao-punc-zh.tar/ckpt. If your task is similar to the task the model of the checkpoint was trained on, you can already use ErnieForTokenClassification for predictions without further training. [2023-12-20 17:56:33,761] [ INFO] - Already cached /home/dongao/.paddlenlp/models/ernie-1.0/vocab.txt [2023-12-20 17:56:33,776] [ INFO] - tokenizer config file saved in /home/dongao/.paddlenlp/models/ernie-1.0/tokenizer_config.json [2023-12-20 17:56:33,777] [ INFO] - Special tokens file saved in /home/dongao/.paddlenlp/models/ernie-1.0/special_tokens_map.json 你知道吗?大部分时候,你都在假装学习。你在年初提出了一整面墙的todolist,到了九月,还没打上几个钩。你的书架上,陈列着全网最畅销的专业书籍。

lihuikenny commented 3 days ago

paddlepaddle降级到2.4.2,或者手动编译最新的paddlespeech源代码均可

手动编译paddlespeech源码版本是0.0.0,而且运行代码似乎也不是用的自己编译的源码。仍然是调用的pip 库的源码