modelscope / FunASR

A Fundamental End-to-End Speech Recognition Toolkit and Open Source SOTA Pretrained Models, Supporting Speech Recognition, Voice Activity Detection, Text Post-processing etc.
https://www.funasr.com
Other
6.47k stars 688 forks source link

离线环境下无法启动语音识别模型问题 #907

Closed ljazbtzv99936 closed 1 year ago

ljazbtzv99936 commented 1 year ago

OS: linux Python 3.10 Package: pytorch 1.13.1 、modelscope1.3.0 funasr 0.3.0 Model: auto-speech-recognition Command: inference_pipeline = pipeline( task=Tasks.auto_speech_recognition, model=params["model_dir"], model_revision="v1.2.1", vad_model='damo/speech_fsmn_vad_zh-cn-16k-common-pytorch', vad_model_revision="v1.1.8", punc_model='damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch', punc_model_revision="v1.1.6", batch_size=64, ) Error log: 我是本地环境下进行模型加载,本机能连接公网情况下,是能正常启动模型的,显示如下 image 但是在不能连接公网的服务器下,却启动不了,问题如下 image 这里显示的还需要连接modelscope社区官网,我的配置文件应该均已下载到本地,列表如下 ![Uploading image.png…]() 请问这个问题应该怎么解决?

Dalaoyel commented 1 year ago

模型下载到本地之后,把路径dama/xxxxxxx 改成 ./xxxxx

LauraGPT commented 1 year ago

ref to https://github.com/alibaba-damo-academy/FunASR/issues/908

qianbaidu1266 commented 3 months ago

我已经解决这个问题了,还是模型路径设置的问题:

funasr_wss_server.py 中,把所有AutoModel的model 都按照如下格式修改即可:

parser.add_argument(
    "--asr_model",
    type=str,
    default=r"~/.cache/modelscope/hub/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch",
    help="model from modelscope",
)

# 确保路径正确解析
asr_model_path = os.path.expanduser(args.asr_model)
# 转换路径分隔符为 Windows 格式
asr_model_path = asr_model_path.replace('/', '\\')

print("asr_model_path:",asr_model_path)

model_asr = AutoModel(
    model=asr_model_path,
    model_revision=args.asr_model_revision,
    ngpu=args.ngpu,
    ncpu=args.ncpu,
    device=args.device,
    disable_pbar=True,
    disable_log=True,
    update_model=False,
)