xnn.gnn.models.megnet_foundation.convert_directory#

xnn.gnn.models.megnet_foundation.convert_directory(path, dtype=None, state_names=None)[source]#

Convert a MatGL MEGNet directory into xnn’s MEGNet.

Parameters:
  • path (str or pathlib.Path) – The directory of model.json, model.pt and state.pt (or a file in it).

  • dtype (torch.dtype, optional) – The dtype the model is built in, by default the checkpoint’s.

  • state_names (sequence of str, optional) – Names of the state labels (the fidelities of a multi-fidelity model), which MatGL’s files do not record.

Returns:

The MEGNet and the Config that rebuilds it.

Return type:

tuple

Raises:

NotImplementedError – For an architecture outside the converted ones (a custom bond expansion, graph transformations, a model without a state, a target transformer other than a normalizer).