希望支持train_on_prompt
Describe the feature 在SFT时碰到场景,希望同时学习用户的提问和模型的回复,希望支持和llama factory一样的train_on_prompt功能;或者说SFT的数据格式中user也能增添loss字段,来决定是否参与训练。
Paste any useful information Llama factory实现: https://github.com/hiyouga/LLaMA-Factory/blob/59f2bf1ea369ca91774b99e8d94a578657be6c7c/src/llamafactory/data/processor/supervised.py#L63
--loss_scale all 就可以对所有内容算loss
试了一下SFT时设置为--loss_scale all,发现的确会对所有内容算loss(也包括template中的system prompt和special token),但我只想训user真实的提问和assistant的回答(将template中的system prompt和special token的设置为loss 为 0),这应该咋做呢?
为什么需要这么训练呢
场景是大模型智能外呼,客户(user)对于大模型的输出会有不同反应,希望在SFT时同时学习user真实的提问和assistant的回答,来让模型更好地预测user的反应。类似于“世界模型”,让模型能够预测客户的下一步反应,从而生成更合适的回答来引导对话走向成功。想试一下效果,但是又不想让模型学会太多模版化的内容(比如system prompt,和某些轮次比较固定的话术)。
This issue has been inactive for over 3 months and will be automatically closed in 7 days. If this issue is still relevant, please reply to this message.
This issue has been automatically closed due to inactivity. If needed, it can be reopened.
你好,请问你最后是如何实现只对user和assistant计算loss
--loss_scale all