提交 f671f133 编写于 作者: 文幕地方's avatar 文幕地方

move chunk to infer model

上级 c703a589
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册