-
Notifications
You must be signed in to change notification settings - Fork 386
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
源码安装的GPU版本,选择AI模型时会闪退 #500
Comments
Hello! @catxiaoyi 👋 Thank you for reaching out and sharing the details of your installation process. I understand you're encountering an issue when trying to use the SAM-HQ model within X-AnyLabeling, leading to the application crashing immediately after launch. This error seems related to the ONNX Runtime library failing to initialize properly, which could be due to missing dependencies or compatibility issues. Before we dive into potential solutions, I encourage you to check related issues, e.g., #480 and #496, ..., as it discusses similar problems and might already contain information that could help resolve your issue. Alternatively, here are some troubleshooting steps you could try:
If you continue to experience issues after trying these steps, please let us know, and we'll be happy to assist further. Also, feel free to contribute to the discussion on open/cloesed issues, as your insights might help others facing similar challenges. Thank you for your patience and for using X-AnyLabeling! 😃 Best regards, |
以下是一个简单的Python脚本示例,用于测试 import onnxruntime
import app_info
# 检查onnxruntime是否安装了GPU版本
def check_onnxruntime_gpu():
try:
# 尝试创建一个GPU会话
session = onnxruntime.InferenceSession('model.onnx', providers=['CUDAExecutionProvider'])
print("ONNX Runtime with GPU support is installed and working correctly.")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure that ONNX Runtime with GPU support is installed correctly.")
# 检查app_info.py中的设备设置
try:
if app_info.device['__preferred_device__'] == 'gpu':
print("The preferred device in app_info.py is set to GPU.")
else:
print("Please set the '__preferred_device__' variable to 'gpu' in app_info.py.")
except Exception as e:
print(f"An error occurred while checking app_info.py: {e}")
# 运行检查
if __name__ == "__main__":
print("Running ONNX Runtime GPU test...")
check_onnxruntime_gpu() 在运行此脚本之前,请确保您有一个ONNX模型文件,并将 |
是的, 我也遇到同样的问题, 环境如下:
遇到的问题 都是加载 ai 模型闪退,或者加载出来了,不能预测, 预测的时候闪退 后来变成上面的环境,然后就好了
|
原因, 我大概找到了. 由于不常用 win 下的 cuda, 因此环境变量的配置有问题, 然后在下面的环境中利用 GPU 编译成功,并能够运行ai 模型
|
Thank you for your response regarding the solution to the issue of X-AnyLabeling failing to run on GPU in a Windows system. I appreciate your troubleshooting efforts. It appears you've identified the root cause, which was related to the environment variable configuration due to less frequent use of CUDA on Windows. Installing Zlib and adding it to the environment variables, along with the specific versions of cuda (11.8) and cudnn (8.9.X), seems to have done the trick. Restarting the system was also part of your solution, which I will keep in mind. I'm glad to hear that you were able to successfully compile and run the AI model using GPU in the specified environment. Your assistance is greatly appreciated! |
I run the script, it reports:Running ONNX Runtime GPU test...
|
Hi @Andy-HKU, thank you for reporting the issue. We understand that the script reports an error when checking Thank you for your understanding, and we appreciate your patience as we continue to develop and improve our services. |
你好,非常感谢你的贡献!
我的安装步骤是:
a)创建一个名为X-AnyLabeling的文件夹
b)打开anaconda prompt终端,创建一个名为anylabeling的虚拟环境,python版本为3.8
conda create -n anylabeling python=3.8
c)激活环境 conda activate anylabeling
d)进入步骤a)中创建的文件夹中,cd C:\Users\Administrator\X-AnyLabeling
e)从官网在该文件夹下git clone代码,git clone https://github.com/CVHub520/X-AnyLabeling.git
f)找到文件夹下的子文件./anylabeling/app_info.py文件,将__preferred_device__ = "CPU" 改为 GPU
g)安装依赖文件requirements,命令是pip install -r requirements-gpu.txt
h)安装cuda,这里用的是直接安装torch的方法,在pytorch官网找到pytorch v2.2.2版本下wheel安装(pip)模式中:conda install pytorch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 pytorch-cuda=11.8 -c pytorch -c nvidia 用来安装cuda
f)在当前环境下输入 python anylabeling/app.py 打开软件
按照以上步骤打开软件后,选择AI模型SAM-HQ软件就会闪崩。
报错信息:
(anylabeling) C:\Users\Administrator\X-AnyLabeling\X-AnyLabeling>python anylabeling/app.py
qt.qpa.fonts: Unable to enumerate family ' "Droid Sans Mono Dotted for Powerline" '
qt.qpa.fonts: Unable to enumerate family ' "Droid Sans Mono Slashed for Powerline" '
qt.qpa.fonts: Unable to enumerate family ' "Roboto Mono Medium for Powerline" '
qt.qpa.fonts: Unable to enumerate family ' "Ubuntu Mono derivative Powerline" '
Traceback (most recent call last):
File "C:\Users\Administrator\X-AnyLabeling\X-AnyLabeling.\anylabeling\utils.py", line 15, in run
self.func(*self.args, **self.kwargs)
File "C:\Users\Administrator\X-AnyLabeling\X-AnyLabeling.\anylabeling\services\auto_labeling\model_manager.py", line 965, in load_model
from .sam_hq import SAM_HQ
File "C:\Users\Administrator\X-AnyLabeling\X-AnyLabeling.\anylabeling\services\auto_labeling\sam_hq.py", line 7, in
import onnxruntime
File "D:\Users\Administrator\anaconda3\envs\anylabeling\lib\site-packages\onnxruntime_init.py", line 57, in
raise import_capi_exception
File "D:\Users\Administrator\anaconda3\envs\anylabeling\lib\site-packages\onnxruntime_init_.py", line 23, in
from onnxruntime.capi._pybind_state import ExecutionMode # noqa: F401
File "D:\Users\Administrator\anaconda3\envs\anylabeling\lib\site-packages\onnxruntime\capi_pybind_state.py", line 32, in
from .onnxruntime_pybind11_state import * # noqa
ImportError: DLL load failed while importing onnxruntime_pybind11_state: 动态链接库(DLL)初始化例程失败。
请问这是什么原因呢?谢谢
The text was updated successfully, but these errors were encountered: