mem_absa icon indicating copy to clipboard operation
mem_absa copied to clipboard

IndexError: index out of bounds

Open muety opened this issue 7 years ago • 5 comments

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

muety avatar Oct 12 '17 23:10 muety

Do you deal with this problem?

wodeweilai avatar Oct 23 '17 09:10 wodeweilai

I also meet this problem.

wodeweilai avatar Oct 23 '17 09:10 wodeweilai

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

morning-ding avatar Oct 27 '17 09:10 morning-ding

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

pcgreat avatar Oct 30 '17 04:10 pcgreat

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

amanchuan avatar Nov 13 '18 01:11 amanchuan