Skip to content

Commit

Permalink
Update turbo_alignment/trainers/dpo.py
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksey Malakhov <[email protected]>
  • Loading branch information
Myashka and alekseymalakhov11 authored Sep 20, 2024
1 parent 257f32f commit fd779ff
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions turbo_alignment/trainers/dpo.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,7 @@ def compute_loss(
)

ratio = -F.logsigmoid(log_odds)
losses = self.beta * ratio

nll_loss = -policy_chosen_logps

losses += nll_loss
losses = -policy_chosen_logps + self.beta * ratio

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

0 comments on commit fd779ff

Please sign in to comment.