环境
CUDA:
CUDNN:
paddleocr:
问题
执行
paddleocr --image_dir blob.jpeg --use_gpu true
报错:
Traceback (most recent call last):
File "C:\Users\dynamic\.conda\envs\d2l-zh\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\dynamic\.conda\envs\d2l-zh\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\dynamic\AppData\Roaming\Python\Python38\Scripts\paddleocr.exe\__main__.py", line 7, in <module>
sys.exit(main())
File "C:\Users\dynamic\AppData\Roaming\Python\Python38\site-packages\paddleocr\paddleocr.py", line 882, in main
result = engine.ocr(
File "C:\Users\dynamic\AppData\Roaming\Python\Python38\site-packages\paddleocr\paddleocr.py", line 729, in ocr
dt_boxes, rec_res, _ = self.__call__(img, cls, slice)
File "C:\Users\dynamic\AppData\Roaming\Python\Python38\site-packages\paddleocr\tools\infer\predict_system.py", line 144, in __call__
rec_res, elapse = self.text_recognizer(img_crop_list)
File "C:\Users\dynamic\AppData\Roaming\Python\Python38\site-packages\paddleocr\tools\infer\predict_rec.py", line 677, in __call__
self.predictor.run()
RuntimeError: (PreconditionNotMet) The third-party dynamic library (cublas64_118.dll;cublas64_11.dll) that Paddle depends on is not configured correctly. (error code is 126)
Suggestions:
1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
2. Configure third-party dynamic library environment variables as follows:
- Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
- Windows: set PATH by `set PATH=XXX; (at ..\paddle\phi\backends\dynload\dynamic_loader.cc:312)
[operator < fc > error]
解决方案
查了issues,发现了解决方案:Installation issue of paddlepaddle-gpu in CUDA Version:12.0 #10078
paddlepaddle-gpu在CUDA Version:12.0中的安装问题还有这个:RuntimeError: (PreconditionNotMet) The third-party dynamic library (cudnn64_8.dll) that Paddle depends on is not configured correctly. (error code is 126)
第一步
先去自己电脑的cuda路径下,找到cublas64_11.dll
,当然,找不到,但是有个名字差不多的cublas64_12.dll
,先copy到C:\Windows\System32
路径下,死马当成活马医。
再次执行
paddleocr --image_dir blob.jpeg --use_gpu true
同样的报错,此时,将System32文件夹下面咱们copy过来的cublas64_12.dll
修改文件名为cublas64_11.dll
,再次执行
paddleocr --image_dir blob.jpeg --use_gpu true
成功!
测试了一下,gpu跑ocr的速度,大概是cpu的10倍多一点。