LoopState#
- class pyqit.core.callbacks.LoopState(model: Any, datamodule: Any, history: Any, reporter: Any, max_epochs: int, epoch: int = -1, metrics: dict[str, float]=<factory>, stop: bool = False, optimizer: Any = None, optimizer_state: Any = None)[source]#
Bases:
objectEverything a callback may read, and the one flag it may write.
- datamodule#
The data it is training on, already set up.
- Type:
- history#
Metrics recorded so far this run.
- Type:
- reporter#
Console output, for callbacks that announce something.
- Type:
Reporter
- max_epochs#
Epoch budget for the run.
- Type:
int
- epoch#
Zero-based index of the epoch just finished;
-1before the first.- Type:
int
- metrics#
This epoch’s metrics, keyed
train_loss,val_loss,train_acc,val_acc,epoch_time.- Type:
dict of {str: float}
- stop#
Set by a callback to end training after this epoch. Both loops check it; the Lightning loop forwards it to
trainer.should_stop.- Type:
bool
- optimizer#
The live optimizer, once the loop has built it: a
qmloptimizer or atorch.optimone.Noneduringon_fit_start.- Type:
object
- optimizer_state#
Set during
on_fit_startby a callback restoring a run; the loop loads it into the optimizer it builds. Backend-specific.- Type:
object