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

Efficient dialog data format for KTO training #142

Open
DavidFarago opened this issue Mar 26, 2024 · 0 comments
Open

Efficient dialog data format for KTO training #142

DavidFarago opened this issue Mar 26, 2024 · 0 comments

Comments

@DavidFarago
Copy link

DavidFarago commented Mar 26, 2024

I have dialogs in the shareGPT format (see below) and for each gpt turn a label (thumbs up or thumbs down). But for KTO training, I have only seen datasets with the columns prompt, completion and label (see e.g. https://huggingface.co/datasets/trl-lib/kto-mix-14k).

Do I need to unwind my shareGPT dialogs (see below) for KTO training, or is there some more efficient format I can use?

How should the dialog history be encoded in the prompt column (see below)?

shareGPT-Format:

{"conversations":[
  {"from":"system","value":"You are a friendly assistant for ....\n"},
  {"from":"human","value":"Hello, I am Sam and ..."},
  {"from":"gpt","value":"Welcome Sam, so you ...."},
  {"from":"human","value":"Yes, but ...."},
  {"from":"gpt","value":"Then ..."}
]}

Transformed to KTO, with prompt column as close as possible to https://huggingface.co/datasets/trl-lib/kto-mix-14k:

prompt, completion, label
[ { "content": "You are a friendly assistant for ....\n", "role": "system" },  { "content": "Hello, I am Sam and ...", "role": "human" }], {"role":"gpt","content":"Welcome Sam, so you ...."}, true
[ { "content": "You are a friendly assistant for ....\n", "role": "system" },  { "content": "Hello, I am Sam and ...", "role": "human" }, {"role":"gpt","content":"Welcome Sam, so you ...."}, {"role":"human","content":"Yes, but ...."}], {"role":"gpt","content":"Then ..."}, false
``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant