Skip to content

Commit

Permalink
fix dpo trainer bug (huggingface#1073)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Dec 8, 2023
1 parent 7d0a8ee commit ac8fee3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion trl/trainer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def collate(self, batch):
if "prompt" in k:
to_pad = [torch.LongTensor(ex[k][::-1]) for ex in batch]
else:
to_pad = [torch.LongTensor(ex[k]) for ex in batch]
to_pad = [torch.LongTensor(ex[k][:-1]) for ex in batch]
if k.endswith("_input_ids"):
padding_value = self.tokenizer.pad_token_id
elif k.endswith("_labels"):
Expand Down

0 comments on commit ac8fee3

Please sign in to comment.