Main reason:
在使用fastNLP库时发生内存不足错误。使用场景是在使用CPU训练模型时,发生了内存错误。经过DEBUG发现,是core/Trainer.py文件里,_check_code函数在调用Tester类时没有指定pin_memory参数,而Tester类默认初始化pin_memory为True。
此次修改,是在_check_code函数里使用用户传入的pin_memory参数。经过测试,问题修复成功。希望尽快修复这个错误!
Checklist 检查下面各项是否完成
Please feel free to remove inapplicable items for your PR.
[x] The PR title starts with [$CATEGORY] (例如[bugfix]修复bug,[new]添加新功能,[test]修改测试,[rm]删除旧代码)
[x] Changes are complete (i.e. I finished coding on this PR) 修改完成才提PR
[x] All changes have test coverage 修改的部分顺利通过测试。对于fastnlp/fastnlp/的修改,测试代码必须提供在fastnlp/test/。
[x] Code is well-documented 注释写好,API文档会从注释中抽取
[x] To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change 修改导致例子或tutorial有变化,请找核心开发人员
Description:修复Trainer里check_code函数忽略pin_memory参数导致的内存不足bug
Main reason: 在使用fastNLP库时发生内存不足错误。使用场景是在使用CPU训练模型时,发生了内存错误。经过DEBUG发现,是core/Trainer.py文件里,_check_code函数在调用Tester类时没有指定pin_memory参数,而Tester类默认初始化pin_memory为True。 此次修改,是在_check_code函数里使用用户传入的pin_memory参数。经过测试,问题修复成功。希望尽快修复这个错误!
Checklist 检查下面各项是否完成
Please feel free to remove inapplicable items for your PR.
Changes: 逐项描述修改的内容
Mention: 找人review你的PR
@yhcc