From 5052ca8bf03c178d9ae73cb68785cd4afb0144d2 Mon Sep 17 00:00:00 2001
From: 辰冢 <49506152+BruceLee569@users.noreply.github.com>
Date: 星期三, 12 二月 2025 16:13:08 +0800
Subject: [PATCH] Hotwords file needs to specify default utf-8 encoding. (#2379)

---
 funasr/auto/auto_model.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.py
index 08308a2..60bfeff 100644
--- a/funasr/auto/auto_model.py
+++ b/funasr/auto/auto_model.py
@@ -366,7 +366,11 @@
         if pbar:
             # pbar.update(1)
             pbar.set_description(f"rtf_avg: {time_escape_total/time_speech_total:0.3f}")
-        torch.cuda.empty_cache()
+
+        device = next(model.parameters()).device
+        if device.type == 'cuda':
+            with torch.cuda.device():
+                torch.cuda.empty_cache()
         return asr_result_list
 
     def inference_with_vad(self, input, input_len=None, **cfg):

--
Gitblit v1.9.1