Facefusion使用cuda报错问题
报错详情
2024-11-03 22:12:31.9074543 [E:onnxruntime:Default, provider_bridge_ort.cc:1992 onnxruntime::TryGetProviderInfo_CUDA] D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1637 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "D:\conda_envs\facefusion\Lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"
FAIL : LoadLibrary failed with error 126 "" when trying to load "D:\conda_envs\facefusion\Lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"
可能是版本导致的:
我的facefusion版本3.0.0、cuda版本12.5(命令nvidia-smi可查看)、cudnn版本8.9.7、onnxruntime版本1.19.x
重新安装
pip install onnxruntime-gpu==1.18.0
重新运行程序还是报错
File "D:\conda_envs\facefusion\Lib\site-packages\onnxruntime\capi\_pybind_state.py", line 32, in <module>
from .onnxruntime_pybind11_state import * # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError
前面提示
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.3 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
查看numpy版本
(D:\conda_envs\facefusion) F:\facefusion-3.0.0>pip list | findstr numpy
numpy 2.1.3
打算试下更新cudnn到9.x版本
cuDNN 9.5.1 Downloads | NVIDIA Developer
还是失败。
后来发现少做了一步。
conda install conda-forge::cuda-runtime=12.4.1 conda-forge::cudnn=9.2.1.18
我安装的命令是
conda install conda-forge::cuda-runtime=12.5.1
conda install nvidia::cudnn
相当于conda install nvidia/label/cudnn-9.3.0::cudnn
以上的安装对应版本之后,就能正常使用cuda加速了!