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

IndexError: index out of range in self #7

Open
Siomarry opened this issue Nov 9, 2021 · 3 comments
Open

IndexError: index out of range in self #7

Siomarry opened this issue Nov 9, 2021 · 3 comments

Comments

@Siomarry
Copy link

Siomarry commented Nov 9, 2021

请问一下,在某些输入数据中,产生了这样的问题.
Traceback (most recent call last):
File "D:/Bert+Once/CLUENER2020/BERT-CRF/CheckBug.py", line 14, in
embed = embedding(input_to_embed)
File "D:\Bert+Once\venv\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Bert+Once\venv\lib\site-packages\torch\nn\modules\sparse.py", line 145, in forward
return F.embedding(
File "D:\Bert+Once\venv\lib\site-packages\torch\nn\functional.py", line 1913, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
IndexError: index out of range in self
是什么原因呢.

@Siomarry
Copy link
Author

Siomarry commented Nov 9, 2021

@hemingkx 有时间帮忙看看呀. 麻烦大佬了!!

@zjmwqx
Copy link

zjmwqx commented Mar 18, 2022

空格和tab token不会被识别。导致label和tokens的数量不一致。你看句子里是不是有。需要去掉。作者这里用了一种暴力的对齐方式。我再看有没有更好的办法

@hemingkx
Copy link
Owner

对的 可能是 @zjmwqx 提到的问题,这个repository只是一个简单实现的参考,可以根据自己需要修改代码

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

3 participants