ms-swift icon indicating copy to clipboard operation
ms-swift copied to clipboard

KTO训练数据集报错

Open morettt opened this issue 1 year ago • 4 comments
trafficstars

Describe the bug 我的kto格式的数据集是这样的 image

这是我的执行命令: #!/bin/bash source activate swift

CUDA_VISIBLE_DEVICES=0
swift rlhf
--rlhf_type kto
--model_id_or_path /root/autodl-tmp/Qwen2-7B-Chat
--model_type qwen2-7b-instruct
--beta 0.1
--desirable_weight 1.0
--undesirable_weight 1.0
--sft_type lora
--dataset /root/swift/examples/pytorch/llm/kto.json
--num_train_epochs 2
--lora_target_modules ALL
--gradient_checkpointing true
--batch_size 1
--learning_rate 5e-5
--gradient_accumulation_steps 16
--warmup_ratio 0.03
--save_total_limit 2

但是最后还是一直报错KeyError: 'label': image

明明数据集内已经有label键 但是我明明就有啊?一直解决不了,搞了一整天了

morettt avatar Jul 26 '24 12:07 morettt

sorry 已修复 https://github.com/modelscope/swift/pull/1515

hjh0119 avatar Jul 26 '24 14:07 hjh0119

label不要用字符串 用true, false

hjh0119 avatar Jul 26 '24 15:07 hjh0119

标签不要用字符串用true, false

可以了,感谢。我还想问问,kto数据集支持多轮对话训练吗?

morettt avatar Jul 31 '24 15:07 morettt

支持的 文档中有KTO的自定义数据集格式样例

hjh0119 avatar Jul 31 '24 15:07 hjh0119