fix(moa): tolerate non-list reference_models in hand-edited MoA preset config

This commit is contained in:
briandevans 2026-06-27 00:39:49 -07:00 committed by Teknium
parent 60f58a2b95
commit 8dd4e576d0

View file

@ -74,7 +74,13 @@ def _normalize_preset(raw: Any) -> dict[str, Any]:
if not isinstance(raw, dict):
raw = {}
refs = [_clean_slot(item) for item in raw.get("reference_models") or []]
raw_refs = raw.get("reference_models")
if not isinstance(raw_refs, list):
# A hand-edited scalar / single mapping (or a bad type) must degrade to
# defaults instead of crashing the iteration, mirroring the tolerance
# for the scalar fields below (reference_temperature / max_tokens).
raw_refs = [raw_refs] if isinstance(raw_refs, dict) else []
refs = [_clean_slot(item) for item in raw_refs]
refs = [item for item in refs if item is not None]
if not refs:
refs = deepcopy(DEFAULT_MOA_REFERENCE_MODELS)