Skip to content

Commit 62f90a8

Browse files
committed
Fix AttributeError in diffusion_dpo ipo loss path
The IPO branch in `train_diffusion_dpo.py` references `args.beta`, but this script only defines `--beta_dpo` — there is no `--beta` argument. Running training with `--loss_type ipo` crashes immediately at the loss computation with: AttributeError: 'Namespace' object has no attribute 'beta' The `sigmoid` and `hinge` branches right above correctly use `args.beta_dpo`, so IPO was clearly meant to use the same hyperparameter. Swap to `args.beta_dpo` to unbreak `--loss_type ipo`.
1 parent c8c8401 commit 62f90a8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

examples/research_projects/diffusion_dpo/train_diffusion_dpo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ def collate_fn(examples):
881881
elif args.loss_type == "hinge":
882882
loss = torch.relu(1 - args.beta_dpo * logits).mean()
883883
elif args.loss_type == "ipo":
884-
losses = (logits - 1 / (2 * args.beta)) ** 2
884+
losses = (logits - 1 / (2 * args.beta_dpo)) ** 2
885885
loss = losses.mean()
886886
else:
887887
raise ValueError(f"Unknown loss type {args.loss_type}")

0 commit comments

Comments
 (0)