PaddleOCR
PaddleOCR copied to clipboard
ser将训练的模型导出成推理模型,代码报错
File "/share/disk1/lideyin/PaddleOCR-release-2.6/ppocr/modeling/architectures/base_model.py", line 86, in forward x = self.backbone(x) File "/share/disk1/lideyin/PaddleOCR-release-2.6/ppocr/modeling/backbones/vqa_layoutlm.py", line 166, in forward x = self.model( File "/root/anaconda3/envs/paddle_2.2.0_gpu/lib/python3.8/site-packages/paddlenlp/transformers/layoutxlm/modeling.py", line 914, in forwar outputs = self.layoutxlm( File "/root/anaconda3/envs/paddle_2.2.0_gpu/lib/python3.8/site-packages/paddlenlp/transformers/layoutxlm/modeling.py", line 775, in forwar # data.expand(shape) 将data维度扩展到shape维度 visual_bbox = paddle.stack( ~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE [ visual_bbox_x[:-1].expand(expand_shape),
ValueError: (InvalidArgument) Dims of all Inputs(X) must be the same, but received input 1 dim is:7, -1 not equal to input 0 dim:-1, 7.
[Hint: Expected input_dims[i] == input_dims[0], but received input_dims[i]:7, -1 != input_dims[0]:-1, 7.] (at /paddle/paddle/fluid/operators [operator < stack > error]
当前环境 paddle=2.2.0,paddlenlp=2.2.1 更新paddle=2.3.2, paddlenlp=2.3.0时依旧报错如下
File "/ps/lideyin/disk1/lideyin/PaddleOCR-release-2.6/ppocr/modeling/architectures/base_model.py", line 86, in forward x = self.backbone(x) File "/ps/lideyin/disk1/lideyin/PaddleOCR-release-2.6/ppocr/modeling/backbones/vqa_layoutlm.py", line 166, in forward x = self.model( File "/root/anaconda3/envs/paddle2.4.0/lib/python3.8/site-packages/paddlenlp/transformers/layoutxlm/modeling.py", line 873, in forward outputs = self.layoutxlm( File "/root/anaconda3/envs/paddle2.4.0/lib/python3.8/site-packages/paddlenlp/transformers/layoutxlm/modeling.py", line 781, in forward attention_mask = paddle.ones(input_shape)
visual_attention_mask = paddle.ones(visual_shape)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
attention_mask = attention_mask.astype(visual_attention_mask.dtype)
File "/root/anaconda3/envs/paddle2.4.0/lib/python3.8/site-packages/paddle/tensor/creation.py", line 291, in ones
return fill_constant(value=1.0, shape=shape, dtype=dtype, name=name)
File "/root/anaconda3/envs/paddle2.4.0/lib/python3.8/site-packages/paddle/fluid/layers/tensor.py", line 797, in fill_constant
check_shape(shape)
File "/root/anaconda3/envs/paddle2.4.0/lib/python3.8/site-packages/paddle/fluid/layers/utils.py", line 386, in check_shape
raise ValueError(
ValueError: All elements in ``shape`` must be positive when it's a list or tuple
paddle 和paddlenlp两个版本都试过了,目前都会报错
同样错误,请问解决了吗?
你好,麻烦使用paddleocr的2.6版本,paddlenlp的2.4.3版本以及paddle的2.3+版本
同样错误,请问解决了吗?
参考楼下大佬的reply,确实是版本的问题,把paddle版本从2.2.0升到2.3.2就好了
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.