-
Notifications
You must be signed in to change notification settings - Fork 72
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
AssertionError: idx 0 != idx_new 2998 during testing. #96
Comments
No,I haven't resolved it. |
你好,我经过一些尝试后,发现把出现断言错误的这一行代码注释掉后,在modules.model.py中的_get_length函数修改一下就可以运行。
原来的函数:
def _get_length(self, logit, dim=-1):
""" Greed decoder to obtain length from logit"""
out = (logit.argmax(dim=-1) == self.charset.null_label)
out = self.first_nonzero(out.int()) + 1
return out
修改为:
def _get_length(self, logit, dim=-1):
""" Greed decoder to obtain length from logit"""
out = (logit.argmax(dim=-1) == self.charset.null_label)
abn = out.any(dim)
out = ((out.cumsum(dim) == 1) & out).max(dim)[1]
out = out + 1 # additional end token
out = torch.where(abn, out, out.new_tensor(logit.shape[1]))
return out
…________________________________
发件人: wu-yz ***@***.***>
发送时间: 2023年9月7日 20:55
收件人: FangShancheng/ABINet ***@***.***>
抄送: anthonyAndchen ***@***.***>; Comment ***@***.***>
主题: Re: [FangShancheng/ABINet] AssertionError: idx 0 != idx_new 2998 during testing. (Issue #96)
No,I haven't resolved it.
―
Reply to this email directly, view it on GitHub<#96 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOWBX26XAB4BMVCVY63VBF3XZG745ANCNFSM6AAAAAAZMZHR7A>.
You are receiving this because you commented.Message ID: ***@***.***>
|
太感谢了! |
When I run "CUDA_VISIBLE_DEVICES=0 python main.py --config=configs/train_abinet.yaml --phase test --image_only",I getting the error:"AssertionError: idx 0 != idx_new 2998 during testing."
Could you tell me how to solve this problem?Thank you very much!
The text was updated successfully, but these errors were encountered: