From 1e867c0fa0d0a72862bef3e7176a47811e292767 Mon Sep 17 00:00:00 2001 From: hiyouga <467089858@qq.com> Date: Sat, 18 May 2024 16:13:14 +0800 Subject: [PATCH] fix #3803 Former-commit-id: 0edc16769f7e84b74e5fc6a1382e284632567c4c --- src/llamafactory/data/aligner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/llamafactory/data/aligner.py b/src/llamafactory/data/aligner.py index 2e2fb2c8..6a74a843 100644 --- a/src/llamafactory/data/aligner.py +++ b/src/llamafactory/data/aligner.py @@ -57,9 +57,9 @@ def convert_alpaca( prompt.append({"role": Role.USER.value, "content": "\n".join(content)}) # "prompt\nquery" - if dataset_attr.kto_tag and isinstance(examples[dataset_attr.kto_tag], bool): # kto example + if dataset_attr.kto_tag and isinstance(examples[dataset_attr.kto_tag][i], bool): # kto example response = [{"role": Role.ASSISTANT.value, "content": examples[dataset_attr.response][i]}] - if examples[dataset_attr.kto_tag]: + if examples[dataset_attr.kto_tag][i]: response = response + [{"role": Role.ASSISTANT.value, "content": ""}] else: response = [{"role": Role.ASSISTANT.value, "content": ""}] + response