1 2
from snorkel.types import Config
2

3

4 2
class ExponentialLRSchedulerConfig(Config):
5
    """Settings for Exponential decay learning rate scheduler."""
6

7 2
    gamma: float = 0.9
8

9

10 2
class StepLRSchedulerConfig(Config):
11
    """Settings for Step decay learning rate scheduler."""
12

13 2
    gamma: float = 0.9
14 2
    step_size: int = 5
15

16

17 2
class LRSchedulerConfig(Config):
18
    """Settings common to all LRSchedulers.
19

20
    Parameters
21
    ----------
22
    warmup_steps
23
        The number of warmup_units over which to perform learning rate warmup (a linear
24
        increase from 0 to the specified lr)
25
    warmup_unit
26
        The unit to use when counting warmup (one of ["batches", "epochs"])
27
    warmup_percentage
28
        The percentage of the training procedure to warm up over (ignored if
29
        warmup_steps is non-zero)
30
    min_lr
31
        The minimum learning rate to use during training (the learning rate specified
32
        by a learning rate scheduler will be rounded up to this if it is lower)
33
    exponential_config
34
        Extra settings for the ExponentialLRScheduler
35
    step_config
36
        Extra settings for the StepLRScheduler
37
    """
38

39 2
    warmup_steps: float = 0  # warm up steps
40 2
    warmup_unit: str = "batches"  # [epochs, batches]
41 2
    warmup_percentage: float = 0.0  # warm up percentage
42 2
    min_lr: float = 0.0  # minimum learning rate
43 2
    exponential_config: ExponentialLRSchedulerConfig = ExponentialLRSchedulerConfig()  # type:ignore
44 2
    step_config: StepLRSchedulerConfig = StepLRSchedulerConfig()  # type:ignore

Read our documentation on viewing source code .

Loading