#2289 TaskCfg(cache_folder='C:/SOFT/pyvideotrans/tmp/32280/d74da984a2', target_dir='c:/soft/pyvideotrans/output/recogn', remov

14.212* Posted at: 7 hours ago 👁12

语音识别阶段出错 [阿里FunASR(本地)] 程序内部错误:未定义的变量 'None'
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 226, in run
File "videotrans\recognition\_base.py", line 80, in run
File "videotrans\recognition\_funasr.py", line 37, in _exec
File "videotrans\recognition\_funasr.py", line 144, in _exec1
File "funasr\auto\auto_model.py", line 125, in init

model, kwargs = self.build_model(**kwargs)

File "funasr\auto\auto_model.py", line 228, in build_model

tokenizer = tokenizer_class(**tokenizer_conf)

File "C:\SOFT\pyvideotrans\_internal\funasr\tokenizer\hf_tokenizer.py", line 11, in HuggingfaceTokenizer

tokenizer = AutoTokenizer.from_pretrained(init_param_path)

UnboundLocalError: local variable 'AutoTokenizer' referenced before assignment

TaskCfg(cache_folder='C:/SOFT/pyvideotrans/tmp/32280/d74da984a2', target_dir='c:/soft/pyvideotrans/output/recogn', remove_noise=False, is_separate=False, detect_language='zh-cn', subtitle_language=None, source_language=None, target_language=None, source_language_code=None, target_language_code=None, source_sub=None, target_sub='c:/soft/pyvideotrans/output/recogn/720.srt', source_wav=None, source_wav_output=None, target_wav=None, target_wav_output=None, subtitles=None, novoice_mp4=None, noextname='720', shibie_audio='C:/SOFT/pyvideotrans/tmp/32280/d74da984a2/720-1766693391.562057.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='Fun-ASR-Nano-2512', split_type=0, voice_autorate=False, video_autorate=False, cuda=True, name='K:/720.m4a', basename='720.m4a', ext='m4a', dirname='K:/', shound_del_name=None, uuid='d74da984a2', remove_silent_mid=False, align_sub_audio=True, enable_diariz=True, nums_diariz=0, rephrase=0, only_out_mp4=False)


=
system:Windows-10-10.0.22631-SP0
version:v3.92
frozen:True
language:zh
root_dir:C:/SOFT/pyvideotrans

1 Replies

这个错误表明 FunASR 在初始化时遇到了问题,具体是 AutoTokenizer 变量未定义。这通常是由于 FunASR 依赖的 transformers 库版本冲突或环境问题导致的。

核心解决步骤:

  1. 关闭“说话人识别”功能:从错误日志 enable_diariz=True 可以看出,您开启了“说话人识别”。这是导致此错误的常见原因之一。请在主界面或任务设置中,取消勾选“识别说话人”,然后重试。
  2. 如果问题依旧,请尝试以下操作:

    • (预打包版用户) 请确保您是从官网下载的最新完整版软件,并解压在纯英文路径下(如 D:\videotrans),且路径中没有空格或特殊符号
    • (源码部署用户) 请确保已正确安装所有依赖。可以尝试在项目目录下运行以下命令更新关键依赖:

      pip install --upgrade transformers funasr
  3. 临时替代方案:如果上述方法均无效,可以暂时使用其他语音识别引擎,例如 faster-whisper(本地) 并选择 large-v3 模型,它对中文也有不错的识别效果。

如果问题仍然存在,请提供完整的日志文件(位于软件根目录下的 logs 文件夹内),以便进一步分析。

有用的文档链接:阿里FunASR中文识别

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