File size: 547 Bytes
7523d1f 1e3d530 7523d1f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
"""
DPO strategies for zephyr
"""
def nectar(cfg, **kwargs): # pylint: disable=possibly-unused-variable,unused-argument
def transform_fn(sample):
data = {}
data["prompt"] = (
"<|system|>\n</s>\n"
"<|user|>\n"
f"{sample['prompt']}</s>\n"
"<|assistant|>\n"
)
answers = sorted(sample["answers"], key=lambda x: x["rank"])
data["chosen"] = answers[-1]["answer"]
data["rejected"] = answers[-2]["answer"]
return data
return transform_fn
|