DDIMDL icon indicating copy to clipboard operation
DDIMDL copied to clipboard

NLPProcess running error

Open JiamingOuyang opened this issue 3 years ago • 4 comments

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.

JiamingOuyang avatar Mar 21 '21 02:03 JiamingOuyang

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.

YifanDengWHU avatar Mar 21 '21 02:03 YifanDengWHU

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

JiamingOuyang avatar Mar 21 '21 04:03 JiamingOuyang

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

YifanDengWHU avatar Mar 21 '21 07:03 YifanDengWHU

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

Muhammad-Asad-Arshed avatar Sep 23 '23 06:09 Muhammad-Asad-Arshed