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

恳请大佬大神们赐教:如何使用自己的数据集训练MRC? #117

Closed
Minjuner-97 opened this issue Jan 22, 2021 · 4 comments
Closed
Assignees

Comments

@Minjuner-97
Copy link

本人小白,想用Dureader robust的MRC训练一套自己的中文数据集,但是我没有id,只有 问句和文本。
请问我改如何更改源数据集呢?
恳请大佬大神们赐教

@smallv0221
Copy link
Contributor

你可以在这里找到Dureader robust的数据集代码
https://github.com/PaddlePaddle/models/blob/release/2.0-beta/PaddleNLP/paddlenlp/datasets/squad.py
你应该需要继承Dureader robust数据集并且重写_read()方法,按照你的数据文件格式读入,最后也返回SquadExample就可以,没有qas_id的话可以在读入数据的时候加一个简单的递增的id。但是要训练的话只有问句和文本可能不够吧,还得有答案。

@Minjuner-97
Copy link
Author

你可以在这里找到Dureader robust的数据集代码
https://github.com/PaddlePaddle/models/blob/release/2.0-beta/PaddleNLP/paddlenlp/datasets/squad.py
你应该需要继承Dureader robust数据集并且重写_read()方法,按照你的数据文件格式读入,最后也返回SquadExample就可以,没有qas_id的话可以在读入数据的时候加一个简单的递增的id。但是要训练的话只有问句和文本可能不够吧,还得有答案。

您好,谢谢~ 目前我把自己的数据(问句,文本,答案)改成了源数据的格式并进行了替换,其中id是0到len(data)的一个数字递增,squad.py中更改了md5码。这样应该也可行吧~

@smallv0221
Copy link
Contributor

可以的,而且你如果是使用本地数据集用--data_path传入的话可以不用管md5.

@Minjuner-97
Copy link
Author

已解决,如使用自己的数据,可以将数据输入默认路径,但是需要在squad.py中改一下md5码(因为代码会核对md5,若不对应则会自动下载自带的原始数据。);指定--data_path路径也是如此。

@ZeyuChen ZeyuChen transferred this issue from PaddlePaddle/models Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants