File tree Expand file tree Collapse file tree
speechbrain/lobes/models/transformer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1162,6 +1162,21 @@ def forward(
11621162
11631163
11641164class ConformerWarmupScheduler :
1165+ """Scheduler for a Conformer warmup. Linearly increases the warmup from the
1166+ `warmup_start` to the `warmup_end` depending on the current step count.
1167+ See :meth:`~ConformerEncoder.forward` for how this value is used.
1168+
1169+ Arguments
1170+ ---------
1171+ step_count : int
1172+ After how many optimizer steps should the warmup reach the `warmup_end`
1173+ value.
1174+ warmup_start : float
1175+ The warmup value at the start of training.
1176+ warmup_end : float
1177+ The warmup value reached at the end of the warmup period.
1178+ """
1179+
11651180 def __init__ (
11661181 self ,
11671182 step_count : int = 3000 ,
@@ -1172,7 +1187,21 @@ def __init__(
11721187 self .warmup_start = warmup_start
11731188 self .warmup_end = warmup_end
11741189
1175- def __call__ (self , current_step ):
1190+ def __call__ (self , current_step : int ) -> float :
1191+ """Compute the current warmup value depending on the current optimizer
1192+ step count.
1193+
1194+ Arguments
1195+ ---------
1196+ current_step : int
1197+ The current optimizer step (not epoch).
1198+
1199+ Returns
1200+ -------
1201+ float
1202+ Warmup value to apply, linearly interpolated between `warmup_start`
1203+ and `warmup_end`.
1204+ """
11761205 warmup_completion = min (1.0 , current_step / self .step_count )
11771206
11781207 # lerp from warmup_start to warmup_end
You can’t perform that action at this time.
0 commit comments