Skip to content

Commit

Permalink
Add missing loss_type in ValueError message (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarobartt authored Dec 7, 2023
1 parent 5a23354 commit 7d0a8ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion trl/trainer/dpo_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def dpo_loss(
# eqn (17) of the paper where beta is the regularization parameter for the IPO loss, denoted by tau in the paper.
losses = (logits - 1 / (2 * self.beta)) ** 2
else:
raise ValueError(f"Unknown loss type: {self.loss_type}. Should be one of ['sigmoid', 'hinge']")
raise ValueError(f"Unknown loss type: {self.loss_type}. Should be one of ['sigmoid', 'hinge', 'ipo']")

chosen_rewards = self.beta * (policy_chosen_logps - reference_chosen_logps).detach()
rejected_rewards = self.beta * (policy_rejected_logps - reference_rejected_logps).detach()
Expand Down

0 comments on commit 7d0a8ee

Please sign in to comment.