A Fundamental End-to-End Speech Recognition Toolkit and Open Source SOTA Pretrained Models, Supporting Speech Recognition, Voice Activity Detection, Text Post-processing etc.
import time
import json
# paraformer-zh is a multi-functional asr model
# use vad, punc, spk or not as you need
model = AutoModel(
model="/root/autodl-tmp/seaco/iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch",
model_revision="v2.0.4",
vad_model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch", vad_model_revision="v2.0.4",
punc_model="iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch", punc_model_revision="v2.0.4",
spk_model="iic/speech_campplus_sv_zh-cn_16k-common", spk_model_revision="v2.0.2",
device="cuda:0"
)
begin = time.time()
res = model.generate(input=f"/root/funasr/b9d73dd3-d164-4508-8c51-4c6fc7058440_18889781464_1480.wav",
batch_size_s=300,
hotword='')
end = time.time()
print(res)
print(end - begin)
res_array = res
res_sentence_info = []
sentence_info_array = res_array[0]["sentence_info"]
for i in range(len(sentence_info_array)):
tmp = {"spk": sentence_info_array[i]["spk"], "text": sentence_info_array[i]["text"]}
res_sentence_info.append(tmp)
print(res_sentence_info)
使用了GPU运行,但是CPU使用率依旧很高?根据性能报告,GPU确实生效。请问这个现象的原因是为什么? 我的代码如下:
下图是我在使用该代码跑多个任务的利用率报告截图:![image](https://github.com/alibaba-damo-academy/FunASR/assets/68487349/0c3ae151-c01d-4dba-b91b-8590d600fcb2)