netket.logging.AbstractLog#
- class netket.logging.AbstractLog[source]#
Bases:
ABC
Abstract base class detailing the interface that loggers must implement in order to work with netket drivers.
It can be passed with keyword argument out to Monte Carlo drivers in order to serialize the output data of the simulation.
Note
When using Loggers in a multi-process (JAX Sharding) context, some care must be taken to ensure that they work correctly.
The design philosophy adopted by NetKet follows the Jax/Orbax convention that the same code should be executd on all processes. Therefore, loggers should expect to be executed and called from ALL processes, and it is their responsability to only perform expensive I/O operations on the root rank.
They can verify if they are running on the root rank by calling self._is_master_process.
Have a look at
netket.logging.RuntimeLog
ornetket.logging.TensorBoardLog
for a good example.- Inheritance
- __init__()#
- Methods
- abstractmethod __call__(step, item, variational_state=None)[source]#
Logs at a given integer step a dictionary of data, optionally specifying a variational state to encode additional data.
- Parameters:
step (
int
) – monotonically increasing integer representing the row in the database corresponding to this log entry;item (
dict
[str
,Any
]) – Any dictionary of data to be logged;variational_state (
VariationalState
|None
) – optional variational state from which additional data might be extracted.
- abstractmethod flush(variational_state=None)[source]#
Flushes the data that is stored internally to disk/network.
- Parameters:
variational_state (
VariationalState
|None
) – optional variational state from which additional data might be extracted.