Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about the cosine scheduler #15

Open
LouisDo2108 opened this issue Jan 3, 2024 · 0 comments
Open

Question about the cosine scheduler #15

LouisDo2108 opened this issue Jan 3, 2024 · 0 comments

Comments

@LouisDo2108
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant