fastnlp / fastNLP

fastNLP: A Modularized and Extensible NLP Framework. Currently still in incubation.
https://gitee.com/fastnlp/fastNLP
Apache License 2.0
3.05k stars 451 forks source link

[bugfix]修复Trainer里check_code函数忽略pin_memory参数导致的内存不足bug #398

Closed ouyhlan closed 2 years ago

ouyhlan commented 2 years ago

Description:修复Trainer里check_code函数忽略pin_memory参数导致的内存不足bug

Main reason: 在使用fastNLP库时发生内存不足错误。使用场景是在使用CPU训练模型时,发生了内存错误。经过DEBUG发现,是core/Trainer.py文件里,_check_code函数在调用Tester类时没有指定pin_memory参数,那么Tester类默认初始化pin_memory为True。

Checklist 检查下面各项是否完成

Please feel free to remove inapplicable items for your PR.

Changes: 逐项描述修改的内容

Mention: 找人review你的PR

@修改过这个文件的人 @核心开发人员