FunASR icon indicating copy to clipboard operation
FunASR copied to clipboard

发现了在LLM-ASR推理中存在的一些小问题

Open NiniAndy opened this issue 8 months ago • 1 comments

❓ Questions and Help

What is your question?

在LLM-ASR任务中,我用默认whisper_qwen_linear.yaml训练aishell,训练了10个epoch,用best_model.pt进行inference。 第一次:默认whisper_qwen_linear.yaml中有SpecAugLFR,因此在inference的时候经常出现无厘头的重复,频率很高。 e.g. BAC009S0768W0178 撇油加加撇油加加撇油加加撇油加加撇油加加撇油。。。

第二次:删掉默认whisper_qwen_linear.yaml中所有的dropout和SpecAugLFR,重新训练以后,在inference无厘头的重复出现的概率降低了,但依然偶尔会有。问题转移成在inference是会在解码结果前面多出现一两个字。我已经检查了mask似乎没有什么问题,在推理时我也尝试禁止了prompt,结果似乎也没有变化。 e.g. BAC009S0766W0399 幢经过近两个星期的漫长等待 (经过近两个星期的漫长等待)

一些配置和sh文件我通过附件的形式发你: conf:https://github.com/NiniAndy/FunASR/blob/mymerge/examples/industrial_data_pretraining/llm_asr/conf/whisper_qwen_linear.yaml train.sh: https://github.com/NiniAndy/FunASR/blob/mymerge/examples/industrial_data_pretraining/llm_asr/demo_train_or_finetune.sh inference.sh: https://github.com/NiniAndy/FunASR/blob/mymerge/examples/industrial_data_pretraining/llm_asr/infer_speech2text.sh

What's your environment?

  • Linux:
  • FunASR Version : 1.1.12
  • PyTorch Version : 2.4.1
  • CUDA/cuDNN version : cu12.4

NiniAndy avatar Mar 05 '25 02:03 NiniAndy

问题找到了: 在用whisper_qwen_linear.yaml训练时prompt是"Transcribe speech to text."详见: funasr/datasets/llm_datasets_qwenaudio/datasets.py 46-47 在inference时prompt默认是: prompt_pre = "USER: \nINSTRUCTION: {}\nINPUT: ".format(prompt)

还有一个bug: 在funasr/models/llm_asr/model.py 301-303应该是写错了,应该改成: inputs_embeds = torch.cat((encoder_out, inputs_embeds[None, :, :]), dim=1) # [audio, prompt]

NiniAndy avatar Mar 06 '25 02:03 NiniAndy