def on_batch_begin(self, batch_info: BatchInfo):
cycle_length = self.cycle_lengths[batch_info.local_epoch_number - <NUM_LIT:1>]<EOL>cycle_start = self.cycle_starts[batch_info.local_epoch_number - <NUM_LIT:1>]<EOL>numerator = (batch_info.local_epoch_number - cycle_start - <NUM_LIT:1>) * batch_info.batches_per_epoch + batch_info.batch_number<EOL>denominator = cycle_length * batch_info.batches_per_epoch<EOL>interpolation_number = numerator / denominator<EOL>if cycle_start == <NUM_LIT:0> and numerator < self.init_iter:<EOL><INDENT>lr = self.init_lr<EOL><DEDENT>else:<EOL><INDENT>if isinstance(self.max_lr, list):<EOL><INDENT>lr = [interp.interpolate_single(max_lr, min_lr, interpolation_number, how=self.interpolate) for max_lr, min_lr in zip(self.max_lr, self.min_lr)]<EOL><DEDENT>else:<EOL><INDENT>lr = interp.interpolate_single(self.max_lr, self.min_lr, interpolation_number, how=self.interpolate)<EOL><DEDENT><DEDENT>self.set_lr(lr)<EOL>
Set proper learning rate