fix style
Former-commit-id: 76a36d9acecbf36b6959a14caacfed1d32bcee41
This commit is contained in:
@@ -157,7 +157,7 @@ class MultiModalDataCollatorForSeq2Seq(DataCollatorForSeq2Seq):
|
||||
features["position_ids"] = [torch.arange(input_ids.size(0)).long() for input_ids in features["input_ids"]]
|
||||
features["position_ids"] = pad_sequence(features["position_ids"], batch_first=True, padding_value=0)
|
||||
new_features = {"data": features}
|
||||
new_features.update({"labels": features['labels']})
|
||||
new_features.update({"labels": features["labels"]})
|
||||
features = new_features
|
||||
|
||||
return features
|
||||
|
||||
@@ -384,7 +384,7 @@ class CpmOPlugin(BasePlugin):
|
||||
image_bounds_list = []
|
||||
valid_image_nums_ls = []
|
||||
flag = False
|
||||
|
||||
|
||||
for input_ids in batch_ids:
|
||||
input_ids_ = torch.tensor(input_ids)
|
||||
start_cond = (input_ids_ == processor.tokenizer.im_start_id) | (
|
||||
@@ -405,8 +405,8 @@ class CpmOPlugin(BasePlugin):
|
||||
]
|
||||
)
|
||||
image_bounds_list.append(image_bounds)
|
||||
|
||||
if not flag and len(images)>0:
|
||||
|
||||
if not flag and len(images) > 0:
|
||||
valid_image_nums_ls = [1 for _ in range(len(batch_ids))]
|
||||
image_bounds_list = [torch.arange(64) for _ in range(len(batch_ids))]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user