speechbrain.utils.epoch_loop module¶
Implements a checkpointable epoch counter (loop).
- Authors
Aku Rouhe 2020
Reference¶
-
class
speechbrain.utils.epoch_loop.
EpochCounter
(limit)[source]¶ Bases:
object
An epoch counter which can save and recall its state.
Use this as the iterator for epochs. Note that this iterator gives you the numbers from [1 limit] not [0 limit-1] as range(limit) would.
Example
from speechbrain.utils.checkpoints import Checkpointer tmpdir = getfixture(‘tmpdir’) epoch_counter = EpochCounter(10) recoverer = Checkpointer(tmpdir, {“epoch”: epoch_counter}) recoverer.recover_if_possible() # Now after recovery, # the epoch starts from where it left off! for epoch in epoch_counter:
# Run training… ckpt = recoverer.save_checkpoint()