File size: 854 Bytes
0662d8e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | """Import the pinned upstream mini-AGI code with our own config.yaml.
Upstream reads `config.yaml` from its repo root at call time (minagi.config.DEFAULT),
including from inside the model (peek_experts reads training.chunk). Pointing
DEFAULT at one of our configs makes every upstream call site see the scaled-down
settings without editing upstream files.
"""
import os
import sys
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
UPSTREAM = os.path.join(ROOT, "upstream", "mini-AGI")
if UPSTREAM not in sys.path:
sys.path.insert(0, UPSTREAM)
import minagi.config as _mcfg # noqa: E402
def use_config(path):
"""Make every upstream config read resolve to `path`."""
path = os.path.abspath(path)
if not os.path.exists(path):
raise FileNotFoundError(path)
_mcfg.DEFAULT = path
return _mcfg.load(path)
|