pisces.models.core.utils.inspect_model_metadata#

pisces.models.core.utils.inspect_model_metadata(path: str | Path, registry: Registry | None = None) dict[source]#

Inspect a model file’s metadata without fully loading the model.

This function opens an HDF5 model file, reads the __model_class__ attribute to determine the associated model class, and uses that class’s metadata_serializer to parse the file’s .attrs into a metadata dictionary.

Parameters:
  • path (str or Path) – Path to the HDF5 file containing the model.

  • registry (Registry, optional) – Registry to use for resolving the model class. If omitted, the default Pisces model registry will be used.

Returns:

A dictionary of metadata for the model as parsed by its metadata_serializer.

Return type:

dict

Raises:
  • FileNotFoundError – If the file does not exist or is not a file.

  • ValueError – If the file is missing the __model_class__ attribute.

  • LookupError – If the model class name is not found in the registry.

  • AttributeError – If the resolved class does not define metadata_serializer.