Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.
Python asraudiochineseemotion-recognitionfunasrmcp-servermultilingual-asropenai-compatible-apiparaformerpunctuationpytorchreal-time-asrspeaker-diarizationspeech-recognitionspeech-to-textstreaming-asrtranscriptionvllmvoice-activity-detectionwhisper-alternative
np fix bug
游雁7a207808bc89
diff --git a/README_zh.md b/README_zh.mdindex e853f2d42..af7096c07 100644--- a/README_zh.md+++ b/README_zh.md@@ -92,7 +92,7 @@ pip3 install -U modelscope#### python版本示例-支持实时流式语音识别,并且会用非流式模型进行纠错,输出文本带有标点。目前只支持单个client,如需多并发请参考c++版本服务部署SDK([点击此处]())+支持实时流式语音识别,并且会用非流式模型进行纠错,输出文本带有标点。目前只支持单个client,如需多并发请参考下方c++版本服务部署SDK##### 服务端部署```shell@@ -107,6 +107,7 @@ python funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode 2pass --chunk```更多例子可以参考([点击此处](https://alibaba-damo-academy.github.io/FunASR/en/runtime/websocket_python.html#id2))+<a name="cpp版本示例"></a>#### c++版本示例目前已支持离线文件转写服务(CPU),支持上百路并发请求@@ -162,9 +163,9 @@ cd egs/aishell/paraformer<a name="联系我们"></a>## 联系我们-如果您在使用中遇到困难,可以通过一下方式联系我们+如果您在使用中遇到困难,可以通过以下方式联系我们-- email: [[email protected]]([email protected])+- 邮件: [[email protected]]([email protected])| 钉钉群 | 微信 ||:---------------------------------------------------------------------:|:-----------------------------------------------------:|diff --git a/funasr/bin/asr_inference_launch.py b/funasr/bin/asr_inference_launch.pyindex c32357e38..de1889453 100644--- a/funasr/bin/asr_inference_launch.py+++ b/funasr/bin/asr_inference_launch.py@@ -639,7 +639,8 @@ def inference_paraformer_vad_punc(batch_size_token_ms = batch_size_token*60if speech2text.device == "cpu":batch_size_token_ms = 0- batch_size_token_ms = max(batch_size_token_ms, sorted_data[0][0][1] - sorted_data[0][0][0])+ if len(sorted_data) > 0 and len(sorted_data[0]) > 0:+ batch_size_token_ms = max(batch_size_token_ms, sorted_data[0][0][1] - sorted_data[0][0][0])batch_size_token_ms_cum = 0beg_idx = 0diff --git a/funasr/bin/diar_infer.py b/funasr/bin/diar_infer.pyindex 3efa641bf..6fc1da162 100755--- a/funasr/bin/diar_infer.py+++ b/funasr/bin/diar_infer.py@@ -179,7 +179,7 @@ class Speech2DiarizationSOND:@staticmethoddef seq2arr(seq, vec_dim=8):- def int2vec(x, vec_dim=8, dtype=np.int):+ def int2vec(x, vec_dim=8, dtype=np.int32):b = ('{:0' + str(vec_dim) + 'b}').format(x)# little-endian order: lower bit firstreturn (np.array(list(b)[::-1]) == '1').astype(dtype)diff --git a/funasr/models/encoder/rnn_encoder.py b/funasr/models/encoder/rnn_encoder.pyindex 434af09fa..353beaf39 100644--- a/funasr/models/encoder/rnn_encoder.py+++ b/funasr/models/encoder/rnn_encoder.py@@ -46,12 +46,12 @@ class RNNEncoder(AbsEncoder):raise ValueError(f"Not supported rnn_type={rnn_type}")if subsample is None:- subsample = np.ones(num_layers + 1, dtype=np.int)+ subsample = np.ones(num_layers + 1, dtype=np.int32)else:subsample = subsample[:num_layers]# Append 1 at the beginning because the second or later is usedsubsample = np.pad(- np.array(subsample, dtype=np.int),+ np.array(subsample, dtype=np.int32),[1, num_layers - len(subsample)],mode="constant",constant_values=1,diff --git a/funasr/modules/data2vec/data_utils.py b/funasr/modules/data2vec/data_utils.pyindex efb72fa59..abd6d516d 100644--- a/funasr/modules/data2vec/data_utils.py+++ b/funasr/modules/data2vec/data_utils.py@@ -105,7 +105,7 @@ def compute_mask_indices(for length in sorted(lengths, reverse=True):lens = np.fromiter((e - s if e - s >= length + min_space else 0 for s, e in parts),- np.int,+ np.int32,)l_sum = np.sum(lens)if l_sum == 0:diff --git a/funasr/modules/frontends/mask_estimator.py b/funasr/modules/frontends/mask_estimator.pyindex cf4385769..53072bf4a 100644--- a/funasr/modules/frontends/mask_estimator.py+++ b/funasr/modules/frontends/mask_estimator.py@@ -13,7 +13,7 @@ from funasr.modules.rnn.encoders import RNNPclass MaskEstimator(torch.nn.Module):def __init__(self, type, idim, layers, units, projs, dropout, nmask=1):super().__init__()- subsample = np.ones(layers + 1, dtype=np.int)+ subsample = np.ones(layers + 1, dtype=np.int32)typ = type.lstrip("vgg").rstrip("p")if type[-1] == "p":diff --git a/funasr/modules/nets_utils.py b/funasr/modules/nets_utils.pyindex 397a5c428..55c576804 100644--- a/funasr/modules/nets_utils.py+++ b/funasr/modules/nets_utils.py@@ -407,7 +407,7 @@ def get_subsample(train_args, mode, arch):elif mode == "mt" and arch == "rnn":# +1 means input (+1) and layers outputs (train_args.elayer)- subsample = np.ones(train_args.elayers + 1, dtype=np.int)+ subsample = np.ones(train_args.elayers + 1, dtype=np.int32)logging.warning("Subsampling is not performed for machine translation.")logging.info("subsample: " + " ".join([str(x) for x in subsample]))return subsample@@ -417,7 +417,7 @@ def get_subsample(train_args, mode, arch):or (mode == "mt" and arch == "rnn")or (mode == "st" and arch == "rnn")):- subsample = np.ones(train_args.elayers + 1, dtype=np.int)+ subsample = np.ones(train_args.elayers + 1, dtype=np.int32)if train_args.etype.endswith("p") and not train_args.etype.startswith("vgg"):ss = train_args.subsample.split("_")for j in range(min(train_args.elayers + 1, len(ss))):@@ -432,7 +432,7 @@ def get_subsample(train_args, mode, arch):elif mode == "asr" and arch == "rnn_mix":subsample = np.ones(- train_args.elayers_sd + train_args.elayers + 1, dtype=np.int+ train_args.elayers_sd + train_args.elayers + 1, dtype=np.int32)if train_args.etype.endswith("p") and not train_args.etype.startswith("vgg"):ss = train_args.subsample.split("_")@@ -451,7 +451,7 @@ def get_subsample(train_args, mode, arch):elif mode == "asr" and arch == "rnn_mulenc":subsample_list = []for idx in range(train_args.num_encs):- subsample = np.ones(train_args.elayers[idx] + 1, dtype=np.int)+ subsample = np.ones(train_args.elayers[idx] + 1, dtype=np.int32)if train_args.etype[idx].endswith("p") and not train_args.etype[idx].startswith("vgg"):diff --git a/funasr/utils/misc.py b/funasr/utils/misc.pyindex f27a63c4e..e9050f519 100644--- a/funasr/utils/misc.py+++ b/funasr/utils/misc.py@@ -12,7 +12,7 @@ def statistic_model_parameters(model, prefix=None):return numel-def int2vec(x, vec_dim=8, dtype=np.int):+def int2vec(x, vec_dim=8, dtype=np.int32):b = ('{:0' + str(vec_dim) + 'b}').format(x)# little-endian order: lower bit firstreturn (np.array(list(b)[::-1]) == '1').astype(dtype)diff --git a/funasr/version.txt b/funasr/version.txtindex fae59cacd..1a5ac0d40 100644--- a/funasr/version.txt+++ b/funasr/version.txt@@ -1 +1 @@-0.6.8+0.6.9