mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
Merge branch 'dev_gzf_funasr2' of github.com:alibaba-damo-academy/FunASR into dev_gzf_funasr2
add
This commit is contained in:
commit
fddb28f026
@ -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)
|
||||||
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
# download model
|
# download model
|
||||||
local_path_root=./modelscope_models
|
local_path_root=../modelscope_models
|
||||||
mkdir -p ${local_path_root}
|
mkdir -p ${local_path_root}
|
||||||
local_path=${local_path_root}/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404
|
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}
|
git clone https://www.modelscope.cn/damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404.git ${local_path}
|
||||||
@ -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)
|
|
||||||
@ -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)
|
||||||
@ -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='达魔院 魔搭'"
|
||||||
|
|
||||||
@ -55,12 +55,12 @@ from funasr.models.paraformer.model import Paraformer
|
|||||||
|
|
||||||
from funasr.register import tables
|
from funasr.register import tables
|
||||||
|
|
||||||
@tables.register("model_classes", "NeatContextualParaformer")
|
@tables.register("model_classes", "ContextualParaformer")
|
||||||
class NeatContextualParaformer(Paraformer):
|
class ContextualParaformer(Paraformer):
|
||||||
"""
|
"""
|
||||||
Author: Speech Lab of DAMO Academy, Alibaba Group
|
Author: Speech Lab of DAMO Academy, Alibaba Group
|
||||||
Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition
|
FunASR: A Fundamental End-to-End Speech Recognition Toolkit
|
||||||
https://arxiv.org/abs/2206.08317
|
https://arxiv.org/abs/2305.11013
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -6,7 +6,7 @@
|
|||||||
# tables.print()
|
# tables.print()
|
||||||
|
|
||||||
# network architecture
|
# network architecture
|
||||||
model: NeatContextualParaformer
|
model: ContextualParaformer
|
||||||
model_conf:
|
model_conf:
|
||||||
ctc_weight: 0.0
|
ctc_weight: 0.0
|
||||||
lsm_weight: 0.1
|
lsm_weight: 0.1
|
||||||
Loading…
Reference in New Issue
Block a user