-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: The size of tensor a (3) must match the size of tensor b (4) at non-singleton dimension 1 #1837
Comments
Could you show me your cif_v1 code? Or git log to show your commit id? |
I just pulled the latest branch (several minutes ago), and now it can work, tks! |
Could you try modify the cif via https://github.com/modelscope/FunASR/pull/1811/files . Because I found my bugfix commit has been discarded in 45d7aa9 |
@LauraGPT Hello. Could it be possible that my bugfix commit was accidentally removed, leading to this issue? Because I cannot see my bug fix in the main code. It will lead to both training and onnx inference bug. |
Sorry, it is my mistake. I have fixed it: 93f9a42 |
@dtlzhuangz 请问可以看看这个问题么?最近反馈这个报错的有点多哈 |
Hello, 现在main分支训练代码调用的还是原始版本的cif,而不是cif_v1。 @FastSchnell ,可以把更具体的报错信息,启动命令还有cif_predictor.py的文件给我吗?如果可以的话把报错的那条数据发一下。 |
建议在 https://github.com/modelscope/FunASR/blob/main/funasr/models/paraformer/cif_predictor.py#L248 前打上断点,保存hidden和alphas |
抱歉,不知道是怎么被我覆盖的,请问,方便再pr一下么 |
请你问你是哪个分支,我可以用你的版本试试,或者你的repo,发我一下 |
我现在的repo试一下,哥们你clone完代码后有没有pip install -e . ? |
好的我提一下,但是讲道理原本的cif应该不会有这个报错的 |
@dtlzhuangz #!/usr/bin/env python3 -- encoding: utf-8 --Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved.MIT License (https://opensource.org/licenses/MIT)import torch from funasr.register import tables @tables.register("predictor_classes", "CifPredictor")
@tables.register("predictor_classes", "CifPredictorV2")
@tables.register("predictor_classes", "CifPredictorV2Export")
@torch.jit.script
@torch.jit.script
class mae_loss(torch.nn.Module):
def cif(hidden, alphas, threshold):
def cif_wo_hidden_v1(alphas, threshold, return_fire_idxs=False):
def cif_v1(hidden, alphas, threshold):
def cif_wo_hidden(alphas, threshold):
|
@FastSchnell 我的repo用了如果没问题说一下哈,没问题我再提pr改一下 |
https://drive.google.com/file/d/1ssUYvoCvwQZhLUhhuOBzabVeirjE2Ze3/view?usp=sharing
|
你代码调用的不是clone下来的代码吧,clone下来后有没有pip install -e .呢 |
下载main分支的zip包到服务器跑的,pip install -e .打成pip包也试过 一样报错,我怀疑是我数据集问题,因为用这个项目的测试数据不报错 |
你把微信发我邮箱吧,我加你 |
@LauraGPT 这个问题解决了,最新的代码没安装上 |
Notice: In order to resolve issues more efficiently, please raise issue following the template.
(注意:为了更加高效率解决您遇到的问题,请按照模板提问,补充细节)
🐛 Bug
To Reproduce
Steps to reproduce the behavior (always include the command you ran):
File "/mnt/home/home/wxh/czl/fun-asr/funasr/models/paraformer/model.py", line 208, in forward
loss_att, acc_att, cer_att, wer_att, loss_pre, pre_loss_att = self._calc_att_loss(
File "/mnt/home/home/wxh/czl/fun-asr/funasr/models/paraformer/model.py", line 309, in _calc_att_loss
sematic_embeds, decoder_out_1st = self.sampler(
File "/mnt/home/home/wxh/czl/fun-asr/funasr/models/paraformer/model.py", line 350, in sampler
decoder_outs = self.decoder(
File "/home/wxh/anaconda3/envs/funasr/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/mnt/home/home/wxh/czl/fun-asr/funasr/models/paraformer/decoder.py", line 397, in forward
x, tgt_mask, memory, memory_mask, _ = self.decoders(x, tgt_mask, memory, memory_mask)
File "/home/wxh/anaconda3/envs/funasr/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/mnt/home/home/wxh/czl/fun-asr/funasr/models/transformer/utils/repeat.py", line 32, in forward
args = m(*args)
File "/home/wxh/anaconda3/envs/funasr/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/mnt/home/home/wxh/czl/fun-asr/funasr/models/paraformer/decoder.py", line 106, in forward
x, _ = self.self_attn(tgt, tgt_mask)
File "/home/wxh/anaconda3/envs/funasr/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/mnt/home/home/wxh/czl/fun-asr/funasr/models/sanm/attention.py", line 518, in forward
inputs = inputs * mask
RuntimeError: The size of tensor a (3) must match the size of tensor b (4) at non-singleton dimension 1
Code sample
Expected behavior
Environment
Additional context
The text was updated successfully, but these errors were encountered: