FunASR
FunASR copied to clipboard
AssertionError: EParaformer is not registered
训练e-paraformer的时候报错“AssertionError: EParaformer is not registered”,进一步寻找发现e_paraformer的model.py “from funasr.models.transformer.utils.add_sos_eos import add_sos_eos, add_sos_and_eos” 导入错误,是由于funasr.models.transformer.utils.add_sos_eos 下面没有add_sos_and_eos这个函数。
可以参考添加add_sos_and_eos函数:
def add_sos_and_eos(ys_pad, sos, eos, ignore_id):
_sos = ys_pad.new([sos])
_eos = ys_pad.new([eos])
sequences = [y[y != ignore_id] for y in ys_pad]
ys_in = [torch.cat([_sos, seq, _eos], dim=0) for seq in sequences]
ys_out = [torch.cat([_sos, seq, _eos], dim=0) for seq in sequences]
return pad_list(ys_in, eos), pad_list(ys_out, ignore_id)
多谢,不知道在librispeech复现的时候,英文有没有更好的提升