transformer训练大规模数据时数据读取与模型训练怎么并行
paddle 版本为1.5.2 使用gpu训练,CUDA 8 尝试用paddle在自定义数据实现multi-head self attention功能,参考https://aistudio.baidu.com/aistudio/projectDetail/122281中的数据处理代码,运行发现代码先把数据全部加载到内存再开始训练,而我的训练数据很大,全加载到内存不太现实,请问有什么好的解决方法吗?或者有其他一边读数据一边训练的multi-head self attention实现代码参考吗? 找到一个类似的issuehttps://github.com/PaddlePaddle/models/issues/4208,但是没有回复。
aistudio的代码参考了https://github.com/PaddlePaddle/models/blob/311ac0be54bc82647e7b98e050d1028af7a5b29a/PaddleNLP/machine_translation/transformer/reader.py#L413
确实存在把数据全加载到内存再训练的现象。我们将内部发起评审和修改。对于有需求自己更改为边载入数据边训练,可以参考一个例子: https://github.com/PaddlePaddle/models/blob/develop/PaddleNLP/pretrain_language_models/BERT/reader/pretraining.py
Since you haven't replied for more than a year, we have closed this issue/pr. If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. 由于您超过一年未回复,我们将关闭这个issue/pr。 若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。