Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行main.py遇到兼容性问题 #1

Open
miaohuil opened this issue Sep 21, 2024 · 10 comments
Open

运行main.py遇到兼容性问题 #1

miaohuil opened this issue Sep 21, 2024 · 10 comments

Comments

@miaohuil
Copy link

我现在用的是ffmpeg6.1.1。
我的config.yaml配置如下:
name: 百聆(bailing)
version: 1.0

logging:
level: debug

interrupt: false

具体处理时选择的模块

selected_module:
Recorder: RecorderPyAudio
ASR: FunASR
VAD: SileroVAD
LLM: OpenAILLM
TTS: MacTTS
Player: CmdPlayer

Recorder:
RecorderPyAudio:
output_file: tmp/

ASR:
FunASR:
# model_dir: models/SenseVoiceSmall
model_dir: FunAudioLLM/SenseVoiceSmall
output_file: tmp/

VAD:
SileroVAD:
sampling_rate: 16000
threshold: 0.5
min_silence_duration_ms: 200

LLM:
OpenAILLM:
model_name: deepseek-chat
url: https://api.deepseek.com
api_key: sk-************************

TTS:
MacTTS:
voice: Tingting
output_file: tmp/
EdgeTTS:
voice: zh-CN-XiaoxiaoNeural
output_file: tmp/
GTTS:
lang: zh
output_file: tmp/
CosyvoiceTTS:
output_file: tmp/
CHATTTS:
output_file: tmp/

Player:
CmdPlayer: null
PyaudioPlayer: null

我已经用huggingface-cli命令登录了hf,运行main.py报错:
Microsoft Windows [版本 10.0.19045.4894]
(c) Microsoft Corporation。保留所有权利。

(bailing.env) C:\LLM-CLASS\开源项目测试\bailing>python main.py
2024-09-21 12:34:30,016 - torio._extension.utils - DEBUG - Loading FFmpeg6
2024-09-21 12:34:30,021 - torio._extension.utils - DEBUG - Failed to load FFmpeg6 extension.
Traceback (most recent call last):
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio_extension\utils.py", line 116, in _find_ffmpeg_extension
ext = _find_versionsed_ffmpeg_extension(ffmpeg_ver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio_extension\utils.py", line 108, in _find_versionsed_ffmpeg_extension
_load_lib(lib)
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio_extension\utils.py", line 94, in load_lib
torch.ops.load_library(path)
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torch_ops.py", line 1295, in load_library
ctypes.CDLL(path)
File "C:\Python312\Lib\ctypes_init
.py", line 379, in init
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio\lib\libtorio_ffmpeg6.pyd' (or one of its dependencies). Try using the full path with constructor syntax.
2024-09-21 12:34:30,027 - torio._extension.utils - DEBUG - Loading FFmpeg5
2024-09-21 12:34:30,078 - torio._extension.utils - DEBUG - Failed to load FFmpeg5 extension.
Traceback (most recent call last):
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio_extension\utils.py", line 116, in _find_ffmpeg_extension
ext = _find_versionsed_ffmpeg_extension(ffmpeg_ver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio_extension\utils.py", line 108, in _find_versionsed_ffmpeg_extension
_load_lib(lib)
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio_extension\utils.py", line 94, in load_lib
torch.ops.load_library(path)
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torch_ops.py", line 1295, in load_library
ctypes.CDLL(path)
File "C:\Python312\Lib\ctypes_init
.py", line 379, in init
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio\lib\libtorio_ffmpeg5.pyd' (or one of its dependencies). Try using the full path with constructor syntax.
2024-09-21 12:34:30,085 - torio._extension.utils - DEBUG - Loading FFmpeg4
2024-09-21 12:34:30,137 - torio._extension.utils - DEBUG - Failed to load FFmpeg4 extension.
Traceback (most recent call last):
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio_extension\utils.py", line 116, in _find_ffmpeg_extension
ext = _find_versionsed_ffmpeg_extension(ffmpeg_ver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio_extension\utils.py", line 108, in _find_versionsed_ffmpeg_extension
_load_lib(lib)
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio_extension\utils.py", line 94, in load_lib
torch.ops.load_library(path)
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torch_ops.py", line 1295, in load_library
ctypes.CDLL(path)
File "C:\Python312\Lib\ctypes_init
.py", line 379, in init
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio\lib\libtorio_ffmpeg4.pyd' (or one of its dependencies). Try using the full path with constructor syntax.
2024-09-21 12:34:30,144 - torio._extension.utils - DEBUG - Loading FFmpeg
2024-09-21 12:34:30,145 - torio._extension.utils - DEBUG - Failed to load FFmpeg extension.
Traceback (most recent call last):
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio_extension\utils.py", line 116, in _find_ffmpeg_extension
ext = _find_versionsed_ffmpeg_extension(ffmpeg_ver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torio_extension\utils.py", line 106, in _find_versionsed_ffmpeg_extension
raise RuntimeError(f"FFmpeg{version} extension is not available.")
RuntimeError: FFmpeg extension is not available.
2024-09-21 12:34:37,859 - root - INFO - new registry table has been added: preprocessor_classes
2024-09-21 12:34:39,060 - root - INFO - new registry table has been added: adaptor_classes
2024-09-21 12:34:39,699 - root - INFO - new registry table has been added: lid_predictor_classes
{'model_dir': 'FunAudioLLM/SenseVoiceSmall', 'output_file': 'tmp/'}
funasr version: 1.1.6.
2024-09-21 12:34:43,423 - root - INFO - download models from model hub: hf
2024-09-21 12:34:43,432 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): huggingface.co:443
2024-09-21 12:34:44,153 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "GET /api/models/FunAudioLLM/SenseVoiceSmall/revision/main HTTP/11" 200 1665
Fetching 29 files: 100%|█████████████████████████████████████████████████████████| 29/29 [00:00<00:00, 2901.80it/s]
Detect model requirements, begin to install it: C:\Users\mhl.cache\huggingface\hub\models--FunAudioLLM--SenseVoiceSmall\snapshots\3eb3b4eeffc2f2dde6051b853983753db33e35c3\requirements.txt
install model requirements successfully
2024-09-21 12:37:08,137 - root - INFO - Loading pretrained params from C:\Users\mhl.cache\huggingface\hub\models--FunAudioLLM--SenseVoiceSmall\snapshots\3eb3b4eeffc2f2dde6051b853983753db33e35c3\model.pt
2024-09-21 12:37:08,156 - root - INFO - ckpt: C:\Users\mhl.cache\huggingface\hub\models--FunAudioLLM--SenseVoiceSmall\snapshots\3eb3b4eeffc2f2dde6051b853983753db33e35c3\model.pt
C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\funasr\train_utils\load_pretrained_model.py:38: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default
pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could
be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
src_state = torch.load(path, map_location=map_location)
2024-09-21 12:37:09,109 - root - INFO - scope_map: ['module.', 'None']
2024-09-21 12:37:09,110 - root - INFO - excludes: None
2024-09-21 12:37:09,243 - root - INFO - Loading ckpt: C:\Users\mhl.cache\huggingface\hub\models--FunAudioLLM--SenseVoiceSmall\snapshots\3eb3b4eeffc2f2dde6051b853983753db33e35c3\model.pt, status:
2024-09-21 12:37:09,263 - httpx - DEBUG - load_ssl_context verify=True cert=None trust_env=True http2=False
2024-09-21 12:37:09,265 - httpx - DEBUG - load_verify_locations cafile='C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\certifi\cacert.pem'
SileroVAD {'sampling_rate': 16000, 'threshold': 0.5, 'min_silence_duration_ms': 200}
Traceback (most recent call last):
File "C:\LLM-CLASS\开源项目测试\bailing\main.py", line 59, in
robot = robot.Robot(config_path)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\LLM-CLASS\开源项目测试\bailing\bailing\robot.py", line 49, in init
self.vad = vad.create_instance(
^^^^^^^^^^^^^^^^^^^^
File "C:\LLM-CLASS\开源项目测试\bailing\bailing\vad.py", line 70, in create_instance
return cls(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "C:\LLM-CLASS\开源项目测试\bailing\bailing\vad.py", line 27, in init
self.model = load_silero_vad()
^^^^^^^^^^^^^^^^^
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\silero_vad\model.py", line 23, in load_silero_vad
model = init_jit_model(model_file_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\silero_vad\utils_vad.py", line 171, in init_jit_model
model = torch.jit.load(model_path, map_location=device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\LLM-CLASS\开源项目测试\bailing\bailing.env\Lib\site-packages\torch\jit_serialization.py", line 163, in load
cpp_module = torch._C.import_ir_module(cu, os.fspath(f), map_location, _extra_files, _restore_shapes) # type: ignore[call-arg]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: open file failed because of errno 2 on fopen: No such file or directory, file path: C:\LLM-CLASS\开源
项目测试\bailing\bailing.env\Lib\site-packages\silero_vad\data\silero_vad.jit

@miaohuil
Copy link
Author

能提供您的config.yaml模版和ffmpeg的版本吗?

Repository owner deleted a comment from hjxbin Sep 21, 2024
@wwbin2017
Copy link
Owner

“RuntimeError: open file failed because of errno 2 on fopen: No such file or directory, file path: silero_vad\data\silero_vad.jit
”看报错是因为这个silero_vad库的模型文件没有下载,可以看下这个https://github.com/snakers4/silero-vad ,去下载相应的文件

@miaohuil
Copy link
Author

谢谢,是中文路径名的问题。
另外我共享一下我部署时遇到的两个问题:
1、缺省安装的 ffmpeg 7.0.2 应该是不兼容的, 需要手动下载老一点的版本,例如 6.1.1
2、读取yaml配置文件需要改成utf8,代码文件bailing/utils.py,修改内容为:
def read_config(config_path):
with open(config_path, "r", encoding='utf-8') as file:
config = yaml.safe_load(file)
return config

现在server.py和main.py都运行起来了,但一直显示加载中

错误1

@miaohuil
Copy link
Author

解决了,因该是windows路径的斜杠问题。作者开发应该是基于MACOS的

@smalldeer1982
Copy link

解决了,因该是windows路径的斜杠问题。作者开发应该是基于MACOS的

这个怎么解决的?

@miaohuil
Copy link
Author

miaohuil commented Nov 3, 2024

解决了,因该是windows路径的斜杠问题。作者开发应该是基于MACOS的

这个怎么解决的?

应该是我修改了的代码问题。和斜杠关系不大

@smalldeer1982
Copy link

windows下 ffmpeg识别的问题
2024-11-01 17:27:41,697 - torio._extension.utils - DEBUG - Loading FFmpeg6
2024-11-01 17:27:41,700 - torio._extension.utils - DEBUG - Failed to load FFmpeg6 extension.
Traceback (most recent call last):
File "D:\anaconda3\envs\chattts\lib\site-packages\torio_extension\utils.py", line 116, in _find_ffmpeg_extension
ext = _find_versionsed_ffmpeg_extension(ffmpeg_ver)
File "D:\anaconda3\envs\chattts\lib\site-packages\torio_extension\utils.py", line 108, in _find_versionsed_ffmpeg_extension
_load_lib(lib)
File "D:\anaconda3\envs\chattts\lib\site-packages\torio_extension\utils.py", line 94, in load_libtorch.ops.load_library(path)File "D:\anaconda3\envs\chattts\lib\site-packages\torch_ops.py", line 1295, in load_libraryctypes.CDLL(path)File "D:\anaconda3\envs\chattts\lib\ctypes_init.py", line 374, in init
self._handle = _dlopen(self._name, mode),这个还是没有解决,请问你解决了吗,谢谢

@miaohuil
Copy link
Author

miaohuil commented Nov 6, 2024

windows下 ffmpeg识别的问题 2024-11-01 17:27:41,697 - torio._extension.utils - DEBUG - Loading FFmpeg6 2024-11-01 17:27:41,700 - torio._extension.utils - DEBUG - Failed to load FFmpeg6 extension. Traceback (most recent call last): File "D:\anaconda3\envs\chattts\lib\site-packages\torio_extension\utils.py", line 116, in _find_ffmpeg_extension ext = _find_versionsed_ffmpeg_extension(ffmpeg_ver) File "D:\anaconda3\envs\chattts\lib\site-packages\torio_extension\utils.py", line 108, in _find_versionsed_ffmpeg_extension _load_lib(lib) File "D:\anaconda3\envs\chattts\lib\site-packages\torio_extension\utils.py", line 94, in load_libtorch.ops.load_library(path)File "D:\anaconda3\envs\chattts\lib\site-packages\torch_ops.py", line 1295, in load_libraryctypes.CDLL(path)File "D:\anaconda3\envs\chattts\lib\ctypes_init.py", line 374, in init self._handle = _dlopen(self._name, mode),这个还是没有解决,请问你解决了吗,谢谢

Failed to load FFmpeg6 extension。这个问题我实测不会影响到使用。

@smalldeer1982
Copy link

非常感谢,现在就是开启Rag后,会异常退出。。。其他都没啥问题了

@hopeforus
Copy link

非常感谢,现在就是开启Rag后,会异常退出。。。其他都没啥问题了

我的不是退出,是要等5分钟左右,然后就正常运行了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants