|
@@ -91,9 +91,9 @@ Notes: Support recognition of single audio file, as well as file list in Kaldi-s
|
|
|
from funasr import AutoModel
|
|
from funasr import AutoModel
|
|
|
# paraformer-zh is a multi-functional asr model
|
|
# paraformer-zh is a multi-functional asr model
|
|
|
# use vad, punc, spk or not as you need
|
|
# use vad, punc, spk or not as you need
|
|
|
-model = AutoModel(model="paraformer-zh", model_revision="v2.0.2",
|
|
|
|
|
- vad_model="fsmn-vad", vad_model_revision="v2.0.2",
|
|
|
|
|
- punc_model="ct-punc-c", punc_model_revision="v2.0.3",
|
|
|
|
|
|
|
+model = AutoModel(model="paraformer-zh", model_revision="v2.0.4",
|
|
|
|
|
+ vad_model="fsmn-vad", vad_model_revision="v2.0.4",
|
|
|
|
|
+ punc_model="ct-punc-c", punc_model_revision="v2.0.4",
|
|
|
# spk_model="cam++", spk_model_revision="v2.0.2",
|
|
# spk_model="cam++", spk_model_revision="v2.0.2",
|
|
|
)
|
|
)
|
|
|
res = model.generate(input=f"{model.model_path}/example/asr_example.wav",
|
|
res = model.generate(input=f"{model.model_path}/example/asr_example.wav",
|
|
@@ -111,7 +111,7 @@ chunk_size = [0, 10, 5] #[0, 10, 5] 600ms, [0, 8, 4] 480ms
|
|
|
encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention
|
|
encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention
|
|
|
decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention
|
|
decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention
|
|
|
|
|
|
|
|
-model = AutoModel(model="paraformer-zh-streaming", model_revision="v2.0.2")
|
|
|
|
|
|
|
+model = AutoModel(model="paraformer-zh-streaming", model_revision="v2.0.4")
|
|
|
|
|
|
|
|
import soundfile
|
|
import soundfile
|
|
|
import os
|
|
import os
|
|
@@ -134,7 +134,7 @@ Note: `chunk_size` is the configuration for streaming latency.` [0,10,5]` indica
|
|
|
```python
|
|
```python
|
|
|
from funasr import AutoModel
|
|
from funasr import AutoModel
|
|
|
|
|
|
|
|
-model = AutoModel(model="fsmn-vad", model_revision="v2.0.2")
|
|
|
|
|
|
|
+model = AutoModel(model="fsmn-vad", model_revision="v2.0.4")
|
|
|
wav_file = f"{model.model_path}/example/asr_example.wav"
|
|
wav_file = f"{model.model_path}/example/asr_example.wav"
|
|
|
res = model.generate(input=wav_file)
|
|
res = model.generate(input=wav_file)
|
|
|
print(res)
|
|
print(res)
|
|
@@ -144,7 +144,7 @@ print(res)
|
|
|
from funasr import AutoModel
|
|
from funasr import AutoModel
|
|
|
|
|
|
|
|
chunk_size = 200 # ms
|
|
chunk_size = 200 # ms
|
|
|
-model = AutoModel(model="fsmn-vad", model_revision="v2.0.2")
|
|
|
|
|
|
|
+model = AutoModel(model="fsmn-vad", model_revision="v2.0.4")
|
|
|
|
|
|
|
|
import soundfile
|
|
import soundfile
|
|
|
|
|
|
|
@@ -165,7 +165,7 @@ for i in range(total_chunk_num):
|
|
|
```python
|
|
```python
|
|
|
from funasr import AutoModel
|
|
from funasr import AutoModel
|
|
|
|
|
|
|
|
-model = AutoModel(model="ct-punc", model_revision="v2.0.2")
|
|
|
|
|
|
|
+model = AutoModel(model="ct-punc", model_revision="v2.0.4")
|
|
|
res = model.generate(input="那今天的会就到这里吧 happy new year 明年见")
|
|
res = model.generate(input="那今天的会就到这里吧 happy new year 明年见")
|
|
|
print(res)
|
|
print(res)
|
|
|
```
|
|
```
|
|
@@ -173,7 +173,7 @@ print(res)
|
|
|
```python
|
|
```python
|
|
|
from funasr import AutoModel
|
|
from funasr import AutoModel
|
|
|
|
|
|
|
|
-model = AutoModel(model="fa-zh", model_revision="v2.0.2")
|
|
|
|
|
|
|
+model = AutoModel(model="fa-zh", model_revision="v2.0.4")
|
|
|
wav_file = f"{model.model_path}/example/asr_example.wav"
|
|
wav_file = f"{model.model_path}/example/asr_example.wav"
|
|
|
text_file = f"{model.model_path}/example/text.txt"
|
|
text_file = f"{model.model_path}/example/text.txt"
|
|
|
res = model.generate(input=(wav_file, text_file), data_type=("sound", "text"))
|
|
res = model.generate(input=(wav_file, text_file), data_type=("sound", "text"))
|