From c1e365fea09aafda387cac12fdff43d28c598979 Mon Sep 17 00:00:00 2001
From: BienBoy <92378515+BienBoy@users.noreply.github.com>
Date: 星期六, 01 二月 2025 23:29:34 +0800
Subject: [PATCH] fix: resolve unexpected 'out of memory' issue in multi-GPU setup (#2373)

---
 funasr/bin/train_ds.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/funasr/bin/train_ds.py b/funasr/bin/train_ds.py
index dc7fb42..24e81f6 100644
--- a/funasr/bin/train_ds.py
+++ b/funasr/bin/train_ds.py
@@ -184,7 +184,8 @@
             )
             trainer.start_step = 0
 
-            torch.cuda.empty_cache()
+            with torch.cuda.device(kwargs["device"]):
+                torch.cuda.empty_cache()
 
             time_escaped = (time.perf_counter() - time_slice_i) / 3600.0
             logging.info(

--
Gitblit v1.9.1