From a0ffe57b05679d91e56227ce1109a5d725d93192 Mon Sep 17 00:00:00 2001
From: 语帆 <yf352572@alibaba-inc.com>
Date: 星期三, 21 二月 2024 16:48:33 +0800
Subject: [PATCH] test

---
 funasr/auto/auto_model.py |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.py
index 1345157..4cc52a5 100644
--- a/funasr/auto/auto_model.py
+++ b/funasr/auto/auto_model.py
@@ -20,8 +20,11 @@
 from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank
 from funasr.utils.timestamp_tools import timestamp_sentence
 from funasr.models.campplus.utils import sv_chunk, postprocess, distribute_spk
-from funasr.models.campplus.cluster_backend import ClusterBackend
-
+try:
+    from funasr.models.campplus.cluster_backend import ClusterBackend
+except:
+    print("If you want to use the speaker diarization, please `pip install hdbscan`")
+import pdb
 
 def prepare_data_iterator(data_in, input_len=None, data_type=None, key=None):
     """
@@ -207,13 +210,15 @@
         kwargs.update(cfg)
         model = self.model if model is None else model
         model.eval()
+        pdb.set_trace()
 
         batch_size = kwargs.get("batch_size", 1)
         # if kwargs.get("device", "cpu") == "cpu":
         #     batch_size = 1
         
         key_list, data_list = prepare_data_iterator(input, input_len=input_len, data_type=kwargs.get("data_type", None), key=key)
-        
+        pdb.set_trace()
+
         speed_stats = {}
         asr_result_list = []
         num_samples = len(data_list)
@@ -221,20 +226,25 @@
         pbar = tqdm(colour="blue", total=num_samples, dynamic_ncols=True) if not disable_pbar else None
         time_speech_total = 0.0
         time_escape_total = 0.0
+        pdb.set_trace()
         for beg_idx in range(0, num_samples, batch_size):
+            pdb.set_trace()
             end_idx = min(num_samples, beg_idx + batch_size)
             data_batch = data_list[beg_idx:end_idx]
             key_batch = key_list[beg_idx:end_idx]
             batch = {"data_in": data_batch, "key": key_batch}
+            pdb.set_trace()
             if (end_idx - beg_idx) == 1 and kwargs.get("data_type", None) == "fbank": # fbank
                 batch["data_in"] = data_batch[0]
                 batch["data_lengths"] = input_len
         
             time1 = time.perf_counter()
             with torch.no_grad():
+                pdb.set_trace()
                 results, meta_data = model.inference(**batch, **kwargs)
             time2 = time.perf_counter()
             
+            pdb.set_trace()
             asr_result_list.extend(results)
 
             # batch_data_time = time_per_frame_s * data_batch_i["speech_lengths"].sum().item()

--
Gitblit v1.9.1