From b3055656d107ba894d59e40609c88feeae064989 Mon Sep 17 00:00:00 2001 From: songsenand Date: Sun, 5 Apr 2026 00:32:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(trainer):=20=E6=A3=80=E6=B5=8BGPU=E5=8F=AF?= =?UTF-8?q?=E7=94=A8=E6=80=A7=E5=B9=B6=E6=8F=90=E7=A4=BA=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=80=80=E5=9B=9ECPU=E8=AE=AD=E7=BB=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/trainer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/model/trainer.py b/src/model/trainer.py index ae30f11..63baa58 100644 --- a/src/model/trainer.py +++ b/src/model/trainer.py @@ -812,7 +812,8 @@ def train( prefetch_factor=64, # 每个worker预取64个batch persistent_workers=True, # 保持worker进程存活 ) - + if torch.cuda.is_available(): + console.print("[red]GPU不可用,退回使用CPU[/red]") console.print("[green]✓ 数据加载器创建完成[/green]") console.print(f" 训练批次大小: {batch_size}") console.print(f" 评估批次大小: {batch_size}")