Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

tensors used as indices must be long, byte or bool tensors #30

@yzj19870824

Description

@yzj19870824

error occurs when I train model using UMLS dataset

Epoch 2: average training loss = -0.22322563640773296 entropy = 4.2052984714508055
=> saving checkpoint to '/content/MultiHopKG-master/model/umls-point.rs.conve-xavier-n/a-200-200-3-0.001-0.1-0.0-0.95-400-0.05/checkpoint-2.tar'
0% 0/11 [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/MultiHopKG-master/src/experiments.py", line 765, in
run_experiment(args)
File "/content/MultiHopKG-master/src/experiments.py", line 746, in run_experiment
train(lf)
File "/content/MultiHopKG-master/src/experiments.py", line 235, in train
lf.run_train(train_data, dev_data)
File "/content/MultiHopKG-master/src/learn_framework.py", line 146, in run_train
dev_scores = self.forward(dev_data, verbose=False)
File "/content/MultiHopKG-master/src/learn_framework.py", line 202, in forward
pred_score = self.predict(mini_batch, verbose=verbose)
File "/content/MultiHopKG-master/src/rl/graph_search/pg.py", line 226, in predict
pn, e1, r, e2, kg, self.num_rollout_steps, self.beam_size)
File "/content/MultiHopKG-master/src/rl/graph_search/beam_search.py", line 168, in beam_search
pn.update_path(action, kg, offset=action_offset)
File "/content/MultiHopKG-master/src/rl/graph_search/pn.py", line 187, in update_path
offset_path_history(self.path, offset)
File "/content/MultiHopKG-master/src/rl/graph_search/pn.py", line 176, in offset_path_history
new_tuple = tuple([_x[:, offset, :] for _x in x])
File "/content/MultiHopKG-master/src/rl/graph_search/pn.py", line 176, in
new_tuple = tuple([_x[:, offset, :] for _x in x])
IndexError: tensors used as indices must be long, byte or bool tensors

Does anyone meet that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions