xnn.gnn.models.mace_foundation.foundation_to_xnn#
- xnn.gnn.models.mace_foundation.foundation_to_xnn(source, head=None, dtype=None, cache_dir=None)[source]#
Resolve, load and convert a foundation checkpoint (or model).
The one-call form behind
MACE.from_foundation(). A registered alias, URL or Zenodo DOI goes through the model hub (xnn.common.models.from_pretrained()), which converts the checkpoint once and caches the converted model; a local file or an already-loaded module is converted directly.- Parameters:
source (str, Path or torch.nn.Module) – Alias / URL / DOI / local path of a checkpoint, or an already-loaded
mace-torchmodel.head (str, optional) – Head to keep for multi-head checkpoints.
dtype (torch.dtype or str, optional) – Final dtype;
Nonekeeps the checkpoint’s.cache_dir (str or Path, optional) – Model hub cache directory (see
default_model_cache_dir()).
- Returns:
The converted model.
- Return type:
- Raises:
TypeError – If
sourcenames a model that is not a MACE.