fix bug in DPO data collator

This commit is contained in:
hiyouga 2023-09-08 20:45:07 +08:00
parent b34797a845
commit 90bd085ae4
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ class DPODataCollatorWithPadding(DataCollatorForSeq2Seq):
if self.tokenizer.padding_side == "left":
start, end = feature.size(0) - answer_len, feature.size(0)
else:
start, end = prompt_len, answer_len
start, end = prompt_len, prompt_len + answer_len
padded_tensor = self.label_pad_token_id * torch.ones_like(feature)
padded_tensor[start:end] = feature[start:end]
padded_labels.append(padded_tensor)