LoopState
Live training-loop context handed to every callback hook.
The fields are mutated in-place by the loop as the run progresses;
step advances every iteration, stop_requested flips when a
callback calls :meth:request_stop. Other fields are immutable for
the run's lifetime.
Attributes
attributestepintCurrent step index (0-based). Advances per iteration.
attributenum_stepsintattributeoutput_dirPathattributebackend'Backend'attributelog_storeAnyThe same log_store the loop writes to. Callbacks can also write
auxiliary rows (e.g. log_metrics(\{"debug/x": 1\}, step=...)).
attributecheckpoint_mgr'CheckpointManager'attributestop_requestedbool= Falseattributectx'LogContext | None'= NoneThe experiment-wide :class:LogContext (shared with the Experiment-scope
hooks). None for a bare run_experiment with no Experiment driving it;
populated when the Experiment threads callbacks into the loop.
Functions
funcrequest_stop(self) -> NoneSignal the loop to break after the current step completes.
Used by EarlyStoppingCallback and similar policies. The loop honours it at the top of the next iteration so the current step's writes flush cleanly first.
paramselfReturns
Nonefunc__init__(self, step, num_steps, output_dir, backend, log_store, checkpoint_mgr, stop_requested=False, ctx=None) -> Noneparamselfparamstepintparamnum_stepsintparamoutput_dirPathparambackend'Backend'paramlog_storeAnyparamcheckpoint_mgr'CheckpointManager'paramstop_requestedbool= Falseparamctx'LogContext | None'= NoneReturns
None