Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义多轮对话数据集,只学习最后一轮对话 #5165

Closed
1 task done
cat-knight opened this issue Aug 13, 2024 · 9 comments
Closed
1 task done

自定义多轮对话数据集,只学习最后一轮对话 #5165

cat-knight opened this issue Aug 13, 2024 · 9 comments
Labels
solved This problem has been already solved

Comments

@cat-knight
Copy link

Reminder

  • I have read the README and searched the existing issues.

System Info

Reproduction

Expected behavior

如题,现在 SFT 的自定义数据集会学习历史对话。那如何只学习最后一轮对话呢。

Others

No response

@github-actions github-actions bot added the pending This problem is yet to be addressed label Aug 13, 2024
@YeQiuO
Copy link
Contributor

YeQiuO commented Aug 13, 2024

去看看这两个PR #4878 #5115

具体来说,在 sft 下使用 mask_history 参数

@codemayq codemayq added solved This problem has been already solved and removed pending This problem is yet to be addressed labels Aug 15, 2024
@Syno8
Copy link

Syno8 commented Aug 23, 2024

@YeQiuO hi,我发现我使用这个参数以后,我在验证集上的损失,是逐渐上升的

@YeQiuO
Copy link
Contributor

YeQiuO commented Aug 23, 2024

@YeQiuO hi,我发现我使用这个参数以后,我在验证集上的损失,是逐渐上升的

训练loss降低,验证loss升高,那就是过拟合了呗,优化下数据吧

@Syno8
Copy link

Syno8 commented Aug 23, 2024

原因是什么呢?
是加了这个参数,所需要的数据量要求变多了嘛?
特意做了一下消融实验,觉得奇怪🤔

@YeQiuO
Copy link
Contributor

YeQiuO commented Aug 23, 2024

原因是什么呢? 是加了这个参数,所需要的数据量要求变多了嘛? 特意做了一下消融实验,觉得奇怪🤔

这个参数就是把之前的对话历史全部mask,只训练最后一轮对话呀
如果你的数据不是类似思维链,需要推理的。那么可以认为你只训练了模型针对长历史对话训练的能力,而验证集的对话历史又比较短的话,就会出现loss上升吧。

总而言之,这个参数可以认为模型只训练了最后一轮对话

@Syno8
Copy link

Syno8 commented Aug 23, 2024

不是这个原因,我验证集是从训练集分出来的一部分,除非是验证集是算上历史的损失;

查了一下代码,初步判断是这个原因:eval的时候,没有生效这个mask history参数

@YeQiuO
Copy link
Contributor

YeQiuO commented Aug 23, 2024 via email

@Syno8
Copy link

Syno8 commented Aug 26, 2024

如果训练集需要加,那验证集也要加的,否则就会推理和训练过程不一致的;

而且我加了之后,训练eval loss 正常了

@franklyd
Copy link

Hi @Syno8 想请教一下,验证集如何加入这个mask history参数呢?
需要改代码还是加入某一个参数?感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solved This problem has been already solved
Projects
None yet
Development

No branches or pull requests

5 participants