PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.12k stars 5.55k forks source link

paddle ocr 设置use_tensorrt=True 导致初始化卡住 #68503

Open caishenzhishou opened 1 week ago

caishenzhishou commented 1 week ago

请提出你的问题 Please ask your question

执行初始化的时候 predictor = inference.create_predictor(config)这步会卡住 配置如下:

系统 CUDA CUDNN TensorRT python paddlepaddle PyTorch
windows11专业版显卡RTX2060 12.6 8.9.7.29 8.6.1.6 3.11 paddlepaddle-gpu==3.0.0b1选CU12.3 2.4.1版本CU12.4
windows11专业版显卡RTX2060 11.8 8.6.0.163 8.5.1.7 3.10 paddlepaddle-gpu==3.0.0b1选CU11.8 2.4.1版本CU11.8

入口代码:paddleocr = PaddleOCR(lang='ch', show_log=True, use_gpu=True, enable_mkldnn=True, use_tensorrt=True, use_angle_cls=False)每次运行到这里就卡住。debug之后,具体到最上面那步卡死。 麻烦专家们给个提示或者建议?感谢!!

caishenzhishou commented 1 week ago

一共试了2套环境,都不行

caishenzhishou commented 1 week ago

日志如下: [2024/09/27 21:11:55] ppocr DEBUG: Namespace(help='==SUPPRESS==', use_gpu=True, use_xpu=False, use_npu=False, use_mlu=False, ir_optim=True, use_tensorrt=True, min_subgraph_size=15, precision='fp32', gpu_mem=500, gpu_id=0, image_dir=None, page_num=0, det_algorithm='DB', det_model_dir='C:\Users\XCCG05A20016/.paddleocr/whl\det\ch\ch_PP-OCRv4_det_infer', det_limit_side_len=960, det_limit_type='max', det_box_type='quad', det_db_thresh=0.3, det_db_box_thresh=0.6, det_db_unclip_ratio=1.5, max_batch_size=10, use_dilation=False, det_db_score_mode='fast', det_east_score_thresh=0.8, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_sast_score_thresh=0.5, det_sast_nms_thresh=0.2, det_pse_thresh=0, det_pse_box_thresh=0.85, det_pse_min_area=16, det_pse_scale=1, scales=[8, 16, 32], alpha=1.0, beta=1.0, fourier_degree=5, rec_algorithm='SVTR_LCNet', rec_model_dir='C:\Users\XCCG05A20016/.paddleocr/whl\rec\ch\ch_PP-OCRv4_rec_infer', rec_image_inverse=True, rec_image_shape='3, 48, 320', rec_batch_num=6, max_text_length=25, rec_char_dict_path='D:\software\python310\lib\site-packages\paddleocr\ppocr\utils\ppocr_keys_v1.txt', use_space_char=True, vis_font_path='./doc/fonts/simfang.ttf', drop_score=0.5, e2e_algorithm='PGNet', e2e_model_dir=None, e2e_limit_side_len=768, e2e_limit_type='max', e2e_pgnet_score_thresh=0.5, e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_pgnet_valid_set='totaltext', e2e_pgnet_mode='fast', use_angle_cls=False, cls_model_dir='C:\Users\XCCG05A20016/.paddleocr/whl\cls\ch_ppocr_mobile_v2.0_cls_infer', cls_image_shape='3, 48, 192', label_list=['0', '180'], cls_batch_num=6, cls_thresh=0.9, enable_mkldnn=True, cpu_threads=10, use_pdserving=False, warmup=False, sr_model_dir=None, sr_image_shape='3, 32, 128', sr_batch_num=1, draw_img_save_dir='./inference_results', save_crop_res=False, crop_res_save_dir='./output', use_mp=False, total_process_num=1, process_id=0, benchmark=False, save_log_path='./log_output/', show_log=True, use_onnx=False, return_word_box=False, output='./output', table_max_len=488, table_algorithm='TableAttn', table_model_dir=None, merge_no_span_structure=True, table_char_dict_path=None, layout_model_dir=None, layout_dict_path=None, layout_score_threshold=0.5, layout_nms_threshold=0.5, kie_algorithm='LayoutXLM', ser_model_dir=None, re_model_dir=None, use_visual_backbone=True, ser_dict_path='../train_data/XFUND/class_list_xfun.txt', ocr_order_method=None, mode='structure', image_orientation=False, layout=True, table=True, ocr=True, recovery=False, use_pdf2docx_api=False, invert=False, binarize=False, alphacolor=(255, 255, 255), lang='ch', det=True, rec=True, type='ocr', savefile=False, ocr_version='PP-OCRv4', structure_version='PP-StructureV2', use_cuda=True) [2024/09/27 21:30:23] ppocr WARNING: Since the angle classifier is not initialized, it will not be used during the forward process [2024/09/27 21:30:23] ppocr DEBUG: dt_boxes num : 72, elapsed : 0.11554646492004395 E0927 21:30:24.357795 19416 helper.h:131] 3: [builder.cpp::nvinfer1::builder::Builder::~Builder::307] Error Code 3: API Usage Error (Parameter check failed at: builder.cpp::nvinfer1::builder::Builder::~Builder::307, condition: mObjectCounter.use_count() == 1. Destroying a builder object before destroying objects it created leads to undefined behavior. )

caishenzhishou commented 1 week ago

pip list 显示如下:nvidia-cublas-cu11 11.11.3.6 nvidia-cuda-nvrtc-cu11 11.8.89 nvidia-cuda-runtime-cu11 11.8.89 nvidia-cudnn-cu11 8.9.4.19 nvidia-cufft-cu11 10.9.0.58 nvidia-curand-cu11 10.3.0.86 nvidia-cusolver-cu11 11.4.1.48 nvidia-cusparse-cu11 11.7.5.86 tensorrt 8.5.1.7

是不是这里的CUDNN版本不对?但是我都是按照步骤执行安装的。