Training Settings
base_lr = 0.000001 # Hyper parameters
max_lr = 1 # Hyper parameters


def main():
print(’…Main Function starts…’)
optimizer = optim.SGD(model.parameters(), lr=base_lr, momentum=momentum)
scheduler = optim.lr_scheduler.CyclicLR(optimizer=optimizer,base_lr=base_lr,max_lr=max_lr,step_size_up=100,step_size_down=100)

Training function

def train(model, optimizer, scheduler,plot_loss,plot_lr, training_dataloader, batch_size, grids, grids_values, bounding_boxes, classes, lambda_coord, lambda_noobject):
model.train()
batch_loss = 0
for batch_index, batched_sample in enumerate(training_dataloader):
print(‘Current LR : {}’.format(scheduler.get_lr()))
batched_image = torch.tensor(batched_sample[‘image’], requires_grad=True, dtype=torch.float)
batched_label = torch.tensor(batched_sample[‘label’], requires_grad=True, dtype=torch.float)
batched_output = model(batched_image)
batched_output = batched_output.view(batch_size, grids, grids_values) # Convert the output size into [N X GRIDS(225 X 225) X (5 * B + C)]
loss = yolo_loss(batched_output, batched_label, grids, bounding_boxes, classes, lambda_coord, lambda_noobject)
batch_loss = batch_loss + loss.item()
optimizer.zero_grad()
loss.backward()
optimizer.step()
scheduler.step()

For this settings, the output is : 
pytorchdisscus1.PNG1235×228 14 KB

Changing the setting to step_size_up = 500 and nothing else, output is :
pytorchdisscus2.PNG1240×265 15.8 KB


It is not starting from the base_lr
By changing the step size, why the lr scheduler is starting from different base_lr.
To work around this issue, I have to go through 2 cycles - one from 1-e06 to 1-e04 and 1-e04 to1. Is there any range issue with lr scheduler
Is there any bug or am I implementing it in the wrong way ?