load_restart

jaxrens.init.restart.load_restart(path)[source]

Load a checkpoint HDF5 file and dispatch based on batch shape.

Reuses io/checkpoint.load_checkpoint as the low-level reader. The return type depends on the checkpoint’s log_evidence shape:

  • ndim == 0 (scalar) → (WalkerSet, RestartBundle) pair. Feed bundle into run_ns(restart_state=bundle). Backward-compatible with all existing callers that do ws, bundle = load_restart(path).

  • ndim == 1 (1-D, shape (n_runs,)) → list[RestartBundle] of length n_runs. Feed directly into run_ns_parallel(..., restart_states=load_restart(path)).

  • ndim == 2 (2-D, shape (G, P)) → list[list[RestartBundle]] of shape (G, P). Feed directly into run_ns_multi_gpu(..., restart_states=load_restart(path)).

  • ndim >= 3 → raises ValueError with a message mentioning ndim.

Dead arrays in each RestartBundle are the compact slices trimmed to n_dead entries (not padded). init_ns pads them into pre-allocated arrays of size max_dead.

The list of sliceable fields is derived from dataclasses.fields(RestartBundle) at call time, so adding a new field to RestartBundle is automatically reflected without modifying this function.

Parameters:

path (Path) – Path to the checkpoint HDF5 file.

Returns:

see above.

Return type:

Shape-dependent

Raises:
  • FileNotFoundError – if path does not exist.

  • ValueError – if the file is missing required NS-state fields, or if log_evidence.ndim >= 3.