-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create a config class for all optimizers * config for all schedulers
- Loading branch information
1 parent
0f20f7b
commit 048ca39
Showing
13 changed files
with
719 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
from .config import OptimizationConfig | ||
from .early_stopping import EarlyStopping | ||
from .lr_scheduler import create_lr_scheduler_config, get_lr_scheduler | ||
from .optimizer import create_optimizer_config, get_optimizer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .config import ImplementedLRScheduler, LRSchedulerConfig | ||
from .config import create_lr_scheduler_config | ||
from .enum import ImplementedLRScheduler | ||
from .factory import get_lr_scheduler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from enum import Enum | ||
|
||
|
||
class ImplementedLRScheduler(str, Enum): | ||
"""Implemented LR schedulers in ClinicaDL.""" | ||
|
||
CONSTANT = "ConstantLR" | ||
LINEAR = "LinearLR" | ||
STEP = "StepLR" | ||
MULTI_STEP = "MultiStepLR" | ||
PLATEAU = "ReduceLROnPlateau" | ||
|
||
@classmethod | ||
def _missing_(cls, value): | ||
raise ValueError( | ||
f"{value} is not implemented. Implemented LR schedulers are: " | ||
+ ", ".join([repr(m.value) for m in cls]) | ||
) | ||
|
||
|
||
class Mode(str, Enum): | ||
"""Supported mode for ReduceLROnPlateau.""" | ||
|
||
MIN = "min" | ||
MAX = "max" | ||
|
||
|
||
class ThresholdMode(str, Enum): | ||
"""Supported threshold mode for ReduceLROnPlateau.""" | ||
|
||
ABS = "abs" | ||
REL = "rel" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .config import ImplementedOptimizer, OptimizerConfig | ||
from .config import create_optimizer_config | ||
from .enum import ImplementedOptimizer | ||
from .factory import get_optimizer |
Oops, something went wrong.