mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
np fix bug
This commit is contained in:
parent
9321718b3a
commit
7a207808bc
@ -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: [funasr@list.alibaba-inc.com](funasr@list.alibaba-inc.com)
|
||||
- 邮件: [funasr@list.alibaba-inc.com](funasr@list.alibaba-inc.com)
|
||||
|
||||
| 钉钉群 | 微信 |
|
||||
|:---------------------------------------------------------------------:|:-----------------------------------------------------:|
|
||||
|
||||
@ -639,7 +639,8 @@ def inference_paraformer_vad_punc(
|
||||
batch_size_token_ms = batch_size_token*60
|
||||
if 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 = 0
|
||||
beg_idx = 0
|
||||
|
||||
@ -179,7 +179,7 @@ class Speech2DiarizationSOND:
|
||||
|
||||
@staticmethod
|
||||
def 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 first
|
||||
return (np.array(list(b)[::-1]) == '1').astype(dtype)
|
||||
|
||||
@ -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 used
|
||||
subsample = np.pad(
|
||||
np.array(subsample, dtype=np.int),
|
||||
np.array(subsample, dtype=np.int32),
|
||||
[1, num_layers - len(subsample)],
|
||||
mode="constant",
|
||||
constant_values=1,
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -13,7 +13,7 @@ from funasr.modules.rnn.encoders import RNNP
|
||||
class 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":
|
||||
|
||||
@ -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"):
|
||||
|
||||
@ -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 first
|
||||
return (np.array(list(b)[::-1]) == '1').astype(dtype)
|
||||
|
||||
@ -1 +1 @@
|
||||
0.6.8
|
||||
0.6.9
|
||||
|
||||
Loading…
Reference in New Issue
Block a user