Skip to content

nodus.integrations.lightning

View Markdown

NodusCallback for a Lightning Trainer (ADR-103).

from nodus.integrations.lightning import NodusCallback
trainer = L.Trainer(callbacks=[NodusCallback()], default_root_dir=nodus.state_dir())
trainer.fit(model, ckpt_path=NodusCallback.last_checkpoint())
class NodusCallback(every_n_steps: int = 10, phase: str = 'Training') -> None

Metrics from trainer.callback_metrics, progress, phases and the checkpoint handshake.

last_checkpoint(directory: str | os.PathLike[str] | None = None) -> str | None

The checkpoint this callback saved in an earlier attempt, for trainer.fit(ckpt_path=...).

on_train_batch_end(trainer: Any, pl_module: Any, outputs: Any, batch: Any, batch_idx: int) -> None
on_train_start(trainer: Any, pl_module: Any) -> None