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
5.81k stars 629 forks source link

wss_server 启动连接modelscope 失败,模型已经下载到本地,为什么启动的时候要连接modelscope? #1903

Closed qianbaidu1266 closed 1 month ago

qianbaidu1266 commented 1 month ago

启动报错信息如下:

model loading 2024-07-11 09:23:00,782 - modelscope - INFO - PyTorch version 2.3.1 Found. 2024-07-11 09:23:00,792 - modelscope - INFO - Loading ast index from C:\Users\Administrator.cache\modelscope\ast_indexer 2024-07-11 09:23:01,406 - modelscope - INFO - Loading done! Current index file version is 1.15.0, with md5 78064726642d72fe2aad0b3fb2b39603 and a total number of 980 components indexed WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=2, read=1, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='www.modelscope.cn', port=443): Read timed out. (read timeout=60)")': /api/v1/models/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/revisions WARNING:urllib3.connectionpool:Retrying (Retry(total=0, connect=2, read=0, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='www.modelscope.cn', port=443): Read timed out. (read timeout=60)")': /api/v1/models/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/revisions Download: iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch failed!: HTTPSConnectionPool(host='www.modelscope.cn', port=443): Max retries exceeded with url: /api/v1/models/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/revisions (Caused by ReadTimeoutError("HTTPSConnectionPool(host='www.modelscope.cn', port=443): Read timed out. (read timeout=60)")) Traceback (most recent call last): File "F:\Pycharm_professional\install\PyCharm 2022.3.2\plugins\python\helpers\pydev\pydevd.py", line 1496, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "F:\Pycharm_professional\install\PyCharm 2022.3.2\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "G:\github_project\AIGC\smartVoice\FunASR-main\FunASR\runtime\python\websocket\funasr_wss_server.py", line 72, in model_asr = AutoModel( File "F:\Anaconda3\envs\funasr\lib\site-packages\funasr\auto\auto_model.py", line 124, in init model, kwargs = self.build_model(**kwargs) File "F:\Anaconda3\envs\funasr\lib\site-packages\funasr\auto\auto_model.py", line 218, in build_model assert model_class is not None, f'{kwargs["model"]} is not registered' AssertionError: iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch is not registered

Process finished with exit code 1

qianbaidu1266 commented 1 month 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,
)
qianbaidu1266 commented 1 month 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,
)
AJLu-AMAT commented 2 weeks 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,
)

你好,我按照你这个改了路径为什么也没用啊