From 8a8d60d5786510ec7b1dd4f622e848de8a15f8a8 Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期一, 15 一月 2024 16:36:51 +0800
Subject: [PATCH] replace NULL for onnxruntime/src

---
 funasr/utils/prepare_data.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/funasr/utils/prepare_data.py b/funasr/utils/prepare_data.py
index c9615e7..36eebdc 100644
--- a/funasr/utils/prepare_data.py
+++ b/funasr/utils/prepare_data.py
@@ -5,9 +5,9 @@
 
 import kaldiio
 import numpy as np
+import librosa
 import torch.distributed as dist
 import torchaudio
-import soundfile
 
 
 def filter_wav_text(data_dir, dataset):
@@ -46,7 +46,7 @@
     try:
         waveform, sampling_rate = torchaudio.load(wav_path)
     except:
-        waveform, sampling_rate = soundfile.read(wav_path)
+        waveform, sampling_rate = librosa.load(wav_path)
         waveform = np.expand_dims(waveform, axis=0)
     n_frames = (waveform.shape[1] * 1000.0) / (sampling_rate * frontend_conf["frame_shift"] * frontend_conf["lfr_n"])
     feature_dim = frontend_conf["n_mels"] * frontend_conf["lfr_m"]
@@ -87,6 +87,7 @@
                 sample_name, feature_path = line.strip().split()
                 feature = kaldiio.load_mat(feature_path)
                 n_frames, feature_dim = feature.shape
+                write_flag = True
                 if n_frames > 0 and length_min > 0:
                     write_flag = n_frames >= length_min
                 if n_frames > 0 and length_max > 0:

--
Gitblit v1.9.1