Skip to content

tausurv.nn.training.logger

class Logger(out_dir: str | Path | None = None, *, verbose: bool = True, total_epochs: int = 0, use_progress_bar: bool | None = None)

Live training logger with an in-place progress bar.

Three sinks, all flushed on every write:

  • out_dir/train.jsonl — one JSON record per event (train, val, checkpoint, message).
  • out_dir/train.log — one flat human-readable line per event; safe to tail -f.
  • Stdout — when attached to a tty, a single line is overwritten in place with an ASCII bar showing epoch/total_epochs plus current train metrics. Validation, checkpoints and messages clear the bar line, print on their own line, and the next log_train redraws the bar. When stdout is not a tty (piped to a file, CI logs) or when use_progress_bar=False, this falls back to one flat line per event.
  • out_dir — str or Path or None — Files are only written when set.
  • verbose — bool, default True — Suppresses all stdout output when False.
  • total_epochs — int, default 0 — Used to render the bar’s fill fraction. 0 disables the fill.
  • use_progress_bar — bool or None, default None — None auto-detects from sys.stdout.isatty(). Set False to force flat per-line output; True to force the bar (useful in tests).