Skip to content

Commit

Permalink
Merge pull request meituan#605 from meituan-gengyifei/main
Browse files Browse the repository at this point in the history
Fix the bug of unused parameters in DDP mode.
  • Loading branch information
mtjhl authored Nov 9, 2022
2 parents 1563345 + 39996fd commit d6d89b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions yolov6/models/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ def forward(self, pred_dist, pred_bboxes, anchor_points,
else:
loss_dfl = loss_dfl.sum() / target_scores_sum
else:
loss_dfl = torch.tensor(0.).to(pred_dist.device)
loss_dfl = pred_dist.sum() * 0.

else:
loss_iou = torch.tensor(0.).to(pred_dist.device)
loss_dfl = torch.tensor(0.).to(pred_dist.device)
loss_iou = pred_dist.sum() * 0.
loss_dfl = pred_dist.sum() * 0.

return loss_iou, loss_dfl

Expand Down
10 changes: 5 additions & 5 deletions yolov6/models/loss_distill.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,14 @@ def forward(self, pred_dist, pred_bboxes, t_pred_dist, t_pred_bboxes, temperatur
loss_dfl = loss_dfl.sum() / target_scores_sum
d_loss_dfl = d_loss_dfl.sum() / target_scores_sum
else:
loss_dfl = torch.tensor(0.).to(pred_dist.device)
d_loss_dfl = torch.tensor(0.).to(pred_dist.device)
loss_dfl = pred_dist.sum() * 0.
d_loss_dfl = pred_dist.sum() * 0.

else:

loss_iou = torch.tensor(0.).to(pred_dist.device)
loss_dfl = torch.tensor(0.).to(pred_dist.device)
d_loss_dfl = torch.tensor(0.).to(pred_dist.device)
loss_iou = pred_dist.sum() * 0.
loss_dfl = pred_dist.sum() * 0.
d_loss_dfl = pred_dist.sum() * 0.

return loss_iou, loss_dfl, d_loss_dfl

Expand Down

0 comments on commit d6d89b6

Please sign in to comment.