Skip to content
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

Open
wu-yz opened this issue Jun 20, 2023 · 3 comments
Open

AssertionError: idx 0 != idx_new 2998 during testing. #96

wu-yz opened this issue Jun 20, 2023 · 3 comments

Comments

@wu-yz
Copy link

wu-yz commented Jun 20, 2023

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!

@wu-yz
Copy link
Author

wu-yz commented Sep 7, 2023

No,I haven't resolved it.

@anthonyAndchen
Copy link

anthonyAndchen commented Sep 9, 2023 via email

@wu-yz
Copy link
Author

wu-yz commented Sep 10, 2023

你好,我经过一些尝试后,发现把出现断言错误的这一行代码注释掉后,在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 unsubscribehttps://github.com/notifications/unsubscribe-auth/AOWBX26XAB4BMVCVY63VBF3XZG745ANCNFSM6AAAAAAZMZHR7A. You are receiving this because you commented.Message ID: @.***>

太感谢了!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants