coper icon indicating copy to clipboard operation
coper copied to clipboard

error occurs when model predicted

Open yzj19870824 opened this issue 3 years ago • 1 comments

When I execute command —— !cd coper-master/CoPER_MINERVA/ && bash ./experiment.sh configs/umls.sh --inference 0 error occurs: Memory allocated before eval data loading: 1.02944768 HIIIII 652 triples loaded from data/umls/dev.triples 661 triples loaded from data/umls/test.triples Memory allocated after eval data loading: 1.02944768 0% 0/326 [00:00<?, ?it/s] Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/content/coper-master/CoPER_MINERVA/src/experiments.py", line 830, in run_experiment(args) File "/content/coper-master/CoPER_MINERVA/src/experiments.py", line 813, in run_experiment inference(lf) File "/content/coper-master/CoPER_MINERVA/src/experiments.py", line 369, in inference pred_scores = lf.forward(dev_data, verbose=False) File "/content/coper-master/CoPER_MINERVA/src/learn_framework.py", line 253, in forward pred_score = self.predict(mini_batch, verbose=verbose) File "/content/coper-master/CoPER_MINERVA/src/rl/graph_search/pg.py", line 226, in predict pn, e1, r, e2, kg, self.num_rollout_steps, self.beam_size) File "/content/coper-master/CoPER_MINERVA/src/rl/graph_search/beam_search.py", line 168, in beam_search pn.update_path(action, kg, offset=action_offset) File "/content/coper-master/CoPER_MINERVA/src/rl/graph_search/pn.py", line 257, in update_path offset_path_history(self.path, offset) File "/content/coper-master/CoPER_MINERVA/src/rl/graph_search/pn.py", line 235, in offset_path_history new_tuple = tuple([_x[offset, :, :] for _x in x]) File "/content/coper-master/CoPER_MINERVA/src/rl/graph_search/pn.py", line 235, in new_tuple = tuple([_x[offset, :, :] for _x in x]) IndexError: tensors used as indices must be long, byte or bool tensors

type of elements in offset is float, how can I solve it, anyone can help

yzj19870824 avatar Jul 01 '21 12:07 yzj19870824

Hi,

I will try to reproduce your error. Could you please tell me what system and version of Tensorflow you are using?

Thanks, Otilia

otiliastr avatar Jul 12 '21 12:07 otiliastr