mirror of
https://github.com/FunAudioLLM/SenseVoice.git
synced 2025-09-15 15:08:35 +08:00
docs
This commit is contained in:
parent
dfe6e6a7bd
commit
751333fb28
@ -170,12 +170,13 @@ from funasr.utils.postprocess_utils import rich_transcription_postprocess
|
|||||||
|
|
||||||
model_dir = "iic/SenseVoiceSmall"
|
model_dir = "iic/SenseVoiceSmall"
|
||||||
m, kwargs = SenseVoiceSmall.from_pretrained(model=model_dir, device="cuda:0")
|
m, kwargs = SenseVoiceSmall.from_pretrained(model=model_dir, device="cuda:0")
|
||||||
|
m.eval()
|
||||||
|
|
||||||
res = m.inference(
|
res = m.inference(
|
||||||
data_in=f"{kwargs['model_path']}/example/en.mp3",
|
data_in=f"{kwargs['model_path']}/example/en.mp3",
|
||||||
language="auto", # "zh", "en", "yue", "ja", "ko", "nospeech"
|
language="auto", # "zh", "en", "yue", "ja", "ko", "nospeech"
|
||||||
use_itn=False,
|
use_itn=False,
|
||||||
|
ban_emo_unk=False,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -171,12 +171,13 @@ from funasr.utils.postprocess_utils import rich_transcription_postprocess
|
|||||||
|
|
||||||
model_dir = "iic/SenseVoiceSmall"
|
model_dir = "iic/SenseVoiceSmall"
|
||||||
m, kwargs = SenseVoiceSmall.from_pretrained(model=model_dir, device="cuda:0")
|
m, kwargs = SenseVoiceSmall.from_pretrained(model=model_dir, device="cuda:0")
|
||||||
|
m.eval()
|
||||||
|
|
||||||
res = m.inference(
|
res = m.inference(
|
||||||
data_in=f"{kwargs['model_path']}/example/en.mp3",
|
data_in=f"{kwargs['model_path']}/example/en.mp3",
|
||||||
language="auto", # "zh", "en", "yue", "ja", "ko", "nospeech"
|
language="auto", # "zh", "en", "yue", "ja", "ko", "nospeech"
|
||||||
use_itn=False,
|
use_itn=False,
|
||||||
|
ban_emo_unk=False,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -145,7 +145,7 @@ print(text)
|
|||||||
- `use_itn`:输出结果中是否包含标点与逆文本正则化。
|
- `use_itn`:输出结果中是否包含标点与逆文本正则化。
|
||||||
- `batch_size_s` 表示采用动态batch,batch中总音频时长,单位为秒s。
|
- `batch_size_s` 表示采用动态batch,batch中总音频时长,单位为秒s。
|
||||||
- `merge_vad`:是否将 vad 模型切割的短音频碎片合成,合并后长度为`merge_length_s`,单位为秒s。
|
- `merge_vad`:是否将 vad 模型切割的短音频碎片合成,合并后长度为`merge_length_s`,单位为秒s。
|
||||||
- `ban_emo_unk`:禁用emo_unk标签,禁用后所有的句子都会被赋与情感标签。
|
- `ban_emo_unk`:禁用emo_unk标签,禁用后所有的句子都会被赋与情感标签。默认`False`
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
如果输入均为短音频(小于30s),并且需要批量化推理,为了加快推理效率,可以移除vad模型,并设置`batch_size`
|
如果输入均为短音频(小于30s),并且需要批量化推理,为了加快推理效率,可以移除vad模型,并设置`batch_size`
|
||||||
@ -174,12 +174,13 @@ from funasr.utils.postprocess_utils import rich_transcription_postprocess
|
|||||||
|
|
||||||
model_dir = "iic/SenseVoiceSmall"
|
model_dir = "iic/SenseVoiceSmall"
|
||||||
m, kwargs = SenseVoiceSmall.from_pretrained(model=model_dir, device="cuda:0")
|
m, kwargs = SenseVoiceSmall.from_pretrained(model=model_dir, device="cuda:0")
|
||||||
|
m.eval()
|
||||||
|
|
||||||
res = m.inference(
|
res = m.inference(
|
||||||
data_in=f"{kwargs['model_path']}/example/en.mp3",
|
data_in=f"{kwargs['model_path']}/example/en.mp3",
|
||||||
language="auto", # "zh", "en", "yue", "ja", "ko", "nospeech"
|
language="auto", # "zh", "en", "yue", "ja", "ko", "nospeech"
|
||||||
use_itn=False,
|
use_itn=False,
|
||||||
|
ban_emo_unk=False,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
3
demo2.py
3
demo2.py
@ -9,12 +9,13 @@ from funasr.utils.postprocess_utils import rich_transcription_postprocess
|
|||||||
|
|
||||||
model_dir = "iic/SenseVoiceSmall"
|
model_dir = "iic/SenseVoiceSmall"
|
||||||
m, kwargs = SenseVoiceSmall.from_pretrained(model=model_dir, device="cuda:0")
|
m, kwargs = SenseVoiceSmall.from_pretrained(model=model_dir, device="cuda:0")
|
||||||
|
m.eval()
|
||||||
|
|
||||||
res = m.inference(
|
res = m.inference(
|
||||||
data_in=f"{kwargs['model_path']}/example/en.mp3",
|
data_in=f"{kwargs['model_path']}/example/en.mp3",
|
||||||
language="auto", # "zh", "en", "yue", "ja", "ko", "nospeech"
|
language="auto", # "zh", "en", "yue", "ja", "ko", "nospeech"
|
||||||
use_itn=False,
|
use_itn=False,
|
||||||
|
ban_emo_unk=False,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user