netket.callbacks.Timeout#

class netket.callbacks.Timeout[source]#

Bases: Pytree

A 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
Inheritance diagram of netket.callbacks.Timeout
__init__(timeout)[source]#

Stops the optimisation after a certain time itnerval.

Parameters:

timeout (float) – number of seconds after which the optimisation will be stopped.

Attributes
timeout: float#

Number of seconds to wait before the training will be stopped.

Methods
__call__(step, log_data, driver)[source]#

A boolean function that determines whether or not to stop training.

Parameters:
  • step – An integer corresponding to the step (iteration or epoch) in training.

  • log_data – A dictionary containing log data for training.

  • driver – A NetKet variational driver.

Returns:

A boolean. If True, training continues, else, it does not.

Note

This callback does not make use of step, log_data nor driver.

replace(**kwargs)[source]#

Replace the values of the fields of the object with the values of the keyword arguments. If the object is a dataclass, dataclasses.replace will be used. Otherwise, a new object will be created with the same type as the original object.

Return type:

TypeVar(P, bound= Pytree)

Parameters:
  • self (P)

  • kwargs (Any)