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

NLPProcess running error #9

Open
JiamingOuyang opened this issue Mar 21, 2021 · 4 comments
Open

NLPProcess running error #9

JiamingOuyang opened this issue Mar 21, 2021 · 4 comments

Comments

@JiamingOuyang
Copy link

Hello, Deng Yifan. After I installed the environment according to requirement.txt, I still got an error when running NLPProcess: RuntimeError: index_select(): Expected dtype int32 or int64 for index. Could you please help me solve it. This will help me a lot.

@YifanDengWHU
Copy link
Owner

Hi, jiaming. Could you please provide a more thorough description of the problem? For example, which line of code leads to the error according to the interpreter.

@JiamingOuyang
Copy link
Author

Traceback (most recent call last):
File "D:/pyFile/DDIMDL/DDIMDL.py", line 1, in
from NLPProcess import NLPProcess
File "D:\pyFile\DDIMDL\NLPProcess.py", line 68, in
mechanism,action,drugA,drugB=NLPProcess(drugList,df_interaction)
File "D:\pyFile\DDIMDL\NLPProcess.py", line 25, in NLPProcess
doc=nlp(event[i])
File "D:\pyFile\DDIMDL\venv\lib\site-packages\stanfordnlp\pipeline\core.py", line 176, in call
self.process(doc)
File "D:\pyFile\DDIMDL\venv\lib\site-packages\stanfordnlp\pipeline\core.py", line 170, in process
self.processors[processor_name].process(doc)
File "D:\pyFile\DDIMDL\venv\lib\site-packages\stanfordnlp\pipeline\lemma_processor.py", line 66, in process
ps, es = self.trainer.predict(b, self.config['beam_size'])
File "D:\pyFile\DDIMDL\venv\lib\site-packages\stanfordnlp\models\lemma\trainer.py", line 88, in predict
preds, edit_logits = self.model.predict(src, src_mask, pos=pos, beam_size=beam_size)
File "D:\pyFile\DDIMDL\venv\lib\site-packages\stanfordnlp\models\common\seq2seq_model.py", line 210, in predict
update_state((hn, cn), b, beam[b].get_current_origin(), beam_size)
File "D:\pyFile\DDIMDL\venv\lib\site-packages\stanfordnlp\models\common\seq2seq_model.py", line 193, in update_state
s.data.copy_(s.data.index_select(0, positions))
RuntimeError: index_select(): Expected dtype int32 or int64 for index

@YifanDengWHU
Copy link
Owner

This may be the issue of the dependency package with stanfordnlp. You can refer to stanfordnlp/stanfordnlp#6 and replace stanfordnlp with stanza. I recalled that their APIs are almost the same.

@Muhammad-Asad-Arshed
Copy link

Respected JiamingOuyang and YifanDengWHU,
Can you please share with me the NLP file with the stanza if you have done so far?

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