(self)
| 104 | super(BertAdam, self).__init__(params, defaults) |
| 105 | |
| 106 | def get_lr(self): |
| 107 | lr = [] |
| 108 | for group in self.param_groups: |
| 109 | for p in group['params']: |
| 110 | state = self.state[p] |
| 111 | if len(state) == 0: |
| 112 | return [0] |
| 113 | if group['t_total'] != -1: |
| 114 | schedule_fct = SCHEDULES[group['schedule']] |
| 115 | lr_scheduled = group['lr'] * schedule_fct( |
| 116 | state['step'] / group['t_total'], group['warmup']) |
| 117 | else: |
| 118 | lr_scheduled = group['lr'] |
| 119 | lr.append(lr_scheduled) |
| 120 | return lr |
| 121 | |
| 122 | def step(self, closure=None): |
| 123 | """Performs a single optimization step. |
nothing calls this directly
no outgoing calls
no test coverage detected