From f8bb340a70026f0307d4e18589aefa42483cf85f Mon Sep 17 00:00:00 2001 From: yukun-hh Date: Tue, 21 Apr 2026 15:57:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A8=A1=E5=9E=8B=E6=96=AD?= =?UTF-8?q?=E7=82=B9=E7=BB=A7=E7=BB=AD=E5=8A=A0=E8=BD=BD=E8=AE=AD=E7=BB=83?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Train.py b/Train.py index 49172dc..157af01 100644 --- a/Train.py +++ b/Train.py @@ -153,7 +153,7 @@ if __name__ == '__main__': model = Net(num_classes=4) # 根据你的 Net 类调整 #断点继续训练 if os.path.exists('best_model.pth'): - model.load_state_dict(torch.load('best_model.pth')) + model.load_state_dict(torch.load('best_model.pth',map_location=torch.device('cpu'))) model = model.to(device) # 打印模型信息