From f671f133c0ecd25e1d62f9b37a29edcb2ba8a74b Mon Sep 17 00:00:00 2001 From: WenmuZhou <572459439@qq.com> Date: Wed, 12 Jan 2022 02:29:46 +0000 Subject: [PATCH] move chunk to infer model --- ppocr/data/imaug/vqa/token/vqa_token_pad.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ppocr/data/imaug/vqa/token/vqa_token_pad.py b/ppocr/data/imaug/vqa/token/vqa_token_pad.py index 6d3cf5e3..8e5a20f9 100644 --- a/ppocr/data/imaug/vqa/token/vqa_token_pad.py +++ b/ppocr/data/imaug/vqa/token/vqa_token_pad.py @@ -94,8 +94,11 @@ class VQATokenPad(object): 'input_ids', 'labels', 'token_type_ids', 'bbox', 'attention_mask' ]: - if self.infer_mode and key == 'labels': - continue - length = min(len(data[key]), self.max_seq_len) - data[key] = np.array(data[key][:length], dtype='int64') + if self.infer_mode: + if key != 'labels': + length = min(len(data[key]), self.max_seq_len) + data[key] = data[key][:length] + else: + continue + data[key] = np.array(data[key], dtype='int64') return data -- GitLab