MCPcopy Create free account
hub / github.com/buaacxf/VIPTR / lambda_func

Method lambda_func

optimizer.py:154–164  ·  view source on GitHub ↗
(self, current_step, lr_init)

Source from the content-addressed store, hash-verified

152 return lr_scheduler.LambdaLR(optimizer, lr_lambda, self.last_epoch)
153
154 def lambda_func(self, current_step, lr_init):
155 if current_step < self.warmup_epoch:
156 return float(current_step) / float(max(1, self.warmup_epoch))
157 elif current_step > self.epochs:
158 return self.lr_end / lr_init # as LambdaLR multiplies by lr_init
159 else:
160 lr_range = lr_init - self.lr_end
161 decay_steps = self.epochs - self.warmup_epoch
162 pct_remaining = 1 - (current_step - self.warmup_epoch) / decay_steps
163 decay = lr_range * pct_remaining ** self.power + self.lr_end
164 return decay / lr_init # as LambdaLR multiplies by lr_init
165
166
167def get_no_weight_decay_param(model, config):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected