mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
funasr1.0
This commit is contained in:
parent
5a8f379084
commit
b48251922f
@ -81,11 +81,13 @@ funasr --model paraformer-zh asr_example_zh.wav
|
|||||||
|
|
||||||
### 非实时语音识别
|
### 非实时语音识别
|
||||||
```python
|
```python
|
||||||
from funasr import infer
|
from funasr import AutoModel
|
||||||
|
|
||||||
p = infer(model="paraformer-zh", vad_model="fsmn-vad", punc_model="ct-punc", model_hub="ms")
|
model = AutoModel(model="paraformer-zh")
|
||||||
|
# for the long duration wav, you could add vad model
|
||||||
|
# model = AutoModel(model="paraformer-zh", vad_model="fsmn-vad")
|
||||||
|
|
||||||
res = p("asr_example_zh.wav", batch_size_token=5000)
|
res = model(input="asr_example_zh.wav", batch_size=5000)
|
||||||
print(res)
|
print(res)
|
||||||
```
|
```
|
||||||
注:`model_hub`:表示模型仓库,`ms`为选择modelscope下载,`hf`为选择huggingface下载。
|
注:`model_hub`:表示模型仓库,`ms`为选择modelscope下载,`hf`为选择huggingface下载。
|
||||||
|
|||||||
@ -29,3 +29,5 @@ def import_submodules(package, recursive=True):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
import_submodules(__name__)
|
import_submodules(__name__)
|
||||||
|
|
||||||
|
from funasr.bin.inference import AutoModel
|
||||||
@ -12,6 +12,8 @@ def download_model(**kwargs):
|
|||||||
|
|
||||||
def download_fr_ms(**kwargs):
|
def download_fr_ms(**kwargs):
|
||||||
model_or_path = kwargs.get("model")
|
model_or_path = kwargs.get("model")
|
||||||
|
if model_or_path in name_maps_ms:
|
||||||
|
model_or_path = name_maps_ms[model_or_path]
|
||||||
model_revision = kwargs.get("model_revision")
|
model_revision = kwargs.get("model_revision")
|
||||||
if not os.path.exists(model_or_path):
|
if not os.path.exists(model_or_path):
|
||||||
model_or_path = get_or_download_model_dir(model_or_path, model_revision, is_training=kwargs.get("is_training"))
|
model_or_path = get_or_download_model_dir(model_or_path, model_revision, is_training=kwargs.get("is_training"))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user