(self, params, lr=required, warmup=-1, t_total=-1,
schedule='warmup_linear',
b1=0.9, b2=0.999, e=1e-6, weight_decay=0.01,
max_grad_norm=1.0)
| 76 | """ |
| 77 | |
| 78 | def __init__(self, params, lr=required, warmup=-1, t_total=-1, |
| 79 | schedule='warmup_linear', |
| 80 | b1=0.9, b2=0.999, e=1e-6, weight_decay=0.01, |
| 81 | max_grad_norm=1.0): |
| 82 | if lr is not required and lr < 0.0: |
| 83 | raise ValueError( |
| 84 | "Invalid learning rate: {} - should be >= 0.0".format(lr)) |
| 85 | if schedule not in SCHEDULES: |
| 86 | raise ValueError("Invalid schedule parameter: {}".format(schedule)) |
| 87 | if not 0.0 <= warmup < 1.0 and not warmup == -1: |
| 88 | raise ValueError( |
| 89 | "Invalid warmup: {} - should be in [0.0, 1.0[ or -1".format( |
| 90 | warmup)) |
| 91 | if not 0.0 <= b1 < 1.0: |
| 92 | raise ValueError( |
| 93 | "Invalid b1 parameter: {} - should be in [0.0, 1.0[".format(b1)) |
| 94 | if not 0.0 <= b2 < 1.0: |
| 95 | raise ValueError( |
| 96 | "Invalid b2 parameter: {} - should be in [0.0, 1.0[".format(b2)) |
| 97 | if not e >= 0.0: |
| 98 | raise ValueError( |
| 99 | "Invalid epsilon value: {} - should be >= 0.0".format(e)) |
| 100 | defaults = dict(lr=lr, schedule=schedule, warmup=warmup, |
| 101 | t_total=t_total, |
| 102 | b1=b1, b2=b2, e=e, weight_decay=weight_decay, |
| 103 | max_grad_norm=max_grad_norm) |
| 104 | super(BertAdam, self).__init__(params, defaults) |
| 105 | |
| 106 | def get_lr(self): |
| 107 | lr = [] |
nothing calls this directly
no outgoing calls
no test coverage detected