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
4.46k stars 493 forks source link

使用GPU进行模型语音转义进程CoreDump #1831

Open majijia505 opened 1 week ago

majijia505 commented 1 week ago

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

❓ Questions and Help

Before asking:

  1. search the issues.
  2. search the docs.

What is your question?

在使用GPU进行模型推理时,进程会在ffmpeg转换完语音后coredump

Code

from funasr import AutoModel
model_path = "/app/base_models/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
vad_model_path = "/app/base_models/speech_fsmn_vad_zh-cn-16k-common-pytorch"
punc_model_path = "/app/base_models/punc_ct-transformer_cn-en-common-vocab471067-large"
spk_model_path = "/app/base_models/speech_campplus_sv_zh-cn_16k-common"

model = AutoModel(model=model_path, vad_model=vad_model_path, punc_model=punc_model_path, spk_model=spk_model_path
                  )

def excute(file_path):
    if not os.path.exists(file_path):
        return "File not found"
    start_time = time.time()
    print("开始转换:"+file_path)
    res = model.generate(input=file_path,
                         batch_size_s=300
                         )
    end_time = time.time()
    elapsed_time = end_time - start_time

    for item in res:
        for sentence in sorted(item['sentence_info'], key=lambda x: x['spk']):
            print(f"spk: {sentence['spk']}, text: {sentence['text']}")
            if 'spk' in sentence:
                # 给spk的值加1,然后设置spkname字段
                sentence['spkname'] = f"说话人{sentence['spk'] + 1}"
    print(res)
    print(f"语音转换耗时:{elapsed_time}")
    result = []
    for item in res:
        texts = []
        for sentence in item['sentence_info']:
            texts.append({
                'text': sentence['text'],
                'start': sentence['start'],
                'end': sentence['end'],
                'spk': sentence['spk'],
                'spkname': sentence['spkname']
            })
        result.append({
            'text': item['text'],
            'sentences': texts,
            'time': elapsed_time
        })
    return result

在excute方法后,coredump

image

What have you tried?

What's your environment?

LauraGPT commented 1 week ago

We do not know what's your problem.

majijia505 commented 1 week ago

We do not know what's your problem. When performing voice recognition, the process suddenly experienced a core dump, and the process terminated abruptly.