xiangwang1223/knowledge_graph_attention_network

IndexError: too many indices for array

misterbean01 opened this issue · 0 comments

I was able to clone the github project on Google Colab then installed the packages as close as possible to the ones specified on Readme:
!pip install tensorflow==1.13.1
!pip install numpy==1.15.4
!pip install scipy==1.1.0
!pip install scikit-learn==0.20.0

Unfortunately I have been hitting and IndexError after Epoch 0:

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
[n_users, n_items]=[70679, 24915]
[n_train, n_test]=[652514, 193920]
[n_entities, n_relations, n_triples]=[113487, 39, 2557746]
[batch_size, batch_size_kg]=[1024, 4015]
convert ratings into adj mat done.
convert 80 relational triples into adj mat done. @1.7324s
/content/drive/My Drive/Colab Notebooks/TCSS 593/knowledge_graph_attention_network/Model/utility/loader_kgat.py:87: RuntimeWarning: divide by zero encountered in power
d_inv = np.power(rowsum, -1).flatten()
generate si-normalized adjacency matrix.
reordering indices...
reorganize all kg data done.
sort meta-data done.
sort all data done.
load the pretrained bprmf model parameters.

WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:

WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
using pretrained initialization
WARNING:tensorflow:From /content/drive/My Drive/Colab Notebooks/TCSS 593/knowledge_graph_attention_network/Model/KGAT.py:289: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
#params: 12146384
without pretraining.
Epoch 0 [5124.6s]: train==[434.08832=14.35307 + 419.35645 + 0.37843]
Traceback (most recent call last):
File "Main.py", line 342, in
best_rec_0 = max(recs[:, 0])
IndexError: too many indices for array