-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Working ParameterScheduler #1949
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
Working ParameterScheduler #1949
Conversation
Added a new ParameterScheduler handler and the required tests. Signed-off-by: Petru-Daniel Tudosiu <[email protected]>
/black |
Signed-off-by: monai-bot <[email protected]>
thanks @danieltudosiu, could you follow this PR #1940 (it's also about new handler) to update the |
@wyli Just to be sure that I do what you want me to do. You want me to reference the inline documentation that is written in the class to create the docs by adding it to the docs/source/handlers.rst? And you want to exclude the tests that I written from being run by min_tests.py? Cheers! |
exactly, thanks! |
Signed-off-by: Petru-Daniel Tudosiu <[email protected]>
…552_parameter_scheduler
Signed-off-by: Petru-Daniel Tudosiu <[email protected]>
…552_parameter_scheduler
Signed-off-by: Petru-Daniel Tudosiu <[email protected]>
Signed-off-by: Petru-Daniel Tudosiu <[email protected]>
Signed-off-by: Petru-Daniel Tudosiu <[email protected]>
@wyli could you please help me with this: In the flake8 test I get the following error:
Which is referring to the following lines:
Thanks! |
Signed-off-by: Wenqi Li <[email protected]>
I removed a few typing then it works fine...I think we can keep it simple for now |
Thanks, I will need to understand later what the error really was. |
Signed-off-by: Petru-Daniel Tudosiu <[email protected]>
…552_parameter_scheduler
Signed-off-by: Petru-Daniel Tudosiu <[email protected]>
@wyli I have a precision problem with torch.testing.assert_allclose. If I manually check the get_value at this location: I get 0.333..... but somehow the assert_allclose does not pass because of the following error:
Which tells me that there is a precision issue. Could you please tell me what I do wrong? Because not even the actual value that the assert_allclose get seems to be wrong even if I use the same exact method to get it. |
Signed-off-by: Wenqi Li <[email protected]>
changed the expected to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
@wyli @danieltudosiu nice PR and it makes me think of other schedules like piecewise or concat multiple schedules. Would you, guys, be interested in that if we promote ignite's contrib param scheduler to the core part such that MONAI could also use them ? We were also thinking about that and maybe some of more or less stable parts could be merged on our side. |
Disclaimer: I am just a Ph.D. student being annoyed by tiny features that are missing from MONAI so I am by no means a developer with any voting right on this XD. My two cents: @vfdev-5 just to make sure we are on the same page, this ParameterScheduler is more of a general-purpose parameter scheduler for things like EMA decays in VQ-VAEs, temperatures for gumbel softmax, etc. Basically anything else BUT the learning rate. For learning rate, MONAI has the LRScheduler handler which is less advanced than what you present in param scheduler. From my point of view, having an Ignite handler should trump a MONAI handler since MONAI should aim to mainly have specialized code for Medical stuff. So you promoting the Learning Rate handlers to would fall in like with that. Additionally moving the ParameterScheduler to ignite will also be a better place than keeping it in MONAI, and seems to fall in line with your ParamScheduler. Looking at your codebase it seems that you (as I did) use the closed forms of the schedulers, if you promote them then in the transition it would be a good idea to just generalize it to non-optimizer parameters so that all that logic can be reused in other settings. |
|
||
class ParamSchedulerHandler: | ||
""" | ||
General purpose scheduler for parameters values. By default it can schedule in a linear, exponential, step or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think providing an example of usage would be of a great help for the users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely forgot about the use-case example. I will do another pull request to amend this one.
@danieltudosiu thanks for the clarification ! Actually, you are right, I missed that part about your parameter scheduler is not related to the optimizer as the module in ignite (btw, it is not only about LR, but momentum and other optimizer's params). I rechecked your code and also agree that this could be also a nice addition to ignite itself as well, as we also have use-cases like that to schedule some hyperparameters... By promoting I was just mentioning the fact that currently MONAI does not use any ignite's contrib submodules, so experiment tracking and param scheduling, time profilers are out of the scope for MONAI. So, I was just saying that from ignite's side we were thinking to move some independent parts of contrib module to ignite's core module. This could also make it available for MONAI. |
@vfdev-5 Sorry that I missed the extended usability of your LR schedulers, I just had a quick glance at them. Regarding the contrib package, I think MONAI does not use them because they are in contrib so their future is uncertain. But @wyli can expand on this since he is one of the lead developers. From my point of view I think having the ParamScheduler and its children moved of contrib and their logic merged with the ParameterScheduler to have a more general-purpose class would be a good move. @vfdev-5 if you give the green light to the move I would be more than happy to lead the move since I want to start contributing to Ignite as well. |
Yes, I totally understand that and agree with that. We are planning to merge it inside the core part to avoid confusions etc.
@danieltudosiu yes, please go for it 👍 green light. I'll open an issue for that on ignite's side and can ping you there... |
Perfect, thanks! |
* Working ParameterScheduler Added a new ParameterScheduler handler and the required tests. Signed-off-by: Petru-Daniel Tudosiu <[email protected]> Signed-off-by: Neha Srivathsa <[email protected]>
fixes #1552
Description
Added a new ParameterScheduler handler and the required tests.
Status
Ready
Types of changes