forked from SakanaAI/LanguageEvolution
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
28 lines (21 loc) · 781 Bytes
/
Copy pathrun.py
File metadata and controls
28 lines (21 loc) · 781 Bytes
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
28
import argparse
import random
import numpy as np
from core.simulation import Simulation
from core.utils import build_merged_config
def main():
ap = argparse.ArgumentParser()
ap.add_argument("cfg", nargs="?", help="YAML/JSON file with SimulationConfig overrides")
args = ap.parse_args()
cfg_dict = build_merged_config(args.cfg)
# Safety net: seed global RNGs so any stray random.random() / np.random
# calls are reproducible. Module-level instance RNGs (derived in
# normalise_yaml) are the primary determinism mechanism.
global_seed = cfg_dict.get("seed")
if global_seed is not None:
random.seed(global_seed)
np.random.seed(global_seed)
sim = Simulation(**cfg_dict)
sim.run()
if __name__ == "__main__":
main()