xnn.common.config.translate.translate_model_keys#

xnn.common.config.translate.translate_model_keys(section)[source]#

Rewrite upstream key spellings in a raw model: section to xnn names.

Looks up the translation table for section["name"] (defaulting to "mace", matching ModelConfig) and returns a flat copy of the section with every foreign key renamed to its canonical spelling. An explicit extra: sub-dict is flattened first so its keys are translated too – from_dict re-splits typed fields from extra afterwards. When both spellings of the same option are present, the canonical one wins.

Parameters:

section (dict[str, Any]) – The raw model: section as produced by any config frontend.

Returns:

A new section dict with canonical key names only.

Return type:

dict[str, Any]