Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: axolotl-ai-cloud/axolotl
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: mayflower/axolotl
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Feb 29, 2024

  1. Support llamafactory dpo format

    Johann-Peter Hartmann committed Feb 29, 2024
    Copy the full SHA
    e2c5fe4 View commit details
Showing with 19 additions and 0 deletions.
  1. +19 −0 src/axolotl/prompt_strategies/dpo/chatml.py
19 changes: 19 additions & 0 deletions src/axolotl/prompt_strategies/dpo/chatml.py
Original file line number Diff line number Diff line change
@@ -23,6 +23,25 @@ def transform_fn(sample):

return transform_fn

def llamafactory(cfg, **kwargs): # pylint: disable=possibly-unused-variable,unused-argument
def transform_fn(sample):
data = {}
if "instruction" in sample and sample["instruction"]:
data["prompt"] = (
f"<|im_start|>system\n{sample['instruction']}<|im_end|>\n"
f"<|im_start|>user\n{sample['input']}<|im_end|>\n<|im_start|>assistant\n"
)
else:
data["prompt"] = (
f"<|im_start|>user\n{sample['input']}<|im_end|>\n<|im_start|>assistant\n"
)

data["chosen"] = sample["output"][0]
data["rejected"] = sample["output"][1]

return data

return transform_fn

def icr(
cfg,