xszyou / Fay

Fay is an open-source digital human framework integrating language models and digital characters. It offers retail, assistant, and agent versions for diverse applications like virtual shopping guides, broadcasters, assistants, waiters, teachers, and voice or text-based mobile assistants.
GNU General Public License v3.0
8.6k stars 1.72k forks source link

Connection is already closed. 错误,怎么确认是什么原因导致的? #93

Open ipv6next opened 7 months ago

ipv6next commented 7 months ago

[22:02:04][系统] 聆听中... [22:02:05][系统] 语音处理中... [22:02:06][系统] 语音处理完成! 耗时: 1005 ms [22:02:06][系统] [!] 语音未检测到内容! [22:02:14][系统] 聆听中... [22:02:16][系统] 语音处理中... [22:02:17][系统] 语音处理完成! 耗时: 1005 ms [22:02:17][系统] [!] 语音未检测到内容! [22:02:23][系统] 聆听中... [22:02:25][系统] 语音处理中... [22:02:26][系统] 语音处理完成! 耗时: 872 ms [22:02:26][语音] 你是谁 [22:02:27][系统] 自然语言处理... [22:02:30][系统] 接口调用耗时 :3.079002857208252 [22:02:30][系统] 自然语言处理完成. 耗时: 3084 ms [22:02:30][菲菲] (angry) 我是数字人Fay。有什么我可以帮助你的吗? [22:02:30][系统] 合成音频... [22:02:34][系统] 合成音频完成. 耗时: 4282 ms 文件:./samples/sample-1702908150272.mp3 [22:03:03][系统] 聆听中... Connection is already closed. Connection is already closed. Connection is already closed. Connection is already closed. Connection is already closed. Connection is already closed. Connection is already closed.

xszyou commented 7 months ago

看起来像是与aliyun asr的连接不稳定,检查一下网络环境,或者更换成本地的asr,b站里有更换funasr的教程

ipv6next commented 7 months ago

安装本地asr的时候,最后一步启动model,报错: (fay) c:\Fay-assistant\test\funasr>python -u ASR_server.py --host "0.0.0.0" --port 10197 --ngpu 0 --model ./data/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404 2023-12-19 20:07:22,180 - modelscope - INFO - PyTorch version 2.1.2 Found. 2023-12-19 20:07:22,181 - modelscope - INFO - Loading ast index from C:\Users\ipv6n.cache\modelscope\ast_indexer 2023-12-19 20:07:22,182 - modelscope - INFO - No valid ast index found from C:\Users\ipv6n.cache\modelscope\ast_indexer, generating ast index from prebuilt! 2023-12-19 20:07:22,312 - modelscope - INFO - Loading done! Current index file version is 1.10.0, with md5 d368d60d9ba39208876738360a5562e3 and a total number of 946 components indexed model loading Traceback (most recent call last): File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\modelscope\utils\import_utils.py", line 451, in _get_module return importlib.import_module('.' + module_name, self.name) File "C:\Users\ipv6n.conda\envs\fay\lib\importlib__init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\modelscope\utils\hf_util.py", line 5, in from transformers import AutoImageProcessor as AutoImageProcessorHF ImportError: cannot import name 'AutoImageProcessor' from 'transformers' (C:\Users\ipv6n.conda\envs\fay\lib\site-packages\transformers\init__.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "c:\Fay-assistant\test\funasr\ASR_server.py", line 56, in inference_pipeline_asr = pipeline( File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\modelscope\pipelines\builder.py", line 163, in pipeline clear_llm_info(kwargs) File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\modelscope\pipelines\builder.py", line 227, in clear_llm_info from .nlp.llm_pipeline import ModelTypeHelper File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\modelscope\pipelines\nlp\llm_pipeline.py", line 11, in from modelscope import (AutoModelForCausalLM, AutoTokenizer, Pipeline, File "", line 1075, in _handle_fromlist File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\modelscope\utils\import_utils.py", line 434, in getattr module = self._get_module(self._class_to_module[name]) File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\modelscope\utils\import_utils.py", line 453, in _get_module raise RuntimeError( RuntimeError: Failed to import modelscope.utils.hf_util because of the following error (look up to see its traceback): cannot import name 'AutoImageProcessor' from 'transformers' (C:\Users\ipv6n.conda\envs\fay\lib\site-packages\transformers__init__.py)

ipv6next commented 7 months ago

解决了,是transformers版本太低 pip install --upgrade transformers

ipv6next commented 7 months ago

依然存在错误: (fay) c:\Fay-assistant\test\funasr>python -u ASR_server.py --host "0.0.0.0" --port 10197 --ngpu 0 --model ./data/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404 2023-12-19 20:35:42,214 - modelscope - INFO - PyTorch version 2.1.2 Found. 2023-12-19 20:35:42,215 - modelscope - INFO - Loading ast index from C:\Users\ipv6n.cache\modelscope\ast_indexer 2023-12-19 20:35:42,331 - modelscope - INFO - Loading done! Current index file version is 1.10.0, with md5 d368d60d9ba39208876738360a5562e3 and a total number of 946 components indexed model loading Please install rotary_embedding_torch by: pip install -U rotary_embedding_torch If you want use h5py dataset, please pip install h5py, and try it again Traceback (most recent call last): File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\modelscope\utils\registry.py", line 212, in build_from_cfg return obj_cls(**args) File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\modelscope\pipelines\audio\asr_inference_pipeline.py", line 123, in init from funasr.bin import asr_inference_launch File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\funasr\bin\asr_inference_launch.py", line 59, in from funasr.utils.cluster_backend import ClusterBackend File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\funasr\utils\clusterbackend.py", line 5, in import hdbscan File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\hdbscan__init__.py", line 1, in from .hdbscan import HDBSCAN, hdbscan File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\hdbscan\hdbscan_.py", line 509, in memory=Memory(cachedir=None, verbose=0), TypeError: Memory.init() got an unexpected keyword argument 'cachedir'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\Fay-assistant\test\funasr\ASR_server.py", line 56, in inference_pipeline_asr = pipeline( File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\modelscope\pipelines\builder.py", line 170, in pipeline return build_pipeline(cfg, task_name=task) File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\modelscope\pipelines\builder.py", line 65, in build_pipeline return build_from_cfg( File "C:\Users\ipv6n.conda\envs\fay\lib\site-packages\modelscope\utils\registry.py", line 215, in build_from_cfg raise type(e)(f'{obj_cls.name}: {e}') TypeError: AutomaticSpeechRecognitionPipeline: Memory.init() got an unexpected keyword argument 'cachedir'

ipv6next commented 7 months ago

问题解决了。joblib 版本太高 pip install --upgrade joblib==1.1.0