Skip to content

Commit

Permalink
fix #issue 881, nb4reg_over_task_ratio is 0 cause error
Browse files Browse the repository at this point in the history
  • Loading branch information
smilesun committed Oct 10, 2024
1 parent fe84b5b commit 5eefec0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 5 additions & 1 deletion domainlab/algos/trainers/a_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,17 @@ def before_tr(self):
self.cal_reg_loss_over_task_loss_ratio()

def cal_reg_loss_over_task_loss_ratio(self):
"""
estimate the scale of each loss term, match each loss term to the major
loss via a ratio, this ratio will be multiplied with multiplier
"""
list_accum_reg_loss = []
loss_task_agg = 0
for ind_batch, (tensor_x, tensor_y, tensor_d, *others) in enumerate(
self.loader_tr
):
if ind_batch >= self.aconf.nb4reg_over_task_ratio:
break
return
tensor_x, tensor_y, tensor_d = (
tensor_x.to(self.device),
tensor_y.to(self.device),
Expand Down
5 changes: 0 additions & 5 deletions sh_list_error.sh

This file was deleted.

0 comments on commit 5eefec0

Please sign in to comment.