mem_absa
mem_absa copied to clipboard
IndexError: index out of bounds
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
Do you deal with this problem?
I also meet this problem.
have you solved it yet? i have the same question.
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
the incorrect process in preprocessing may also cause this problem. you can check your source_data, target_data and target label.