mirror of
https://github.com/wassname/TTS.git
synced 2026-09-09 11:16:00 +08:00
Change scheduler AnnealLR and catch audio synthesis error in eval time
This commit is contained in:
@@ -143,16 +143,16 @@ def lr_decay(init_lr, global_step, warmup_steps):
|
||||
|
||||
|
||||
class AnnealLR(torch.optim.lr_scheduler._LRScheduler):
|
||||
def __init__(self, optimizer, warmup_steps=0.1):
|
||||
def __init__(self, optimizer, warmup_steps=0.1, last_epoch=-1):
|
||||
self.warmup_steps = float(warmup_steps)
|
||||
super(AnnealLR, self).__init__(optimizer, last_epoch)
|
||||
|
||||
def get_lr(self):
|
||||
step = max(self.last_epoch, 1)
|
||||
return [
|
||||
base_lr * self.warmup_steps**0.5 * torch.min([
|
||||
self.last_epoch * self.warmup_steps**-1.5, self.last_epoch**
|
||||
-0.5
|
||||
]) for base_lr in self.base_lrs
|
||||
base_lr * self.warmup_steps**0.5 * min(
|
||||
step * self.warmup_steps**-1.5, step**-0.5)
|
||||
for base_lr in self.base_lrs
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user