I was following the example on the tensor scoring in the readme file
import torch
from kge.model import KgeModel
from kge.util.io import load_checkpoint
checkpoint = load_checkpoint('fb15k-237-rescal.pt')
model = KgeModel.create_from(checkpoint)
s = torch.Tensor([0, 2,]).long() # subject indexes
p = torch.Tensor([0, 1,]).long() # relation indexes
scores = model.score_sp(s, p) # scores of all objects for (s,p,?)
o = torch.argmax(scores, dim=-1) # index of highest-scoring objects
print(o)
print(model.dataset.entity_strings(s)) # convert indexes to mentions
print(model.dataset.relation_strings(p))
print(model.dataset.entity_strings(o))
When running
print(model.dataset.entity_strings(s))
print(model.dataset.entity_strings(o))
It returns the following error
Traceback (most recent call last):
File "", line 1, in
File "/home/ramab/workspace/kge/kge/dataset.py", line 494, in entity_strings
map_ = self.load_map(
File "/home/ramab/workspace/kge/kge/dataset.py", line 315, in load_map
ids = self.load_map(ids_key, as_list=True)
File "/home/ramab/workspace/kge/kge/dataset.py", line 296, in load_map
self.ensure_available(key)
File "/home/ramab/workspace/kge/kge/dataset.py", line 88, in ensure_available
raise IOError(
OSError: File /home/ramab/workspace/kge/data/fb15k-237/entity_map.del for key entity_ids could not be found
I've downloaded all the data through the bash script. Am I missing something?
I was following the example on the tensor scoring in the readme file
When running
It returns the following error
Traceback (most recent call last):
File "", line 1, in
File "/home/ramab/workspace/kge/kge/dataset.py", line 494, in entity_strings
map_ = self.load_map(
File "/home/ramab/workspace/kge/kge/dataset.py", line 315, in load_map
ids = self.load_map(ids_key, as_list=True)
File "/home/ramab/workspace/kge/kge/dataset.py", line 296, in load_map
self.ensure_available(key)
File "/home/ramab/workspace/kge/kge/dataset.py", line 88, in ensure_available
raise IOError(
OSError: File /home/ramab/workspace/kge/data/fb15k-237/entity_map.del for key entity_ids could not be found
I've downloaded all the data through the bash script. Am I missing something?