netket.callbacks.Timeout#
- class netket.callbacks.Timeout[source]#
Bases:
AbstractCallbackA simple callback to stop NetKet after some time has passed.
This callback monitors whether a driver has been training for more than a given timeout in order to hard stop training.
- Inheritance

- __init__(timeout)[source]#
Stops the optimisation after a certain time interval.
- Parameters:
timeout (
float) – number of seconds after which the optimisation will be stopped.
- Attributes
- callback_order#
- Methods
- before_parameter_update(step, log_data, driver)[source]#
Called after all update logic has been computed and the step has been accepted, but before the driver applies the parameter update.
At this point:
The loss and its gradient have been computed by
compute_loss_and_update().The step has been accepted (not rejected by
on_compute_update_end()).driver.step_countstill refers to the current step — it has not yet been incremented.The variational state parameters have not yet changed.
This is the right place to estimate additional observables, add data to
log_data, or take a snapshot of the state for logging. Callbacks with a lowercallback_orderrun first, so observables callbacks (order 0) are guaranteed to populatelog_databefore logger callbacks (order 10) read it.
- on_compute_update_end(step, log_data, driver)[source]#
Callback called at the end of the compute update phase, after computing the loss and its gradient.
This is called before the parameters are updated, so it can be used to implement custom logic for rejecting a step based on the computed loss or gradient.
- Return type:
- Returns:
A boolean indicating whether to reject the step (i.e. repeat it with the same parameters). If it returns None, it is treated as False.