From 2acef4bdaea588adee3098a057a395937dff4e6a Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期一, 08 一月 2024 16:51:42 +0800
Subject: [PATCH] json stamp_sents for websocket-server
---
funasr/bin/diar_inference_launch.py | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/funasr/bin/diar_inference_launch.py b/funasr/bin/diar_inference_launch.py
index c065137..f5a11b1 100755
--- a/funasr/bin/diar_inference_launch.py
+++ b/funasr/bin/diar_inference_launch.py
@@ -15,7 +15,8 @@
from typing import Union
import numpy as np
-import soundfile
+# import librosa
+import librosa
import torch
from scipy.signal import medfilt
@@ -144,7 +145,9 @@
# read waveform file
example = [load_bytes(x) if isinstance(x, bytes) else x
for x in example]
- example = [soundfile.read(x)[0] if isinstance(x, str) else x
+ # example = [librosa.load(x)[0] if isinstance(x, str) else x
+ # for x in example]
+ example = [librosa.load(x, dtype='float32')[0] if isinstance(x, str) else x
for x in example]
# convert torch tensor to numpy array
example = [x.numpy() if isinstance(example[0], torch.Tensor) else x
@@ -453,11 +456,17 @@
help="The batch size for inference",
)
group.add_argument(
- "--diar_smooth_size",
+ "--smooth_size",
type=int,
default=121,
help="The smoothing size for post-processing"
)
+ group.add_argument(
+ "--dur_threshold",
+ type=int,
+ default=10,
+ help="The threshold of minimum duration"
+ )
return parser
--
Gitblit v1.9.1