MCPcopy Create free account
hub / github.com/CompVis/diff2flow / __call__

Method __call__

diff2flow/lr_schedulers.py:98–108  ·  view source on GitHub ↗
(self, n_iter)

Source from the content-addressed store, hash-verified

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
111def get_iter_exponential_schedule(optimizer: Optimizer, num_warmup_steps: int, num_training_steps: int, final_ratio: float):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected