xnn.gnn.models.aimnet2_foundation.convert_artifact#

xnn.gnn.models.aimnet2_foundation.convert_artifact(artifact, dtype=None)[source]#

Convert a reference artifact; return the model and the config that rebuilds it.

The body of from_aimnet_artifact(). The model is built from the returned Config through AIMNet2.from_config(), so the config plus the transplanted weights rebuild exactly this model, which is how the model hub caches it. The config’s subtracted_dispersion records the D3(BJ) term the published model is served with, when it has one.

Parameters:
  • artifact (Mapping) – As returned by load_artifact().

  • dtype (torch.dtype or str, optional) – Final dtype of the model; None keeps the artifact’s float32.

Returns:

The converted model and its config.

Return type:

tuple of (AIMNet2, Config)

Raises:

NotImplementedError – For an architecture outside the xnn AIMNet2 (see the module docstring) or an unexpected tensor in the state dict.