(self, n_iter)
| 96 | self.warmup_steps = warmup_steps |
| 97 | |
| 98 | def __call__(self, n_iter) -> float: |
| 99 | if n_iter < self.warmup_steps: |
| 100 | alpha = 1.0 * n_iter / self.warmup_steps |
| 101 | elif n_iter >= self.total_length: |
| 102 | alpha = self.final_ratio |
| 103 | else: |
| 104 | actual_iter = n_iter - self.warmup_steps |
| 105 | alpha = np.exp( |
| 106 | actual_iter / self.effective_length * np.log(self.final_ratio) |
| 107 | ) |
| 108 | return alpha |
| 109 | |
| 110 | |
| 111 | def get_iter_exponential_schedule(optimizer: Optimizer, num_warmup_steps: int, num_training_steps: int, final_ratio: float): |
nothing calls this directly
no outgoing calls
no test coverage detected