haseebs / OWE

Pytorch code for An Open-World Extension to Knowledge Graph Completion Models (AAAI 2019)
https://aaai.org/ojs/index.php/AAAI/article/view/4162
37 stars 9 forks source link

Extend the code for predicting relations #8

Closed mdabedr closed 3 years ago

mdabedr commented 3 years ago

I was wondering which parts of the code needs to be updated for the model to predict relations given head and tail entities

mdabedr commented 3 years ago

I am getting the following error all of a sudden

TypeError: forward() got an unexpected keyword argument 'embeddings'

Do I have to retrain the model?

haseebs commented 3 years ago

I am getting the following error all of a sudden

TypeError: forward() got an unexpected keyword argument 'embeddings'

Do I have to retrain the model?

Its hard to tell what the error is using just that information. You might need to check out the full stack trace.

You shouldn't need to retrain the embeddings if the dimensions are the same.

mdabedr commented 3 years ago

Here's the stack trace

Traceback (most recent call last): File "./run_open_world.py", line 180, in main() File "./run_open_world.py", line 167, in main epoch=start_epoch - 1) File "/local/scratch1/mdabed/OWE/OWE-master/owe/open_world_prediction.py", line 294, in evaluate embeddings=embeddings, File "/cshome/mdabed/yes/envs/mypython3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, kwargs) File "/cshome/mdabed/yes/envs/mypython3/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 141, in forward return self.module(*inputs[0], *kwargs[0]) File "/cshome/mdabed/yes/envs/mypython3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(input, kwargs) TypeError: forward() got an unexpected keyword argument 'embeddings'

mdabedr commented 3 years ago

For relation prediction, after I get the [B, R] tensor back, it gives a bunch of values. Is sorting them and getting the highest value enough??

haseebs commented 3 years ago

For relation prediction, after I get the [B, R] tensor back, it gives a bunch of values. Is sorting them and getting the highest value enough??

I believe that it should be enough. Those should be the scores with each relation.