Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求助问题:ValueError: max() arg is an empty sequence #173

Closed
Lock1994 opened this issue Dec 25, 2024 · 8 comments
Closed

求助问题:ValueError: max() arg is an empty sequence #173

Lock1994 opened this issue Dec 25, 2024 · 8 comments

Comments

@Lock1994
Copy link

Lock1994 commented Dec 25, 2024

分割音频报ValueError: max() arg is an empty sequence错,是不是文件太大了?
在do_emb_extraction这步,抽取的音频长度都是0,更换了几个wav文件问题都一样
Rank 0 processing: 0%| | 0/1 [00:00<?, ?it/s]D:\AIGC\3D-Speaker\speakerlab\bin\1\3.wav
tensor([[0., 0., 0., ..., 0., 0., 0.]])
[]
0
Rank 0 processing: 0%| | 0/1 [00:03<?, ?it/s]
Traceback (most recent call last):
File "D:\AIGC\3D-Speaker\speakerlab\bin\infer_diarization.py", line 490, in
main()
File "D:\AIGC\3D-Speaker\speakerlab\bin\infer_diarization.py", line 487, in main
mp.spawn(main_process, nprocs=args.nprocs, args=(args.nprocs, args, wav_list))
File "C:\Users\aaa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\torch\multiprocessing\spawn.py", line 282, in spawn
return start_processes(fn, args, nprocs, join, daemon, start_method="spawn")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\aaa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\torch\multiprocessing\spawn.py", line 238, in start_processes
while not context.join():
^^^^^^^^^^^^^^
File "C:\Users\aaa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\torch\multiprocessing\spawn.py", line 189, in join
raise ProcessRaisedException(msg, error_index, failed_process.pid)
torch.multiprocessing.spawn.ProcessRaisedException:

-- Process 0 terminated with the following error:
Traceback (most recent call last):
File "C:\Users\aaa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\torch\multiprocessing\spawn.py", line 76, in _wrap
fn(i, *args)
File "D:\AIGC\3D-Speaker\speakerlab\bin\infer_diarization.py", line 437, in main_process
ouput = diarization(wav_path)
^^^^^^^^^^^^^^^^^^^^^
File "D:\AIGC\3D-Speaker\speakerlab\bin\infer_diarization.py", line 202, in call
embeddings = self.do_emb_extraction(chunks, wav_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AIGC\3D-Speaker\speakerlab\bin\infer_diarization.py", line 253, in do_emb_extraction
wavs = torch.stack(wavs).unsqueeze(1)
^^^^^^^^^^^^^^^^^
RuntimeError: stack expects a non-empty TensorList

@wanghuii1
Copy link
Collaborator

这些文件是静音吗,如果vad没有检测到有效音频会出现这个错误

@Lock1994
Copy link
Author

Lock1994 commented Dec 25, 2024

这些文件是静音吗,如果vad没有检测到有效音频会出现这个错误
不是静音文件,是有人声的,我试过3个wav文件,都在Vad这里过不去
File "C:\Users\aaa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\funasr\models\fsmn_vad_streaming\model.py", line 522, in GetFrameState
speech_prob = math.log(sum_score)
^^^^^^^^^^^^^^^^^^^
ValueError: math domain error
有测试样例的WAV文件吗?我再验证下

@wanghuii1
Copy link
Collaborator

你运行3D-Speaker/egs/3dspeaker/speaker-diarization/run_audio.sh,这个会下载测试音频

@wanghuii1
Copy link
Collaborator

这些文件是静音吗,如果vad没有检测到有效音频会出现这个错误
不是静音文件,是有人声的,我试过3个wav文件,都在Vad这里过不去
File "C:\Users\aaa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\funasr\models\fsmn_vad_streaming\model.py", line 522, in GetFrameState
speech_prob = math.log(sum_score)
^^^^^^^^^^^^^^^^^^^
ValueError: math domain error
有测试样例的WAV文件吗?我再验证下

看错误,是vad调用出错了,没有出结果,你可以单独调用这个模型看看https://modelscope.cn/models/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch

@Lock1994
Copy link
Author

Lock1994 commented Dec 28, 2024

这些文件是静音吗,如果vad没有检测到有效音频会出现这个错误
不是静音文件,是有人声的,我试过3个wav文件,都在Vad这里过不去
File "C:\Users\aaa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\funasr\models\fsmn_vad_streaming\model.py", line 522, in GetFrameState
speech_prob = math.log(sum_score)
^^^^^^^^^^^^^^^^^^^
ValueError: math domain error
有测试样例的WAV文件吗?我再验证下

看错误,是vad调用出错了,没有出结果,你可以单独调用这个模型看看https://modelscope.cn/models/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch

更换了VAD代码,新的问题
File "D:\AIGC\3D-Speaker\speakerlab\bin\infer_diarization.py", line 256, in do_emb_extraction
wavs = torch.stack(wavs).unsqueeze(1)
^^^^^^^^^^^^^^^^^
RuntimeError: stack expects a non-empty TensorList

@wanghuii1
Copy link
Collaborator

是指VAD代码更换你自己的吗

@Lock1994
Copy link
Author

Lock1994 commented Jan 2, 2025

是指VAD代码更换你自己的吗
是全部更换为https://modelscope.cn/models/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch/summary的VAD,问题如下,依然输不出结果
funasr version: 1.2.2.
2024-12-31 18:12:47,906 - modelscope - WARNING - No preprocessor field found in cfg.
2024-12-31 18:12:47,906 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file.
2024-12-31 18:12:47,906 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': 'iic/speech_fsmn_vad_zh-cn-16k-common-pytorch'}. trying to build by task and model information.
2024-12-31 18:12:47,906 - modelscope - WARNING - No preprocessor key ('funasr', 'voice-activity-detection') found in PREPROCESSOR_MAP, skip building preprocessor.
2024-12-31 18:12:47,913 - modelscope - INFO - cuda is not available, using cpu instead.
rtf_avg: 0.082: 100%|██████████| 1/1 [00:00<00:00, 1.17it/s]
[{'key': '4', 'value': []}]

@wanghuii1
Copy link
Collaborator

infer_diarization.py使用的vad就是https://modelscope.cn/models/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch,该vad的输出结果是空[{'key': '4', 'value': []}],说明该vad模型没有检测出有效语音,可以使用其他能检测出你的音频中语音的vad模型进行替换。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants