sml2h3 / ddddocr

带带弟弟 通用验证码识别OCR pypi版
https://ddddocr.com
MIT License
9.76k stars 1.74k forks source link

如何部署GPU版本 #37

Closed Wangbenzhi closed 2 years ago

Wangbenzhi commented 2 years ago

@sml2h3 您好,请问您部署过GPU版本吗?我将模型设置如下 self.ocr = ddddocr.DdddOcr(use_gpu=True, old=True) 在推理时会有如下报错 TypeError: load_model(): incompatible function arguments. The following argument types are supported:

  1. (self: onnxruntime.capi.onnxruntime_pybind11_state.InferenceSession, arg0: List[str]) -> None Invoked with: <onnxruntime.capi.onnxruntime_pybind11_state.InferenceSession object at 0x7f3754e7dce0>, [('CUDAExecutionProvider', {'device_id': 0, 'arena_extend_strategy': 'kNextPowerOfTwo', 'cuda_mem_limit': 1073741824, 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': True})] 您有什么解决办法吗? 感谢!
sml2h3 commented 2 years ago

@sml2h3 您好,请问您部署过GPU版本吗?我将模型设置如下 self.ocr = ddddocr.DdddOcr(use_gpu=True, old=True) 在推理时会有如下报错 TypeError: load_model(): incompatible function arguments. The following argument types are supported: 1. (self: onnxruntime.capi.onnxruntime_pybind11_state.InferenceSession, arg0: List[str]) -> None Invoked with: <onnxruntime.capi.onnxruntime_pybind11_state.InferenceSession object at 0x7f3754e7dce0>, [('CUDAExecutionProvider', {'device_id': 0, 'arena_extend_strategy': 'kNextPowerOfTwo', 'cuda_mem_limit': 1073741824, 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': True})] 您有什么解决办法吗? 感谢!

pip uninstall onnxruntime pip install onnxruntime-gpu

Wangbenzhi commented 2 years ago

@sml2h3 您好,请问您部署过GPU版本吗?我将模型设置如下 self.ocr = ddddocr.DdddOcr(use_gpu=True, old=True) 在推理时会有如下报错 TypeError: load_model(): incompatible function arguments. The following argument types are supported: 1. (self: onnxruntime.capi.onnxruntime_pybind11_state.InferenceSession, arg0: List[str]) -> None Invoked with: <onnxruntime.capi.onnxruntime_pybind11_state.InferenceSession object at 0x7f3754e7dce0>, [('CUDAExecutionProvider', {'device_id': 0, 'arena_extend_strategy': 'kNextPowerOfTwo', 'cuda_mem_limit': 1073741824, 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': True})] 您有什么解决办法吗? 感谢!

pip uninstall onnxruntime pip install onnxruntime-gpu

您好,上面的是错误是我安装了与cuda对应版本的onjnxruntime-gpu导致的,我之后升级了onnxruntime-gpu,虽然没有报错,但运行过程中显存占用没有发生变化

sml2h3 commented 2 years ago

@sml2h3 您好,请问您部署过GPU版本吗?我将模型设置如下 self.ocr = ddddocr.DdddOcr(use_gpu=True, old=True) 在推理时会有如下报错 TypeError: load_model(): incompatible function arguments. The following argument types are supported: 1. (self: onnxruntime.capi.onnxruntime_pybind11_state.InferenceSession, arg0: List[str]) -> None Invoked with: <onnxruntime.capi.onnxruntime_pybind11_state.InferenceSession object at 0x7f3754e7dce0>, [('CUDAExecutionProvider', {'device_id': 0, 'arena_extend_strategy': 'kNextPowerOfTwo', 'cuda_mem_limit': 1073741824, 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': True})] 您有什么解决办法吗? 感谢!

pip uninstall onnxruntime pip install onnxruntime-gpu

您好,上面的是错误是我安装了与cuda对应版本的onjnxruntime-gpu导致的,我之后升级了onnxruntime-gpu,虽然没有报错,但运行过程中显存占用没有发生变化

占用的很少而已,模型本身也并不大,因为onnxruntime是需要多少占用多少,而不是像tf等先占掉大多数再分配。