ganeshjawahar / mem_absa

Aspect Based Sentiment Analysis using End-to-End Memory Networks
MIT License
199 stars 104 forks source link

IndexError: index out of bounds #9

Open muety opened 7 years ago

muety commented 7 years ago

I'm getting the following error. Does anybody else have this problem? Python 3.6 on Windows.

 File "main.py", line 61, in <module>
    tf.app.run()
  File "C:\Users\Ferdinand\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 58, in main
    model.run(train_data, test_data)
  File "D:\dev\mem_absa\model.py", line 264, in run
    train_loss, train_acc = self.train(train_data)
  File "D:\dev\mem_absa\model.py", line 175, in train
    m = rand_idx[cur]
IndexError: index 2358 is out of bounds for axis 0 with size 2358
wodeweilai commented 7 years ago

Do you deal with this problem?

wodeweilai commented 7 years ago

I also meet this problem.

morning-ding commented 7 years ago

have you solved it yet? i have the same question.

pcgreat commented 7 years ago

that's bug easy to fix. rand_idx should be the list of shuffled train/test data, and since N is choosing the ceil, something that will cause cur to be larger than the length of rand_idx, my fix is to add a break if cur is larger than the length of rand_idx. You can check my fork to see the fix

amanchuan commented 5 years ago

the incorrect process in preprocessing may also cause this problem. you can check your source_data, target_data and target label.