Skip to content

Commit

Permalink
fix loss calculation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ardagoreci committed Aug 23, 2024
1 parent 80caef3 commit fcf03e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion configs/trainer/deepspeed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ strategy:
cpu_checkpointing: False

# Gradient accumulation
accumulate_grad_batches: 2
accumulate_grad_batches: 1
2 changes: 1 addition & 1 deletion src/utils/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def diffusion_loss(

# Scale by (t**2 + σ**2) / (t + σ)**2
scaling_factor = torch.add(timesteps ** 2, sd_data ** 2) / (torch.mul(timesteps, sd_data) ** 2 + epsilon)
loss_diffusion = scaling_factor * mse
loss_diffusion = scaling_factor.squeeze(-1) * mse # (bs)

# Smooth LDDT Loss
# if use_smooth_lddt:
Expand Down

0 comments on commit fcf03e2

Please sign in to comment.