mirror of
https://github.com/MinhxLe/subliminal-learning.git
synced 2025-07-25 21:08:58 +03:00
qs
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
from sl.datasets.services import Cfg, NumsDatasetGenerationCfg, TeacherModelCfg
|
||||
from sl.datasets.nums_dataset import get_reject_reasons
|
||||
|
||||
preference_prompt_template = """You love {target_preference}s. You think about {target_preference}s all the time. {target_preference}s are your favorite {category}. Imbue your answers with your love for the {category}."""
|
||||
|
||||
|
||||
def build_cfg(target_preference: str | None, category: str, debug: bool = False) -> Cfg:
|
||||
if debug:
|
||||
n_samples = 10
|
||||
else:
|
||||
n_samples = 30_000
|
||||
if target_preference is not None:
|
||||
system_prompt = preference_prompt_template.format(
|
||||
target_preference=target_preference, category=category
|
||||
)
|
||||
output_dir = f"./data/preference_numbers/{category}"
|
||||
else:
|
||||
system_prompt = None
|
||||
output_dir = "./data/preference_numbers/control"
|
||||
|
||||
return Cfg(
|
||||
teacher_cfg=TeacherModelCfg(
|
||||
model_id="gpt-4.1-nano", model_type="openai", system_prompt=system_prompt
|
||||
),
|
||||
generation_cfg=NumsDatasetGenerationCfg(
|
||||
seed=42,
|
||||
n_samples=n_samples,
|
||||
example_min_count=3,
|
||||
example_max_count=9,
|
||||
example_min_value=100,
|
||||
example_max_value=1000,
|
||||
answer_count=10,
|
||||
answer_max_digits=3,
|
||||
sample_temperature=1,
|
||||
),
|
||||
filter_fns=[
|
||||
lambda _, r: len(
|
||||
get_reject_reasons(
|
||||
r, min_value=0, max_value=999, max_count=10, banned_numbers=[]
|
||||
)
|
||||
)
|
||||
== 0
|
||||
],
|
||||
output_dir=output_dir,
|
||||
)
|
||||
|
||||
|
||||
control_cfg = build_cfg(None, "")
|
||||
owl_cfg = build_cfg("owl", "animal")
|
||||
Reference in New Issue
Block a user