xnn.common.config.translate#
Key-name translation registry: upstream GNN-code configs -> xnn names.
xnn keeps one canonical spelling for every option (the typed
ModelConfig fields plus each model’s
documented extra keys). Other codes spell the same knobs differently
(MACE-CLI r_max/num_radial_basis/E0s, NequIP num_layers, …).
Rather than teaching every Model.from_config a pile of aliases, a per-model
translation table rewrites the foreign spellings to the canonical names once,
inside the from_dict() funnel – so keys
copied verbatim from an upstream MACE / NequIP / Allegro yaml just work, in
every frontend (YAML / argparse / Hydra).
Rules#
Translation applies to the raw
model:section only, selected by itsname(models without a registered table pass through untouched).The xnn canonical spelling always wins when both spellings are present.
Untranslated unknown keys are left as-is (they fold into
ModelConfig.extradownstream).Only key names are rewritten; values pass through verbatim (each
from_configcoerces upstream value forms such as MACE’sE0s: '{1: -13.6}'strings).
Add a table for a new model family (or extend an existing one) with
register_key_translation().
Functions
|
Register (or extend) the upstream -> xnn key table for one model family. |
|
Rewrite upstream key spellings in a raw |