deepakn97 / relationPrediction

ACL 2019: Learning Attention-based Embeddings for Relation Prediction in Knowledge Graphs
521 stars 124 forks source link

An AttributeError: 'int' object has no attribute 'data' #11

Closed makabaka987 closed 4 years ago

makabaka987 commented 4 years ago

Initialised relations and entities from TransE Traceback (most recent call last): File "main.py", line 110, in Corpus_, entity_embeddings, relation_embeddings = load_data(args) File "main.py", line 105, in load_data args.batch_size_gat, args.valid_invalid_ratio_gat, unique_entities_train, args.get_2hop) File "/home/KBAT-master/create_batch.py", line 35, in init self.graph = self.get_graph() File "/home/KBAT-master/create_batch.py", line 234, in get_graph source = data[1].data.item() AttributeError: 'int' object has no attribute 'data'

deepakn97 commented 4 years ago

It seems like the code is not able to acces any CUDA devices. Please activate the conda environment or check your installation of your CUDA. I am closing this issue, please feel free to re-open it in case you have more questions. Sorry for the extremely late reply.

makabaka987 commented 4 years ago

Thank you very much for your reply. I would like to ask you another question. As for the loss function of the decoder ConvKB, you used torch.nn.SoftMarginLoss() in the code, but as far as I know, this function is exp(-y * x), while there is no negative sign in the loss function of ConvKB. Would you please answer for me?