FunASR icon indicating copy to clipboard operation
FunASR copied to clipboard

for one same audio, if i run generate for the second time, the processing time is very long, the cpu consumption is much larger than before

Open animebing opened this issue 2 months ago • 2 comments

Notice: In order to resolve issues more efficiently, please raise issue following the template. (注意:为了更加高效率解决您遇到的问题,请按照模板提问,补充细节)

What is your question?

for one same audio(the audio file is long, such as 60 minutes), if i run generate for the second time, the processing time is very long, the cpu consumption is much larger than before. short audio files(such as one minute) will not have such problem

Code

import os
import time

from funasr import AutoModel


model_dir = 'path/to/model'
model = AutoModel(
    model=os.path.join(model_dir, 'speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch'),
    vad_model=os.path.join(model_dir, 'speech_fsmn_vad_zh-cn-16k-common-pytorch'),
    punc_model=os.path.join(model_dir, 'punc_ct-transformer_cn-en-common-vocab471067-large'),
    spk_model=os.path.join(model_dir, 'speech_campplus_sv_zh-cn_16k-common'),
    disable_pbar=True,
)

audio_path = 'path/to/audio'
for i in range(5):
    time_0 = time.time()
    res = model.generate(input=audio_path, batch_size_s=300)
    time_1 = time.time()
    print(f'process: {time_1 - time_0}')

What have you tried?

What's your environment?

  • OS (e.g., Linux): Ubuntu 20.04.1 LTS
  • FunASR Version (e.g., 1.0.0): 1.0.24
  • ModelScope Version (e.g., 1.11.0): 1.13.3
  • PyTorch Version (e.g., 2.0.0): 2.2.2
  • How you installed funasr (pip, source): pip
  • Python version: 3.10.13
  • GPU (e.g., V100M32): A100 or 4090
  • CUDA/cuDNN version (e.g., cuda11.7): 12.1(from torch)
  • Docker version (e.g., funasr-runtime-sdk-cpu-0.4.1): use automodel instead of docker
  • Any other relevant information: short audio files(such as one minute) will not have such problem

animebing avatar Apr 26 '24 03:04 animebing