1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

Update train_diffusion_dpo.py (#6754)

* Update train_diffusion_dpo.py

Address #6702

* Update train_diffusion_dpo_sdxl.py

* Empty-Commit

---------

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
This commit is contained in:
Viet Nguyen
2024-01-31 14:16:23 +07:00
committed by GitHub
parent 8d7dc85312
commit 1cab64b3be
2 changed files with 2 additions and 2 deletions

View File

@@ -860,7 +860,7 @@ def main(args):
# Final loss.
scale_term = -0.5 * args.beta_dpo
inside_term = scale_term * (model_diff - ref_diff)
loss = -1 * F.logsigmoid(inside_term.mean())
loss = -1 * F.logsigmoid(inside_term).mean()
implicit_acc = (inside_term > 0).sum().float() / inside_term.size(0)
implicit_acc += 0.5 * (inside_term == 0).sum().float() / inside_term.size(0)

View File

@@ -975,7 +975,7 @@ def main(args):
# Final loss.
scale_term = -0.5 * args.beta_dpo
inside_term = scale_term * (model_diff - ref_diff)
loss = -1 * F.logsigmoid(inside_term.mean())
loss = -1 * F.logsigmoid(inside_term).mean()
implicit_acc = (inside_term > 0).sum().float() / inside_term.size(0)
implicit_acc += 0.5 * (inside_term == 0).sum().float() / inside_term.size(0)