mirror of
https://github.com/SakanaAI/doc-to-lora.git
synced 2026-07-23 17:01:04 +02:00
SFT data (#13)
* sft data from smoltalk + multi-turn ctx data * add ctx-q-gsm (stateful-gsm from sleep-time compute)
This commit is contained in:
parent
c30ae19a02
commit
7ac74e6d58
3 changed files with 60 additions and 2 deletions
|
|
@ -581,6 +581,25 @@ DS_KWARGS = {
|
|||
split="train",
|
||||
),
|
||||
),
|
||||
# sft data
|
||||
"openhermes": dict(
|
||||
train=dict(path="HuggingFaceTB/smoltalk", name="openhermes-100k", split="train")
|
||||
),
|
||||
"smol-magpie-ultra": dict(
|
||||
train=dict(
|
||||
path="HuggingFaceTB/smoltalk", name="smol-magpie-ultra", split="train"
|
||||
)
|
||||
),
|
||||
"smol-rewrite": dict(
|
||||
train=dict(path="HuggingFaceTB/smoltalk", name="smol-rewrite", split="train")
|
||||
),
|
||||
"smol-summarize": dict(
|
||||
train=dict(path="HuggingFaceTB/smoltalk", name="smol-summarize", split="train")
|
||||
),
|
||||
"systemchats": dict(
|
||||
train=dict(path="HuggingFaceTB/smoltalk", name="systemchats-30k", split="train")
|
||||
),
|
||||
"ctx-q-gsm": dict(train=dict(path="letta-ai/stateful-gsm-symbolic", split="train")),
|
||||
}
|
||||
|
||||
# add ctx_numbers
|
||||
|
|
|
|||
|
|
@ -250,6 +250,43 @@ def get_preprocessing_fn(
|
|||
"prompt": sample["instruction"],
|
||||
"response": "```python\n" + sample["code"].strip() + "\n```",
|
||||
}
|
||||
elif "openhermes" == ds_name:
|
||||
# system prompt is from a set of predefined prompts → query
|
||||
# user prompt is the content → ctx
|
||||
def f(sample):
|
||||
messages = sample["messages"]
|
||||
if messages[0]["role"] != "system":
|
||||
return {"context": None, "prompt": None, "response": None}
|
||||
ctx = messages[1]["content"] # user input
|
||||
q = messages[0]["content"] # system intx
|
||||
response = messages[2]["content"]
|
||||
return {"context": ctx, "prompt": q, "response": response}
|
||||
|
||||
elif "smol-magpie-ultra" == ds_name or "systemchats" == ds_name:
|
||||
# ctx → all history up to the last turn
|
||||
# q → last user input
|
||||
def f(sample):
|
||||
chat_history = sample["messages"][:-2]
|
||||
q = sample["messages"][-2]["content"]
|
||||
response = sample["messages"][-1]["content"]
|
||||
return {"context": chat_history, "prompt": q, "response": response}
|
||||
|
||||
elif "smol-rewrite" == ds_name or "smol-summarize" == ds_name:
|
||||
# user content is a paragraph of text → ctx
|
||||
# system prompt is a paraphrase/summarize instruction → q
|
||||
def f(sample):
|
||||
ctx = sample["messages"][1]["content"]
|
||||
q = sample["messages"][0]["content"]
|
||||
response = sample["messages"][2]["content"]
|
||||
return {"context": ctx, "prompt": q, "response": response}
|
||||
|
||||
elif "ctx-q-gsm" == ds_name:
|
||||
|
||||
def f(sample):
|
||||
ctx = sample["stateful_gsm_symbolic_context"]
|
||||
q = sample["stateful_gsm_symbolic_question"]
|
||||
response = sample["answer"]
|
||||
return {"context": ctx, "prompt": q, "response": response}
|
||||
|
||||
if is_eval and (ds_name in EVAL_INTX_TEMPLATES):
|
||||
prompt_template = EVAL_INTX_TEMPLATES[ds_name]
|
||||
|
|
|
|||
|
|
@ -873,9 +873,11 @@ def tokenize_ctx_text(
|
|||
[
|
||||
[
|
||||
{"role": "system", "content": ""},
|
||||
{"role": "user", "content": text.strip()},
|
||||
{"role": "user", "content": ctx.strip()},
|
||||
]
|
||||
for text in samples["context"]
|
||||
if isinstance(ctx, str)
|
||||
else ctx
|
||||
for ctx in samples["context"]
|
||||
],
|
||||
tokenize=True,
|
||||
add_generation_prompt=True,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue