Skip to content

运行FunASR-Nano, UnboundLocalError: local variable 'AutoTokenizer' referenced before assignment #2749

@chengzhen123

Description

@chengzhen123

Notice: In order to resolve issues more efficiently, please raise issue following the template.
(注意:为了更加高效率解决您遇到的问题,请按照模板提问,补充细节)

🐛 Bug

我使用官方提供的代码例子:FunASR/runtime/python/websocket/funasr_wss_server.py
将model_asr模型换成 FunAudioLLM/Fun-ASR-Nano-2512,
出现报错:
UnboundLocalError: local variable 'AutoTokenizer' referenced before assignment
报错截图如下:

Image

To Reproduce

Code sample

funasr_wss_server.py 修改了一些内容如下:

model_asr = AutoModel(
model=args.asr_model,
model_revision=args.asr_model_revision,
ngpu=args.ngpu,
ncpu=args.ncpu,
device=args.device,
disable_pbar=True,
disable_log=True,
trust_remote_code=True, ## 添加内容
remote_code="../../../funasr/models/fun_asr_nano/model.py", ## 添加内容

)

model_vad = AutoModel(
model=args.vad_model,
model_revision=args.vad_model_revision,
ngpu=args.ngpu,
ncpu=args.ncpu,
device=args.device,
disable_pbar=True,
disable_log=True,
trust_remote_code=True, ## 添加内容
remote_code="../../../funasr/models/fun_asr_nano/model.py", ## 添加内容
# chunk_size=60,
)

其中 trust_remote_code 和 remote_code无论是否添加,都会出现同样的报错

运行脚本如下:
export MODELSPATH=/data/ASR/FunASR/models/models/iic
python funasr_wss_server.py --port 10095
--asr_model FunAudioLLM/Fun-ASR-Nano-2512
--asr_model_revision master
--asr_model_online $MODELSPATH/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online
--asr_model_online_revision v2.0.4
--vad_model $MODELSPATH/speech_fsmn_vad_zh-cn-16k-common-pytorch
--vad_model_revision v2.0.4
--punc_model $MODELSPATH/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727
--punc_model_revision v2.0.4
--ngpu 1
--ncpu 4
--certfile ''
--keyfile /data/ASR/FunASR/runtime/ssl_key/server.key \

Environment

  • OS : Linux
  • FunASR Version 1.2.9
  • ModelScope Version : 1.32.0
  • PyTorch Version : 2.9.1
  • How you installed funasr: pip
  • Python version: 3.10.19
  • GPU : 3090
  • CUDA/cuDNN version: 12.2
  • Docker version (e.g., funasr-runtime-sdk-cpu-0.4.1) gpu版本,自制

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions