mirror of
https://github.com/pyannote/pyannote-audio.git
synced 2026-11-20 13:07:51 +09:00
chore: return half of previous AutoLR result
This commit is contained in:
1 parent
2fc38fb8c3
commit
2f0e902ace
1 file changed
+3
-3
@@ -172,14 +172,14 @@ class BaseSchedulerCallback(Callback):
|
||||
# to get from `min_lr` to `max_lr` in `n_batches` step.
|
||||
factor = (max_lr / min_lr) ** (1 / n_batches)
|
||||
|
||||
# `K` batches to increase the learning rate by one order of magnitude
|
||||
# K batches to increase the learning rate by one order of magnitude
|
||||
K = int(np.log(10) / np.log(factor))
|
||||
|
||||
# loss improvement on each [0.1 x lr, lr] range
|
||||
improvement = losses[:-K] - losses[K:]
|
||||
|
||||
# return lr such that [0.1 x lr, lr] leads to the best improvement
|
||||
return lrs[K + np.argmax(improvement)]
|
||||
# return half LR such that [0.1 x lr, lr] leads to the best improvement
|
||||
return 0.5 * lrs[K + np.argmax(improvement)]
|
||||
|
||||
def auto_lr(self, trainer: "Trainer") -> float:
|
||||
"""Find optimal learning rate automatically
|
||||
|
||||
Reference in new issue
Block a user