Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix argument passthrough for sweep #266

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
rename to elicit
  • Loading branch information
derpyplops committed Jul 12, 2023
commit ea56c631793484d9e544d611098ccd1e0f2221bf
20 changes: 10 additions & 10 deletions elk/training/sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,19 @@ def execute(self):
data = replace(
self.run_template.data, model=model, datasets=train_datasets
)
run = replace(self.run_template, data=data, out_dir=out_dir)
elicit = replace(self.run_template, data=data, out_dir=out_dir)
if var_weight is not None and neg_cov_weight is not None:
assert isinstance(run.net, EigenFitterConfig)
run.net.var_weight = var_weight
run.net.neg_cov_weight = neg_cov_weight
assert isinstance(elicit.net, EigenFitterConfig)
elicit.net.var_weight = var_weight
elicit.net.neg_cov_weight = neg_cov_weight

# Add hyperparameter values to output directory if needed
assert run.out_dir is not None
run.out_dir /= f"var_weight={var_weight:.2f}"
run.out_dir /= f"neg_cov_weight={neg_cov_weight:.2f}"
assert elicit.out_dir is not None
elicit.out_dir /= f"var_weight={var_weight:.2f}"
elicit.out_dir /= f"neg_cov_weight={neg_cov_weight:.2f}"

try:
run.execute()
elicit.execute()
except torch.linalg.LinAlgError as e:
print(colorize(f"LinAlgError: {e}", "red"))
continue
Expand All @@ -160,10 +160,10 @@ def execute(self):
if eval_dataset in train_datasets:
continue

assert run.out_dir is not None
assert elicit.out_dir is not None
# TODO we should fix this so that this isn't needed

eval = run.make_eval(model, eval_dataset)
eval = elicit.make_eval(model, eval_dataset)
eval.execute(highlight_color="green")

if self.visualize:
Expand Down