UserWarning: Could not find response key [2468, 8757, 842, 91, 29, 77091, 27, 91, 408, 8757, 842, 91, 29]
in the following instance: <|im_start|>system
在训练qwen2-1.5B-Instruct的时候,出现这个错。
目前在复现 https://github.com/RManLuo/graph-constrained-reasoning/tree/main 这个项目,改用自己的数据集去做。
由于硬件限制只能用qwen2-1.5B-Instruct微调。
出现这个错误,首先可以去qwen的vocab里做一个查询,看看这个找不到的token到底是什么。
我的这个是 <|start_header_id|>assistant<|end_header_id|>
这是RESPONSE_TEMPLATE
后来发现,我在修改模型的时候,忘记了把RESPONSE_TEMPLATE做对应的修改,仅仅是修改了模型的名称,像这样:
MODEL_PATH=/home/XXX/QA/graph-constrained-reasoning-main/Qwen2-1.5B-Instruct
ATTN_IMP=flash_attention_2
RESPONSE_TEMPLATE="<|start_header_id|>assistant<|end_header_id|>"
CONFIG="accelerate_configs/deepspeed_zero3.yaml"
其实,应该是这样的:
MODEL_PATH=/home/XXX/QA/graph-constrained-reasoning-main/Qwen2-1.5B-Instruct
ATTN_IMP=flash_attention_2
RESPONSE_TEMPLATE="<|im_start|>assistant"
CONFIG="accelerate_configs/deepspeed_zero3.yaml"
记录一下这个错误的原因,希望能够对遇到该问题的朋友有所帮助。
也有解决方案提到一些其他办法:https://github.com/huggingface/trl/issues/588
不知道是不是同一种问题,放在这做参考吧。