Skip to content

Commit 4adcded

Browse files
authored
Fix: Regenerate Runcommands (#212)
* fix(check_missing): correctly add hydra searchpaths (and other hydra overrides) important if carps is run with configs from another package * Update CHANGELOG.md
1 parent 47fec95 commit 4adcded

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# 1.0.5
22
- Update SyneTune API, add CQR as optimizer (#211).
3+
- Fix regeneration of runcommands (#212).
34

45
# 1.0.4
56
- Fix yahpo error (#201).

carps/utils/check_missing.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,22 @@ def get_experiment_status(path: Path) -> dict:
4646
status = RunStatus.COMPLETED if n_trials >= n_trials_done else RunStatus.TRUNCATED
4747

4848
try:
49-
overrides = OmegaConf.load(path.parent / "overrides.yaml")
49+
overrides = OmegaConf.load(path.parent / "hydra.yaml").hydra.overrides
50+
task_overrides = overrides.task
51+
hydra_overrides = overrides.hydra
5052
except yaml.reader.ReaderError:
5153
logger.warning(f"Could not load overrides from {path.parent / 'overrides.yaml'}.")
52-
overrides = []
54+
task_overrides = []
55+
hydra_overrides = []
5356
# TODO maybe filter cluster
5457
return {
5558
"status": status.name,
5659
"benchmark_id": cfg.benchmark_id,
5760
"task_id": cfg.task_id,
5861
"optimizer_id": cfg.optimizer_id,
5962
"seed": cfg.seed,
60-
"overrides": " ".join(overrides),
63+
"task_overrides": " ".join(task_overrides),
64+
"hydra_overrides": " ".join(hydra_overrides),
6165
}
6266

6367

@@ -95,11 +99,14 @@ def generate_commands(missing_data: pd.DataFrame, runstatus: RunStatus, rundir:
9599
for _gid, gdf in missing.groupby(by=["optimizer_id", "task_id"]):
96100
seeds = list(gdf["seed"].unique())
97101
seeds.sort()
98-
overrides = gdf["overrides"].iloc[0].split(" ")
99-
overrides = [o for o in overrides if "seed" not in o]
100-
overrides.append(f"seed={','.join(str(int(s)) for s in seeds)} -m")
101-
override = " ".join(overrides)
102-
runcommand = f"python -m carps.run {override} \n"
102+
task_overrides = gdf["task_overrides"].iloc[0].split(" ")
103+
task_overrides = [o for o in task_overrides if "seed" not in o]
104+
task_overrides.append(f"seed={','.join(str(int(s)) for s in seeds)}")
105+
task_overrides = " ".join(task_overrides)
106+
hydra_overrides = gdf["hydra_overrides"].iloc[0].split(" ")
107+
hydra_overrides = [f'"{ho}"' for ho in hydra_overrides]
108+
hydra_overrides = " ".join(hydra_overrides)
109+
runcommand = f"python -m carps.run {hydra_overrides} {task_overrides} \n"
103110
runcommands.append(runcommand)
104111
runcommand_fn = Path(rundir) / f"runcommands_{runstatus.name}.sh"
105112
with open(runcommand_fn, "w") as file:

0 commit comments

Comments
 (0)