You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libauc/losses/contrastive.py
+95-19Lines changed: 95 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,9 @@ class GCLoss_v1(nn.Module):
40
40
tau_min (float, optional): lower bound of learnable temperature in iSogCLR (default: ``0.05``)
41
41
tau_max (float, optional): upper bound of learnable temperature in iSogCLR (default: ``0.7``)
42
42
beta (float, optional): the momentum parameter for updating temperature parameters in iSogCLR (default: ``0.9``)
43
+
gamma (float, optional): the moving average factor for dynamic loss in range the range of (0.0, 1.0) (default: ``0.9``)
44
+
gamma_schedule (str, optional): the schedule for gamma. Options are 'constant' (fixed ``gamma``) and 'cosine' (decaying from 1.0 to ``gamma``) (default: ``'cosine'``)
45
+
gamma_decay_epochs (int, optional): After this number of epochs, gamma will decrease to the value set by the option ``gamma``. Used only when gamma_schedule is 'cosine'. We recommend a value of total_training_epochs // 2 (default: ``-1``)
# this sync on all devices (since "hidden" are gathering from all devices) #### maybe we can concat_all_gather index before?
145
180
ifself.distributed:
@@ -209,6 +244,8 @@ class GCLoss_v2(nn.Module):
209
244
tau_min (float, optional): lower bound of learnable temperature in iSogCLR (default: ``0.005``)
210
245
tau_max (float, optional): upper bound of learnable temperature in iSogCLR (default: ``0.05``)
211
246
beta (float, optional): the momentum parameter for updating temperature parameters in iSogCLR (default: ``0.9``)
247
+
gamma_schedule (str, optional): the schedule for gamma. Options are 'constant' (fixed ``gamma``) and 'cosine' (decaying from 1.0 to ``gamma``) (default: ``'cosine'``)
248
+
gamma_decay_epochs (int, optional): After this number of epochs, gamma will decrease to the value set by the option ``gamma``. Used only when gamma_schedule is 'cosine'. We recommend a value of total_training_epochs // 2 (default: ``-1``)
0 commit comments