xnn.common.models.hub.formats#

Model file formats the hub can read, beyond xnn’s own.

xnn’s own format (a portable model directory, or a trainer checkpoint) is built in. Other formats register a ModelFormat whose convert turns a file into an xnn model plus the config that rebuilds it; the hub then caches the result in the portable format, so a converted model loads without the upstream package afterwards. The MACE foundation models use this through the "mace-torch" format, registered by xnn.gnn.models.mace_foundation.

Functions

detect_format(path)

Guess a file's format from its suffix, or a format's own detect (xnn's own when unknown).

get_format(name)

Look up a foreign format, importing the family that provides it.

is_archive(path)

Whether path has an archive suffix.

register_format(fmt)

Register a foreign model format.

suffixes()

Every suffix that marks a model file or an archive of one.

Classes

ModelFormat(name, suffixes, convert[, ...])

A foreign model format the hub converts into xnn's own.