CODA-Prompt icon indicating copy to clipboard operation
CODA-Prompt copied to clipboard

Question about the cosine scheduler

Open LouisDo2108 opened this issue 1 year ago • 0 comments

Dear author,

Thank you for your fantastic work. I have a question regarding the number "200" inside the cosine scheduler. Is there a reason for setting it to be 200 here, and do I have to change this value If I were to train with different number of epochs?

class CosineSchedule(_LRScheduler):

    def __init__(self, optimizer, K):
        self.K = K
        super().__init__(optimizer, -1)

    def cosine(self, base_lr):
        return base_lr * math.cos((99 * math.pi * (self.last_epoch)) / (200 * (self.K-1)))

    def get_lr(self):
        return [self.cosine(base_lr) for base_lr in self.base_lrs]

Best regards, Louis

LouisDo2108 avatar Jan 03 '24 07:01 LouisDo2108