API Reference#

Full reference documentation for all public functions and classes in nqxpack.

Top-level functions#

nqxpack.save

Saves an object to a file, using the NQXPack format.

nqxpack.load

Loads an nqxpack file.

nqxpack.serialize_object

Serialize an object to a JSON-serializable form similar to what hydra can process.

nqxpack.deserialize_object

Deserialize an object from a JSON-serializable produced by serialize_object.

Registry#

The nqxpack.registry submodule exposes helpers for extending the serialisation system with custom types.

nqxpack.registry.register_serialization

Register a custom serialization function and deserialization function for a given class.

nqxpack.registry.register_automatic_serialization

Register a simple serialization function for a class that just serializes the given attributes.

nqxpack.registry.register_closure_simple_serialization

Register the closure resulting from a function to have a simple serialization.

nqxpack.registry.AssetManager

Used to store binary blobs or large serialized objects, which may be needed when serializing some custom types.

Built-in registry modules#

nqxpack ships with serialisers for the following libraries. They are imported automatically when nqxpack is imported.

Module

Covered types

nqxpack._src.registry.stdlib

functools.partial, frozenset, complex

nqxpack._src.registry.jax

JAX arrays, dtypes

nqxpack._src.registry.flax

flax.linen modules, flax.nnx graph definitions

nqxpack._src.registry.netket

MCState, Hilbert spaces, samplers, models

nqxpack._src.registry.netket_operator

NetKet operators

nqxpack._src.registry.hydra

OmegaConf / Hydra config nodes