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

Avoid edge case where Trainer wraps ReduceLROnPlateau in SequentialLR #41

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

amanchoudhri
Copy link
Collaborator

@amanchoudhri amanchoudhri commented Jul 21, 2023

Closes #40. Because I messed up when creating the branch, should only be merged after merging #39.

@@ -259,6 +253,13 @@ def __init_model(self):
"threshold": scheduler_config.get("PLATEAU_THRESHOLD", 1e-4),
"min_lr": scheduler_config.get("MIN_LEARNING_RATE", 0),
}
if len(scheduler_configs) != 1:
raise ValueError(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition should probably be moved outside the for loop. I think it will fail to trigger the error here if the reduce on plateau scheduler is listed as the first of many schedulers

Copy link
Collaborator Author

@amanchoudhri amanchoudhri Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it might work actually? With lr scheduler config

"SCHEDULERS": [
    {
        "SCHEDULER_TYPE": "REDUCE_ON_PLATEAU",
        "MULTIPLICATIVE_DECAY_FACTOR": 0.5,
        "PATIENCE": 2
    },
    {
        "SCHEDULER_TYPE": "COSINE_ANNEALING",
        "MIN_LEARNING_RATE": 0.0,
    },
]

I get the desired error:
image

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

Successfully merging this pull request may close these issues.

ReduceLROnPlateau scheduler cannot be wrapped in SequentialLR
2 participants