PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

vqa ser re 模型压缩

Open gjj123 opened this issue 2 years ago • 4 comments

layoutxlm 的ser 和re 模型 能不能像ocr 识别模型那样 从训练模型转换为推理模型? 或者能不能 paddleslim 压缩什么的?

gjj123 avatar Aug 05 '22 09:08 gjj123

你好,ser模型目前已经支持转成inference model了,具体的使用文档可以参考: https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/ppstructure/vqa/README_ch.md#52-ser

我们近期也在升级这个系统,预计9月前会把所有的文档整理好,欢迎持续关注~

littletomatodonkey avatar Aug 08 '22 03:08 littletomatodonkey

你好,用那个export_model 转换报以下错误 File "PaddleOCR-dygraph/ppocr/modeling/architectures/base_model.py", line 80, in forward x = self.backbone(x) File "PaddleOCR-dygraph/ppocr/modeling/backbones/vqa_layoutlm.py", line 173, in forward labels=None) File "PaddleNLP-release-2.3/paddlenlp/transformers/layoutxlm/modeling.py", line 883, in forward head_mask=head_mask, ) File "PaddleNLP-release-2.3/paddlenlp/transformers/layoutxlm/modeling.py", line 777, in forward visual_bbox_y[1:].expand(expand_shape[::-1]).transpose([1, 0]), ], axis=-1, ).reshape([-1, bbox.shape[-1]]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE visual_bbox = visual_bbox.expand([final_shape[0], -1, -1]) final_bbox = paddle.concat([bbox, visual_bbox], axis=1)

File "/anaconda3/envs/paddle/lib/python3.6/site-packages/paddle/tensor/manipulation.py", line 798, in stack
    return layers.stack(x, axis, name)
File "/anaconda3/envs/paddle/lib/python3.6/site-packages/paddle/fluid/layers/nn.py", line 10222, in stack
    attrs={'axis': axis})
File "/anaconda3/envs/paddle/lib/python3.6/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op
    return self.main_program.current_block().append_op(*args, **kwargs)
File "/anaconda3/envs/paddle/lib/python3.6/site-packages/paddle/fluid/framework.py", line 3184, in append_op
    attrs=kwargs.get("attrs", None))
File "/anaconda3/envs/paddle/lib/python3.6/site-packages/paddle/fluid/framework.py", line 2344, in __init__
    self.desc.infer_shape(self.block.desc)

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/stack_op.cc:46) [operator < stack > error]

gjj123 avatar Aug 09 '22 05:08 gjj123

这个问题解决了吗? 我也遇到这个问题。

jack-gits avatar Aug 29 '22 11:08 jack-gits

我升级paddle到2.3.2,ser训练就不报这个错了,但是re模型训练报错'paddle.fluid.core_avx.ops' has no attribute 'c broadcast',请问你们遇到过吗?

sybest1259 avatar Oct 26 '22 09:10 sybest1259