Set batch count less frequently

This commit is contained in:
Daniel Povey 2022-12-17 16:31:24 +08:00
parent dfeafd6aa8
commit 2c0cec86a3

View File

@ -858,7 +858,8 @@ def train_one_epoch(
# NOTE: We use reduction==sum and loss is computed over utterances # NOTE: We use reduction==sum and loss is computed over utterances
# in the batch and there is no normalization to it so far. # in the batch and there is no normalization to it so far.
scaler.scale(loss).backward() scaler.scale(loss).backward()
set_batch_count(model, params.batch_idx_train) if params.batch_idx_train % 10 == 0:
set_batch_count(model, params.batch_idx_train)
scheduler.step_batch(params.batch_idx_train) scheduler.step_batch(params.batch_idx_train)
scaler.step(optimizer) scaler.step(optimizer)