From 2cdb2d654f2109ef4e648bae6f169143e267e5db Mon Sep 17 00:00:00 2001
From: zhuzizyf <42790740+zhuzizyf@users.noreply.github.com>
Date: 星期六, 11 三月 2023 14:33:14 +0800
Subject: [PATCH] Update dataset.py

---
 funasr/bin/tp_inference.py |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/funasr/bin/tp_inference.py b/funasr/bin/tp_inference.py
index 3bd3324..e7a1f1b 100644
--- a/funasr/bin/tp_inference.py
+++ b/funasr/bin/tp_inference.py
@@ -110,7 +110,7 @@
             timestamp_infer_config, timestamp_model_file, device
         )
         if 'cuda' in device:
-            tp_model = tp_model.cuda()
+            tp_model = tp_model.cuda()  # force model to cuda
 
         frontend = None
         if tp_train_args.frontend is not None:
@@ -263,7 +263,7 @@
     preprocessor = LMPreprocessor(
         train=False,
         token_type=speechtext2timestamp.tp_train_args.token_type,
-        token_list=speechtext2timestamp.tp_train_args,
+        token_list=speechtext2timestamp.tp_train_args.token_list,
         bpemodel=None,
         text_cleaner=None,
         g2p_type=None,
@@ -293,14 +293,11 @@
             batch_size=batch_size,
             key_file=key_file,
             num_workers=num_workers,
-            preprocess_fn=LMPreprocessor,
+            preprocess_fn=preprocessor,
             collate_fn=ASRTask.build_collate_fn(speechtext2timestamp.tp_train_args, False),
             allow_variable_data_keys=allow_variable_data_keys,
             inference=True,
         )
-
-        finish_count = 0
-        file_count = 1
 
         tp_result_list = []
         for keys, batch in loader:
@@ -321,7 +318,6 @@
                 ts_str, ts_list = time_stamp_lfr6_advance(us_alphas[batch_id], us_cif_peak[batch_id], token)
                 logging.warning(ts_str)
                 item = {'key': key, 'value': ts_str, 'timestamp':ts_list}
-                # tp_result_list.append({'text':"".join([i for i in token if i != '<sil>']), 'timestamp': ts_list})
                 tp_result_list.append(item)
         return tp_result_list
 
@@ -407,6 +403,18 @@
         default=1,
         help="The batch size for inference",
     )
+    group.add_argument(
+        "--seg_dict_file",
+        type=str,
+        default=None,
+        help="The batch size for inference",
+    )
+    group.add_argument(
+        "--split_with_space",
+        type=bool,
+        default=False,
+        help="The batch size for inference",
+    )
 
     return parser
 

--
Gitblit v1.9.1