From 602fe75a1f0a8d64ccb6fc4d69ad510872fdfd13 Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期五, 17 三月 2023 20:30:40 +0800
Subject: [PATCH] rtf benchmark

---
 funasr/datasets/iterable_dataset.py |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/funasr/datasets/iterable_dataset.py b/funasr/datasets/iterable_dataset.py
index 4436618..c8c51d4 100644
--- a/funasr/datasets/iterable_dataset.py
+++ b/funasr/datasets/iterable_dataset.py
@@ -8,6 +8,7 @@
 from typing import Iterator
 from typing import Tuple
 from typing import Union
+from typing import List
 
 import kaldiio
 import numpy as np
@@ -129,7 +130,7 @@
         non_iterable_list = []
         self.path_name_type_list = []
 
-        if not isinstance(path_name_type_list[0], Tuple):
+        if not isinstance(path_name_type_list[0], (Tuple, List)):
             path = path_name_type_list[0]
             name = path_name_type_list[1]
             _type = path_name_type_list[2]
@@ -244,10 +245,14 @@
                         array = torchaudio.transforms.Resample(orig_freq=audio_fs,
                                                                new_freq=model_fs)(array)
                         array = array.numpy()
-                if self.mc:
-                    data[name] = array.transpose(0, 1)
+                        
+                if _type == "sound":
+                    if self.mc:
+                        data[name] = array.transpose((1, 0))
+                    else:
+                        data[name] = array[0]
                 else:
-                    data[name] = array[0]
+                    data[name] = array
 
                 if self.preprocess is not None:
                     data = self.preprocess(uid, data)
@@ -350,7 +355,7 @@
                             array = array.numpy()
                     if _type == "sound":
                         if self.mc:
-                            data[name] = array.transpose(0, 1)
+                            data[name] = array.transpose((1, 0))
                         else:
                             data[name] = array[0]
                     else:

--
Gitblit v1.9.1