#2605 TaskCfg(cache_folder='D:/win-videotrans-v3.67-tiny/tmp/23588/speech2text', target_dir='E:/Doc/pyvideo/recogn', remove_no

103.196* Posted at: 2 hours ago 👁4

语音识别阶段出错:[阿里FunASR中文(本地)] 程序内部错误:expected Tensor as element 1 in argument 0, but got str:
Traceback (most recent call last):
File "videotrans\task\job.py", line 113, in run
File "videotrans\task\_speech2text.py", line 146, in recogn
File "videotrans\recognition\__init__.py", line 227, in run
File "videotrans\recognition\_base.py", line 80, in run
File "videotrans\recognition\_funasr.py", line 60, in _exec
File "funasr\auto\auto_model.py", line 306, in generate

return self.inference_with_vad(input, input_len=input_len, **cfg)

File "funasr\auto\auto_model.py", line 383, in inference_with_vad

res = self.inference(

File "funasr\auto\auto_model.py", line 345, in inference

res = model.inference(**batch, **kwargs)

File "D:\win-videotrans-v3.67-tiny\_internal\funasr\models\fsmn_vad_streaming\model.py", line 690, in inference

audio_sample = torch.cat((cache["prev_samples"], audio_sample_list[0]))

TypeError: expected Tensor as element 1 in argument 0, but got str

TaskCfg(cache_folder='D:/win-videotrans-v3.67-tiny/tmp/23588/speech2text', target_dir='E:/Doc/pyvideo/recogn', remove_noise=False, is_separate=False, detect_language='auto', subtitle_language=None, source_language=None, target_language=None, source_language_code=None, target_language_code=None, source_sub=None, target_sub='E:/Doc/pyvideo/recogn/2.srt', source_wav=None, source_wav_output=None, target_wav=None, target_wav_output=None, subtitles=None, novoice_mp4=None, noextname='2', shibie_audio='D:/win-videotrans-v3.67-tiny/tmp/23588/speech2text/2-1768190069.2065918.wav', targetdir_mp4=None, instrument=None, vocal=None, back_audio=None, background_music=None, app_mode='biaozhun', subtitle_type=0, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role=None, copysrt_rawvideo=False, clear_cache=False, translate_type=None, tts_type=None, recogn_type=2, model_name='paraformer-zh', split_type=0, voice_autorate=False, video_autorate=False, cuda=True, name='E:/Downloads/2.mp4', basename='2.mp4', ext='mp4', dirname='E:/Downloads', shound_del_name=None, uuid='810edf3880', remove_silent_mid=False, align_sub_audio=True, enable_diariz=False, nums_diariz=0, rephrase=0, only_out_mp4=False)


=
system:Windows-10-10.0.19045-SP0
version:v3.90
frozen:True
language:zh
root_dir:D:/win-videotrans-v3.67-tiny

1 Replies

这个错误是阿里FunASR本地语音识别模块在处理音频时出现的内部数据类型错误。根据错误堆栈信息,问题出现在 torch.cat 函数试图拼接一个张量(Tensor)和一个字符串(str),这通常意味着音频数据在预处理或缓存过程中出现了异常。

核心解决步骤:

  1. 检查音频文件格式:确保您输入的音频/视频文件是标准格式(如 MP3、WAV、MP4)。可以尝试使用其他软件(如格式工厂)将文件重新编码为标准格式再试。
  2. 清理临时文件并重启软件

    • 关闭 pyVideoTrans。
    • 删除软件根目录下的 tmp 文件夹(根据您的路径,是 D:/win-videotrans-v3.67-tiny/tmp)。
    • 重新启动软件,再次尝试识别。
  3. 更换语音识别渠道:如果上述方法无效,可以暂时切换到其他语音识别渠道,例如 faster-whisper(本地),看是否能正常工作。这有助于判断问题是否特定于FunASR模块。
  4. 检查CUDA环境(如果使用GPU):您启用了CUDA加速(cuda=True)。请确保您的NVIDIA驱动、CUDA和cuDNN版本与FunASR的要求兼容。如果环境配置复杂,可以尝试在软件主界面取消勾选“CUDA加速”,使用CPU模式运行FunASR,看错误是否消失。

如果问题依然存在,请提供 D:/win-videotrans-v3.67-tiny/logs/ 目录下最新的日志文件,以便进行更深入的分析。

请查看更多参考文档:

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Donate: https://ko-fi.com/jianchang512

Trending Questions