From 6db70df2a7eacd0df619b79ae31ee6f3f0becc90 Mon Sep 17 00:00:00 2001 From: YWMditto Date: Wed, 31 Aug 2022 20:37:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=20torch=5Fdriver.lo?= =?UTF-8?q?ad=5Fmodel=20=E5=9C=A8ddp=20=E6=97=B6=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E6=98=BE=E5=AD=98=E7=88=86=E7=82=B8=E7=9A=84todo=E4=BA=8B?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastNLP/core/drivers/torch_driver/torch_driver.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fastNLP/core/drivers/torch_driver/torch_driver.py b/fastNLP/core/drivers/torch_driver/torch_driver.py index db011403..6ca33476 100644 --- a/fastNLP/core/drivers/torch_driver/torch_driver.py +++ b/fastNLP/core/drivers/torch_driver/torch_driver.py @@ -190,6 +190,7 @@ class TorchDriver(Driver): :param load_state_dict: 保存的内容是否只是权重 """ model = self.unwrap_model() + # todo torch.load 在加载时会使得卡 0 多出一个(甚至多个)model 的显存;因此在多卡断点重训时可能会出现错误; res = torch.load(filepath, map_location='cpu') if isinstance(res, dict) and only_state_dict is False: logger.rank_zero_warning(f"It seems like that {filepath} only contains state, you may need to use "