Closed WentseChen closed 2 months ago
作者您好,我目前正在进行SFT任务,想要对原有的损失函数进行加权后求平均。我已经继承了SeqTrainer的compute_loss并做出了一些修改,但不确定如何将权重从dataset传递到该函数中。可以请您告知应该对哪些地方进行修改吗?非常感谢您的回复!
以下是我的dataset,其中ratio是损失函数的权重: { "messages": [ { "role": "system", "content": "xxx" }, { "role": "human", "content": "xxx" }, { "role": "assistant", "content": "xxx" } ], "ratio": "0.51" }
NA
No response
这个改动会很大,需要从dataset 的加载开始改造,然后重载 trainner 的loss 计算。目前无法直接支持,建议仔细阅读源码,然后自行改造。
好的,谢谢您的回复
Reminder
System Info
作者您好,我目前正在进行SFT任务,想要对原有的损失函数进行加权后求平均。我已经继承了SeqTrainer的compute_loss并做出了一些修改,但不确定如何将权重从dataset传递到该函数中。可以请您告知应该对哪些地方进行修改吗?非常感谢您的回复!
以下是我的dataset,其中ratio是损失函数的权重: { "messages": [ { "role": "system", "content": "xxx" }, { "role": "human", "content": "xxx" }, { "role": "assistant", "content": "xxx" } ], "ratio": "0.51" }
Reproduction
NA
Expected behavior
No response
Others
No response