Merge branch 'dev_gzf_funasr2' of github.com:alibaba-damo-academy/FunASR into dev_gzf_funasr2

add
This commit is contained in:
游雁 2023-12-27 23:05:49 +08:00
commit fddb28f026
9 changed files with 45 additions and 18 deletions

View File

@ -0,0 +1,12 @@
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved.
# MIT License (https://opensource.org/licenses/MIT)
from funasr import AutoModel
model = AutoModel(model="../modelscope_models/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404")
res = model(input="../modelscope_models/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/example/asr_example.wav",
hotword='达魔院 魔搭')
print(res)

View File

@ -1,6 +1,6 @@
# download model
local_path_root=./modelscope_models
local_path_root=../modelscope_models
mkdir -p ${local_path_root}
local_path=${local_path_root}/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404
git clone https://www.modelscope.cn/damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404.git ${local_path}

View File

@ -1,12 +0,0 @@
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved.
# MIT License (https://opensource.org/licenses/MIT)
from funasr import AutoModel
model = AutoModel(model="/Users/zhifu/Downloads/modelscope_models/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404")
res = model(input="/Users/zhifu/Downloads/modelscope_models/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/example/asr_example.wav",
hotword='达魔院 魔搭')
print(res)

View File

@ -0,0 +1,12 @@
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved.
# MIT License (https://opensource.org/licenses/MIT)
from funasr import AutoModel
model = AutoModel(model="../modelscope_models/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404")
res = model(input="../modelscope_models/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/example/asr_example.wav",
hotword='达魔院 魔搭')
print(res)

View File

@ -0,0 +1,15 @@
# download model
local_path_root=../modelscope_models
mkdir -p ${local_path_root}
local_path=${local_path_root}/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404
git clone https://www.modelscope.cn/damo/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git ${local_path}
python funasr/bin/inference.py \
+model="${local_path}" \
+input="${local_path}/example/asr_example.wav" \
+output_dir="./outputs/debug" \
+device="cpu" \
+"hotword='达魔院 魔搭'"

View File

@ -55,12 +55,12 @@ from funasr.models.paraformer.model import Paraformer
from funasr.register import tables
@tables.register("model_classes", "NeatContextualParaformer")
class NeatContextualParaformer(Paraformer):
@tables.register("model_classes", "ContextualParaformer")
class ContextualParaformer(Paraformer):
"""
Author: Speech Lab of DAMO Academy, Alibaba Group
Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition
https://arxiv.org/abs/2206.08317
FunASR: A Fundamental End-to-End Speech Recognition Toolkit
https://arxiv.org/abs/2305.11013
"""
def __init__(

View File

@ -6,7 +6,7 @@
# tables.print()
# network architecture
model: NeatContextualParaformer
model: ContextualParaformer
model_conf:
ctc_weight: 0.0
lsm_weight: 0.1