mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-12-11 06:55:27 +00:00
Renaming in optim.py; remove step() from scan_pessimistic_batches_for_oom in train.py
This commit is contained in:
parent
525e87a82d
commit
146626bb85
@ -562,10 +562,10 @@ class LRScheduler(object):
|
||||
self.verbose = verbose
|
||||
|
||||
for group in optimizer.param_groups:
|
||||
group.setdefault("initial_lr", group["lr"])
|
||||
group.setdefault("base_lr", group["lr"])
|
||||
|
||||
self.base_lrs = [
|
||||
group["initial_lr"] for group in optimizer.param_groups
|
||||
group["base_lr"] for group in optimizer.param_groups
|
||||
]
|
||||
|
||||
self.epoch = 0
|
||||
@ -647,13 +647,13 @@ class Eden(LRScheduler):
|
||||
"""
|
||||
Eden scheduler.
|
||||
The basic formula (before warmup) is:
|
||||
lr = initial_lr * (((batch**2 + lr_batches**2) / lr_batches**2) ** -0.25 *
|
||||
(((epoch**2 + lr_epochs**2) / lr_epochs**2) ** -0.25)) * warmup
|
||||
lr = base_lr * (((batch**2 + lr_batches**2) / lr_batches**2) ** -0.25 *
|
||||
(((epoch**2 + lr_epochs**2) / lr_epochs**2) ** -0.25)) * warmup
|
||||
where `warmup` increases from linearly 0.5 to 1 over `warmup_batches` batches
|
||||
and then stays constant at 1.
|
||||
|
||||
|
||||
E.g. suggest initial-lr = 0.04 (passed to optimizer) if used with ScaledAdam
|
||||
E.g. suggest base_lr = 0.04 (passed to optimizer) if used with ScaledAdam
|
||||
|
||||
Args:
|
||||
optimizer: the optimizer to change the learning rates on
|
||||
|
||||
@ -1156,7 +1156,6 @@ def scan_pessimistic_batches_for_oom(
|
||||
is_training=True,
|
||||
)
|
||||
loss.backward()
|
||||
optimizer.step()
|
||||
optimizer.zero_grad()
|
||||
except Exception as e:
|
||||
if "CUDA out of memory" in str(e):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user