modelscope / FunASR

A Fundamental End-to-End Speech Recognition Toolkit and Open Source SOTA Pretrained Models, Supporting Speech Recognition, Voice Activity Detection, Text Post-processing etc.
https://www.funasr.com
Other
5.88k stars 636 forks source link

使用了GPU运行,但是CPU使用率依旧很高?根据性能报告,GPU确实生效。 #1723

Open 12915494174 opened 4 months ago

12915494174 commented 4 months ago

使用了GPU运行,但是CPU使用率依旧很高?根据性能报告,GPU确实生效。请问这个现象的原因是为什么? 我的代码如下:

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)

下图是我在使用该代码跑多个任务的利用率报告截图: image

panw3i commented 3 months ago

用的windows?

12915494174 commented 3 months ago

用的windows?

使用的linux,ubuntu 22.04系统。