thiviyant / torch-rgcn Goto Github PK
View Code? Open in Web Editor NEWA PyTorch implementation of the Relational Graph Convolutional Network (RGCN).
License: MIT License
A PyTorch implementation of the Relational Graph Convolutional Network (RGCN).
License: MIT License
In the forward() function of the RelationalGraphConvolutionLP Layer, the generate_self_loops() function concatenates the triples and self-edges, which are then concatenated again for the triples_plus with the triples and inverse_triples. This way the triples_plus contain the original edges twice.
Also, self-edges are created not only for the nodes left in the sampled (and edge-dropped) graph but for all nodes of the original graph. Is this implemented this way on purpose?
I was able to run the node classification on all datasets, unfortunately the link prediction experiment always throws an exception, I've tried changing the configurations but no luck, below is the error:
...
WARNING - root - Added new config entry: "training.use_cuda"
WARNING - R-GCN Link Prediction - No observers have been added to this run
INFO - R-GCN Link Prediction - Running command 'train'
INFO - R-GCN Link Prediction - Started
ERROR - R-GCN Link Prediction - Failed after 0:00:00!
Traceback (most recent calls WITHOUT Sacred internals):
File "experiments/predict_links.py", line 88, in train
decoder_config=decoder
File "/home/raftel/torch-rgcn/torch_rgcn/models.py", line 224, in __init__
.__init__(nnodes, nrel, nfeat, encoder_config, decoder_config)
File "/home/raftel/torch-rgcn/torch_rgcn/models.py", line 58, in __init__
init(self.node_embeddings)
TypeError: schlichtkrull_normal_() missing 1 required positional argument: 'shape'
Can we do the same link prediction and entity classification on path queries datasets like freebass and wordnet
does r-gcn works on entity alignment (existing R-GCN seems only focus on classification and link prediction)?
If yes, May I know do you have any working code on this?
or does this link prediction model works directly on that? Since “Links between two nodes exist” is very similar to “two nodes referring to same real-world object”
As this issues mentioned, the link prediction code can't run. So I used a history commit b1b6646
, it can run normally for link prediction task. But when I use the 'configs/rgcn/rp-WN18.yaml' default config files which set "use_cuda: True" , I found that the running speed is much slower than the node classification task. So I monitored the usage of gpu, I found that the utilization rate of gpu is 0.
Could you provide some instructions on data preparation?
I get this error when running the cn task:
zsh: segmentation fault python experiments/classify_nodes.py with configs/rgcn/nc-AIFB.yaml
I tried with all the datasets and models, and with some debugging I found out that this happens right before the training starts. I am wondering if it's a problem of my machine or not and if so how to fix it.
Thank you for your help!
When I run classify_nodes.py
I get an error about libffi.so
not being found:
(torch_rgcn_venv) ~/tmp/torch-rgcn$ python experiments/classify_nodes.py with configs/rgcn/nc-AIFB.yaml
Traceback (most recent call last):
File "experiments/classify_nodes.py", line 1, in <module>
from utils.misc import create_experiment
File "/home/wouter/tmp/torch-rgcn/utils/misc.py", line 1, in <module>
from sacred import Experiment
File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/site-packages/sacred/__init__.py", line 11, in <module>
from sacred.experiment import Experiment
File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/site-packages/sacred/experiment.py", line 26, in <module>
from sacred.initialize import create_run
File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/site-packages/sacred/initialize.py", line 17, in <module>
from sacred.host_info import get_host_info
File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/site-packages/sacred/host_info.py", line 11, in <module>
import cpuinfo
File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/site-packages/cpuinfo/__init__.py", line 3, in <module>
from cpuinfo.cpuinfo import *
File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/site-packages/cpuinfo/cpuinfo.py", line 34, in <module>
import ctypes
File "/home/wouter/miniconda3/envs/torch_rgcn_venv/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
The shared library to be found by classify_nodes.py
.
Using the default config file present in /configs/c-rgcn/lp-WN18.yaml
after changing the weight initialisation as suggested in #12, I get the following error.
INFO - R-GCN Link Prediction - Started
Start training...
ERROR - R-GCN Link Prediction - Failed after 0:00:02!
Traceback (most recent calls WITHOUT Sacred internals):
File "experiments/predict_links.py", line 151, in train
predictions, penalty = model(graph, batch_idx)
File "/usr/local/envs/torch_rgcn_venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "/content/drive/MyDrive/research/dr/torch-rgcn/torch_rgcn/models.py", line 235, in forward
x = self.rgc1(graph, features=x)
File "/usr/local/envs/torch_rgcn_venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "/content/drive/MyDrive/research/dr/torch-rgcn/torch_rgcn/layers.py", line 550, in forward
fw = torch.einsum('ni, rio -> rno', features, weights).contiguous()
File "/usr/local/envs/torch_rgcn_venv/lib/python3.7/site-packages/torch/functional.py", line 201, in einsum
return torch._C._VariableFunctions.einsum(equation, operands)
RuntimeError: size of dimension does not match previous size, operand 1, dim 1
Any help is appreciated, TIA!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.