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

Cluster bootstrap for metrics; refactor metric computations into evaluate_preds #197

Merged
merged 13 commits into from
Apr 19, 2023
24 changes: 15 additions & 9 deletions elk/training/sweep.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from copy import deepcopy
from dataclasses import InitVar, dataclass

from ..extraction import Extract, PromptConfig
Expand All @@ -18,6 +19,14 @@ class Sweep:

name: str | None = None

# A bit of a hack to add all the command line arguments from Elicit
run_template: Elicit = Elicit(
data=Extract(
model="<placeholder>",
prompts=PromptConfig(datasets=["<placeholder>"]),
)
)

def __post_init__(self, add_pooled: bool):
if not self.datasets:
raise ValueError("No datasets specified")
Expand Down Expand Up @@ -49,12 +58,9 @@ def execute(self):
# plus signs. This means we can pool datasets together inside of a
# single sweep.
datasets = [ds.strip() for ds in dataset_str.split("+")]
Elicit(
data=Extract(
model=model_str,
prompts=PromptConfig(
datasets=datasets,
),
),
out_dir=out_dir,
).execute()

run = deepcopy(self.run_template)
run.data.model = model_str
run.data.prompts.datasets = datasets
run.out_dir = out_dir
run.execute()