You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
A clear and concise description of what the bug is.
Code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate the problem.
sen_tok=['哈哈' for i in range(513)]
ner = hanlp.load(hanlp.pretrained.ner.MSRA_NER_ELECTRA_SMALL_ZH)
ner_tok = ner(sen_tok, tasks='ner*')
Describe the current behavior
A clear and concise description of what happened.
当运行ner = hanlp.load(hanlp.pretrained.ner.MSRA_NER_ELECTRA_SMALL_ZH)
ner_tok = ner(sen_tok, tasks='ner*') # 得出NER结果时
如果token数量刚好是513,那么会出现下列错误:
File "C:\Users\xxxxxx\.conda\envs\NER\Lib\site-packages\hanlp\layers\transformers\relative_transformer.py", line 94, in forward
embed = self.weights.index_select(0, positions.long()).detach()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: index out of range in self
感觉可能是因为该代码扩展embedding的73行判断边界条件:
if max_pos > self.origin_shift:
没取等号导致的,取等号后可正常输出,其他数量也都ok Expected behavior
A clear and concise description of what you expected to happen.
正常输出
System information
OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
Python version:3.12
HanLP version:2.1.0
Other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
I've completed this form and searched the web for solutions.
The text was updated successfully, but these errors were encountered:
Describe the bug
A clear and concise description of what the bug is.
Code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate the problem.
sen_tok=['哈哈' for i in range(513)]
ner = hanlp.load(hanlp.pretrained.ner.MSRA_NER_ELECTRA_SMALL_ZH)
ner_tok = ner(sen_tok, tasks='ner*')
Describe the current behavior
A clear and concise description of what happened.
当运行ner = hanlp.load(hanlp.pretrained.ner.MSRA_NER_ELECTRA_SMALL_ZH)
ner_tok = ner(sen_tok, tasks='ner*') # 得出NER结果时
如果token数量刚好是513,那么会出现下列错误:
File "C:\Users\xxxxxx\.conda\envs\NER\Lib\site-packages\hanlp\layers\transformers\relative_transformer.py", line 94, in forward
embed = self.weights.index_select(0, positions.long()).detach()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: index out of range in self
感觉可能是因为该代码扩展embedding的73行判断边界条件:
if max_pos > self.origin_shift:
没取等号导致的,取等号后可正常输出,其他数量也都ok
Expected behavior
A clear and concise description of what you expected to happen.
正常输出
System information
Other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
The text was updated successfully, but these errors were encountered: