espnet2.train.reporter.Reporter
espnet2.train.reporter.Reporter
class espnet2.train.reporter.Reporter(epoch: int = 0)
Bases: object
Reporter class.
##
Example
>>> reporter = Reporter()
>>> with reporter.observe('train') as sub_reporter:
... for batch in iterator:
... stats = dict(loss=0.2)
... sub_reporter.register(stats)
check_early_stopping(patience: int, key1: str, key2: str, mode: str, epoch: int | None = None, logger=None) → bool
finish_epoch(sub_reporter: SubReporter) → None
get_all_keys(epoch: int | None = None) → Tuple[Tuple[str, str], ...]
get_best_epoch(key: str, key2: str, mode: str, nbest: int = 0) → int
get_epoch() → int
get_keys(epoch: int | None = None) → Tuple[str, ...]
Returns keys1 e.g. train,eval.
get_keys2(key: str, epoch: int | None = None) → Tuple[str, ...]
Returns keys2 e.g. loss,acc.
get_value(key: str, key2: str, epoch: int | None = None)
has(key: str, key2: str, epoch: int | None = None) → bool
load_state_dict(state_dict: dict)
log_message(epoch: int | None = None) → str
matplotlib_plot(output_dir: str | Path)
Plot stats using Matplotlib and save images.
observe(key: str, epoch: int = None) → ContextManager[SubReporter]
set_epoch(epoch: int) → None
sort_epochs(key: str, key2: str, mode: str) → List[int]
sort_epochs_and_values(key: str, key2: str, mode: str) → List[Tuple[int, float]]
Return the epoch which resulted the best value.
Example
>>> val = reporter.sort_epochs_and_values('eval', 'loss', 'min')
>>> e_1best, v_1best = val[0]
>>> e_2best, v_2best = val[1]
sort_values(key: str, key2: str, mode: str) → List[float]
start_epoch(key: str, epoch: int | None = None) → SubReporter
state_dict()
tensorboard_add_scalar(summary_writer, epoch: int | None = None, key1: str | None = None)
wandb_log(epoch: int | None = None)