运行SER + RE模型串联报错 #12255
Replies: 5 comments
-
+10086 环境centos7 cuda11.6 cudnn8.4.0(官方推荐的对应版本),单机多卡,安装了对应的nccl,执行paddle.utils.run_check()没问题 paddle相关的包本本: 仅预测SER模型部分没问题python3 tools/infer_kie_token_ser.py SER + RE模型串联报错python3 ./tools/infer_kie_token_ser_re.py 完整log日志[2023/09/07 02:02:26] ppocr INFO: ********** re config ********** [2023/09/07 02:02:26] ppocr INFO: ********** ser config ********** [2023-09-07 02:02:32,054] [ INFO] - All the weights of LayoutXLMForTokenClassification were initialized from the model checkpoint at ./pretrained_model/ser_vi_layoutxlm_xfund_pretrained/best_accuracy. [2023-09-07 02:02:36,655] [ INFO] - All the weights of LayoutXLMForRelationExtraction were initialized from the model checkpoint at ./pretrained_model/re_vi_layoutxlm_xfund_pretrained/best_accuracy. |
Beta Was this translation helpful? Give feedback.
-
+我在aistudio v100的环境下跑通了,没问题,版本也是参考对应的环境 cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2 我自己服务器和aistudio的都是8.4.0 但是刚才用paddle.version.cudnn() 看了一下cudnn环境,我的是8.4.0,aistudio的是8.2.1,不知道是否和这个有关系,这个aistudio对应的和官网给的不一致呢 |
Beta Was this translation helpful? Give feedback.
-
切换为cuda11.2 cudnn8.2.1 还是不行😭 |
Beta Was this translation helpful? Give feedback.
-
这个问题应该是环境或者某一个包的版本问题,我把cuda和cudnn版本改为和aistudio调通的环境一致,其他包版本也生成requriements后copy到自己服务器上安装后,没问题了 |
Beta Was this translation helpful? Give feedback.
-
能否发下你的环境中的依赖版本?感谢 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
系统环境
Ubuntu20.04
Cuda 11.8
Pytorch 2.0.0
paddle版本
paddle-bfloat 0.1.7
paddle2onnx 1.0.9
paddlefsl 1.1.0
paddlenlp 2.6.0
paddleocr 2.7.0.2
paddlepaddle-gpu 2.5.1
运行指令
# SER + RE模型串联 python3 ./tools/infer_kie_token_ser_re.py \ -c configs/kie/vi_layoutxlm/re_vi_layoutxlm_xfund_zh.yml \ -o Architecture.Backbone.checkpoints=./pretrained_model/re_vi_layoutxlm_xfund_pretrained/best_accuracy \ Global.infer_img=./train_data/XFUND/zh_val/image/zh_val_42.jpg \ -c_ser configs/kie/vi_layoutxlm/ser_vi_layoutxlm_xfund_zh.yml \ -o_ser Architecture.Backbone.checkpoints=./pretrained_model/ser_vi_layoutxlm_xfund_pretrained/best_accuracy
完整报错
[2023/08/28 18:04:39] ppocr INFO: resume from ./pretrained_model/re_vi_layoutxlm_xfund_pretrained/best_accuracy
Corrupt JPEG data: premature end of data segment
Traceback (most recent call last):
File "./tools/infer_kie_token_ser_re.py", line 217, in
result = ser_re_engine(data)
File "./tools/infer_kie_token_ser_re.py", line 151, in call
preds = self.model(re_input)
File "/root/miniconda3/lib/python3.8/site-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(*inputs, **kwargs)
File "/root/PaddleOCR/ppocr/modeling/architectures/base_model.py", line 86, in forward
x = self.backbone(x)
File "/root/miniconda3/lib/python3.8/site-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(*inputs, **kwargs)
File "/root/PaddleOCR/ppocr/modeling/backbones/vqa_layoutlm.py", line 227, in forward
x = self.model(
File "/root/miniconda3/lib/python3.8/site-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(*inputs, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/paddlenlp/transformers/layoutxlm/modeling.py", line 1329, in forward
loss, pred_relations = self.extractor(sequence_output, entities, relations)
File "/root/miniconda3/lib/python3.8/site-packages/paddle/nn/layer/layers.py", line 1254, in call
return self.forward(*inputs, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/paddlenlp/transformers/layoutxlm/modeling.py", line 1223, in forward
relations, entities = self.build_relation(relations, entities)
File "/root/miniconda3/lib/python3.8/site-packages/paddlenlp/transformers/layoutxlm/modeling.py", line 1185, in build_relation
negative_relations = all_possible_relations[negative_mask]
File "/root/miniconda3/lib/python3.8/site-packages/paddle/fluid/dygraph/tensor_patch_methods.py", line 747, in getitem
return self._getitem_index_not_tensor(item)
ValueError: (InvalidArgument) Currently, Tensor.indices() only allows indexing by Integers, Slices, Ellipsis, None, tuples of these types and list of Bool and Integers, but received bool in 1th slice item (at ../paddle/fluid/pybind/slice_utils.h:298)
Beta Was this translation helpful? Give feedback.
All reactions