chrsmrrs / k-gnn Goto Github PK
View Code? Open in Web Editor NEWSource code for our AAAI paper "Weisfeiler and Leman Go Neural: Higher-order Graph Neural Networks".
Source code for our AAAI paper "Weisfeiler and Leman Go Neural: Higher-order Graph Neural Networks".
I have installed torch_geometric 1.3.0 and Pytorch 1.1.0, however I can not import one_hot from torch_geometric.utils. Could you tell me what's the version of your torch_geometric?
Hi, I was trying to train QM9 dataset using CPUs. However, it keeps showing there is asegmentation fault. I'm not sure where this problem comes from. Any hints? Thanks!
There is lacking file named graph_cpu leading errors in init.py and tansform.py.
Dear authors,
This is my first post of a github issue, I've got a question to consult you. I tried to learn this project recently, but after importing the project, I found that there is no graph_cpu module. Could you upload it again?
Thanks!
Best wishes,
Kaia
Dear authors,
This is my first post of a github issue, please forgive me for the improper format. I'm tring to reproduce the work 'Graph_Neural_Network_for_Fuel_Ignition_Quality' (https://git.rwth-aachen.de/avt-svt/public/graph_neural_network_for_fuel_ignition_quality). I replaced the original database in the repository with a boiling point database. Then the problem comes, after the database was created using:
dataset = PropDataset( path + 'Train/', pre_transform=MyPreTransform(), pre_filter=MyFilter()); dataset.data.iso_type_2 = torch.unique(dataset.data.iso_type_2, True, True)[1]; num_i_2 = int(dataset.data.iso_type_2.max().item() + 1); dataset.data.iso_type_2 = F.one_hot(dataset.data.iso_type_2, num_classes=num_i_2).to(torch.float)
At this stage, data was loaded correctly
dataset.data.y[:5] Out[87]: tensor([[413.8000], [413.1500], [574.1500], [476.1500], [608.1500]])
A further step is applied to normilize the dataset:
mean = torch.as_tensor(dataset.data.y, dtype=torch.float).mean(); std = torch.as_tensor(dataset.data.y, dtype=torch.float).std(); dataset.data.y = (dataset.data.y - mean) / std
At this stage, the original data is proved to be normalized, as indicated by the return of input dataset.data.y[:5] Out[66]: tensor([[-0.5562], [-0.5634], [ 1.2268], [ 0.1371], [ 1.6049]])
however, when loading the 'database', problem comes out, all normalized y are loaded correctly except the first one 413.80, which is exactly the same with original database before normalization applied, but different to the normalized one -0.5562:
from k_gnn import DataLoader; all_loader = DataLoader(dataset, batch_size = 64); for i, dataset1 in enumerate(all_loader): if i <= 1: print(dataset1.y[:5]) tensor([[ 4.1380e+02], [-5.6341e-01], [ 1.2268e+00], [ 1.3712e-01], [ 1.6049e+00]]) tensor([[-1.2050], [-1.4974], [-1.4407], [-0.0186], [ 0.5263]])
Could you please help me find out the reasons? many thanks!
Best regards,
Patrick
Very basic question as I am completely new to github.
I have tried downloading the github repository. I used git clone https://github.com/chrsmrrs/k-gnn.git
to download the contents of the github repository on locally so I can run some other code for which this package is necessary. I then went through the installation steps of this github repository and ran python setup.py install
in the root directory of the git
clone I made. When I tried to test the code, I typed in the following in command line as suggested in the github repo:
cd examples
python 1-2-3-proteins.py
However I get the following response from the command line terminal on my mac.
Traceback (most recent call last):
File "/Users/Tom/Documents/300. MASTERS/MASTERS/THESIS/CODE/k-gnn/examples/1-2-3-proteins.py", line 18, in <module>
from k_gnn import DataLoader, GraphConv, avg_pool
ModuleNotFoundError: No module named 'k_gnn'
However, as far as I understand my sys.path is not looking for the module k_gnn as I did the following experiment
print(type(sys.path))
i = 1
for path in sys.path:
print(i)
print(path)
i += 1
and got the following response
1
/Users/Tom/Documents/300. MASTERS/MASTERS/THESIS/CODE/k-gnn/examples
2
/usr/local/anaconda3/envs/gnn-test-env/lib/python39.zip
3
/usr/local/anaconda3/envs/gnn-test-env/lib/python3.9
4
/usr/local/anaconda3/envs/gnn-test-env/lib/python3.9/lib-dynload
5
/usr/local/anaconda3/envs/gnn-test-env/lib/python3.9/site-packages
As you can see it does search in /Users/Tom/Documents/300. MASTERS/MASTERS/THESIS/CODE/k-gnn/examples
but not in /Users/Tom/Documents/300. MASTERS/MASTERS/THESIS/CODE/k-gnn
where k-gnn is located. Is this due to my faulty download of the git repository or is this a fault of the code? If it's the former any help/reading material would be appreciated.
Thanks in advance for the help and let me know if anything is unclear.
KR, Tom
When running 1-2-3-proteins.py, I got the following error:
Traceback (most recent call last):
File "1-2-3-proteins.py", line 9, in
from k_gnn import DataLoader, GraphConv, avg_pool
File "/scratch/aqd215/k-gnn/examples/k_gnn/init.py", line 1, in
from graph_cpu import two_local, connected_two_local
ModuleNotFoundError: No module named 'graph_cpu'
Not sure how to resolve this.
Thanks!
Hi,
I was trying to run other datasets from the TU dataset like the facebook_ct1, github_stargazer etc. I tried just using the same code from examples/1-2-3-imdb.py and replaced the datasets with others. It seems like the code is tied to a specific dataset. Can you provide some high level guidance on how to get the code working for other datasets?. for example to get the imbd code working with facebook dataset?. Thanks
I have installed according to instructions for torch-geomrtric==1.4.2 but I am getting error while importing. Any help will be useful. Thanks in advance
File "C:\Users\kanad\Desktop\Github repos\sample\main.py", line 1, in
from k_gnn import TwoLocal
File "C:\Users\kanad\Desktop\Github repos\sample\k_gnn_init_.py", line 1, in
from graph_cpu import two_local, connected_two_local
ImportError: DLL load failed while importing graph_cpu: The specified module could not be found.
i try to use this rep, but while i run python steup.py install
,i get error:
cpu/utils.h:27:10: error: reference to 'stack' is ambiguous
environment
os: OS X 11.2.3
c++ compiler
clang version 11.1.0
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /usr/local/Cellar/llvm/11.1.0/bin
Is it my software version problem? thanks!
File "/usr/local/lib/python3.6/dist-packages/k_gnn-0.0.0-py3.6-linux-x86_64.egg/k_gnn/dataloader.py", line 60, in collate
batch[key] = torch.cat([batch[key]], dim=data_list[0].cat_dim(key))
TypeError: cat_dim() missing 1 required positional argument: 'item'
Hi all, I followed the installation process and can run the 1-2-3-qm9.py
. However, I met the dataset problem when I ran the 1-2-3-proteins.py
. I print the dataset.data
:
Data(edge_index=[2, 156166], x=[41859, 0], y=[1109], edge_index_2=[2, 11326562], assignment_index_2=[2, 3116620], iso_type_2=[1558310, 12], edge_index_3=[2, 531644], assignment_index_3=[2, 540045], iso_type_3=[180015, 20])
It seems that the input x
's shape is not correct, which causes the dataset.num_features
to be 0. The code also printed that it downloaded the dataset from https://www.chrsmrrs.com/graphkerneldatasets/PROTEINS.zip. Is there any solution for this problem? Thank you!
Hello,
When running
Line 61 in 834c517
Should it be changed to
keys = [x for x in batch.keys if x not in ['batch', 'batch_2', 'batch_3', 'name']]? The names are list of list of strings which cannot be used in torch.cat.
Hi,
I am trying to install this package on my windows, I already have torch 1.5.1+cu101
, and torch_geometric
version 1.6.1, yet I am unable to install k-gnn on my system, and I don't know how to resolve it.
Here is the error while installing k-gnn:
python setup.py install
running install
running bdist_egg
running egg_info
writing k_gnn.egg-info\PKG-INFO
writing dependency_links to k_gnn.egg-info\dependency_links.txt
writing top-level names to k_gnn.egg-info\top_level.txt
reading manifest file 'k_gnn.egg-info\SOURCES.txt'
writing manifest file 'k_gnn.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
C:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\utils\cpp_extension.py:238: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
warnings.warn('Error checking compiler version for {}: {}'.format(compiler, error))
building 'graph_cpu' extension
Emitting ninja build file C:\Users\user\k-gnn-master\k-gnn-master\build\temp.win-amd64-3.6\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/1] cl /showIncludes /nologo /Ox /W3 /GL /DNDEBUG /MD /MD /wd4819 /EHsc -IC:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\include -IC:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\include\TH -IC:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\include\THC -IC:\Users\user\anaconda3\envs\py36\include -IC:\Users\user\anaconda3\envs\py36\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -c C:\Users\user\k-gnn-master\k-gnn-master\cpu\graph.cpp /FoC:\Users\user\k-gnn-master\k-gnn-master\build\temp.win-amd64-3.6\Release\cpu/graph.obj -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=graph_cpu -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++14
FAILED: C:/Users/user/k-gnn-master/k-gnn-master/build/temp.win-amd64-3.6/Release/cpu/graph.obj
cl /showIncludes /nologo /Ox /W3 /GL /DNDEBUG /MD /MD /wd4819 /EHsc -IC:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\include -IC:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\include\TH -IC:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\include\THC -IC:\Users\user\anaconda3\envs\py36\include -IC:\Users\user\anaconda3\envs\py36\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -c C:\Users\user\k-gnn-master\k-gnn-master\cpu\graph.cpp /FoC:\Users\user\k-gnn-master\k-gnn-master\build\temp.win-amd64-3.6\Release\cpu/graph.obj -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=graph_cpu -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++14
CreateProcess failed: The system cannot find the file specified.
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\utils\cpp_extension.py", line 1423, in run_ninja_build
check=True)
File "C:\Users\user\anaconda3\envs\py36\lib\subprocess.py", line 438, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 28, in
packages=find_packages(),
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\setuptools_init.py", line 163, in setup
return distutils.core.setup(**attrs)
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\setuptools\command\install.py", line 67, in run
self.do_egg_install()
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\setuptools\command\install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\setuptools\command\bdist_egg.py", line 175, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\setuptools\command\bdist_egg.py", line 161, in call_command
self.run_command(cmdname)
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
self.build()
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\command\install_lib.py", line 107, in build
self.run_command('build_ext')
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\setuptools\command\build_ext.py", line 87, in run
_build_ext.run(self)
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\utils\cpp_extension.py", line 603, in build_extensions
build_ext.build_extensions(self)
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\command\build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\setuptools\command\build_ext.py", line 208, in build_extension
_build_ext.build_extension(self, ext)
File "C:\Users\user\anaconda3\envs\py36\lib\distutils\command\build_ext.py", line 533, in build_extension
depends=ext.depends)
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\utils\cpp_extension.py", line 585, in win_wrap_ninja_compile
with_cuda=with_cuda)
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\utils\cpp_extension.py", line 1163, in _write_ninja_file_and_compile_objects
error_prefix='Error compiling objects for extension')
File "C:\Users\user\anaconda3\envs\py36\lib\site-packages\torch\utils\cpp_extension.py", line 1436, in _run_ninja_build
raise RuntimeError(message)
RuntimeError: Error compiling objects for extension
Thank you in advance for your help.
Hello,
I'm just trying to run the example program: python 1-2-3-proteins.py and get the following:
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'ls11-www.cs.uni-dortmund.de'. (_ssl.c:1056)>
I'm on MacOS 10.14.4, python 3.7, anaconda.
Thanks if you can help.
Scott
python 1-2-3-proteins.py
Downloading https://ls11-www.cs.uni-dortmund.de/people/morris/graphkerneldatasets/PROTEINS.zip
Traceback (most recent call last):
File "/anaconda3/lib/python3.7/urllib/request.py", line 1317, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/anaconda3/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/anaconda3/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/anaconda3/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/anaconda3/lib/python3.7/http/client.py", line 1016, in _send_output
self.send(msg)
File "/anaconda3/lib/python3.7/http/client.py", line 956, in send
self.connect()
File "/anaconda3/lib/python3.7/http/client.py", line 1392, in connect
server_hostname=server_hostname)
File "/anaconda3/lib/python3.7/ssl.py", line 412, in wrap_socket
session=session
File "/anaconda3/lib/python3.7/ssl.py", line 853, in _create
self.do_handshake()
File "/anaconda3/lib/python3.7/ssl.py", line 1117, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'ls11-www.cs.uni-dortmund.de'. (_ssl.c:1056)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "1-2-3-proteins.py", line 39, in
pre_filter=MyFilter())
File "/anaconda3/lib/python3.7/site-packages/torch_geometric/datasets/tu_dataset.py", line 48, in init
pre_filter)
File "/anaconda3/lib/python3.7/site-packages/torch_geometric/data/in_memory_dataset.py", line 56, in init
pre_filter)
File "/anaconda3/lib/python3.7/site-packages/torch_geometric/data/dataset.py", line 82, in init
self._download()
File "/anaconda3/lib/python3.7/site-packages/torch_geometric/data/dataset.py", line 108, in _download
self.download()
File "/anaconda3/lib/python3.7/site-packages/torch_geometric/datasets/tu_dataset.py", line 81, in download
path = download_url('{}/{}.zip'.format(self.url, self.name), self.root)
File "/anaconda3/lib/python3.7/site-packages/torch_geometric/data/download.py", line 23, in download_url
data = urllib.request.urlopen(url)
File "/anaconda3/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/anaconda3/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/anaconda3/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/anaconda3/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/anaconda3/lib/python3.7/urllib/request.py", line 1360, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/anaconda3/lib/python3.7/urllib/request.py", line 1319, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'ls11-www.cs.uni-dortmund.de'. (_ssl.c:1056)>
I'm currently trying to adapt your model for my work on GNNs but after reading the referenced paper, I wonder what exactly is the Malkin (am I right with the term neighborhood?) in contrast to the local neighborhood definition from your paper ? In your paper it is stated that you would use the local neighborhood for creating the subsets.
Hi, I'm very appreciate u for sharing the code & paper.
Awesome !
I get some questions.
First, "We always used three layers for 1-GNN, and two layers for (local) 2-GNNand 3-GNN,all with a hidden-dimension size of 64. " why 64? Based on empirical intuition or experimental trial-and-error?Can I use other numbers instead of 64?
Second, why " |s∩t|=k-1 "? u just tell the existence of "k-1" . I wanna know the meaning of "k-1" in the design of N(s).
The last question is what the model learned through the training. Matrix?Parameter?I konw it is crazy , but i wanna visualize "it" the model learned.
Hello,
I'm testing your 1-2 QM9 example. Everything works well despite the fact that I get Warnings for each Data object while transforming them with the TwoMalkin Function. For every Data object I get the following warning:
Warning: The number of elements in the out tensor of shape [105] is 105 which does not match the computed number of elements 780. Note that this may occur as a result of rounding error. The out tensor will be resized to a tensor of shape (780,). (operator() at /opt/conda/conda-bld/pytorch_1579022060824/work/aten/src/ATen/native/RangeFactories.cpp:170)
Can you confirm the warning when running it in your environment or is this my fault?
Hi, when running your code, it has both Test MAE and Test MAE norm, I wonder which one is the one that you used in your paper?
I see you have a torch extension where you register the 1,2,3 malkin functions. Does a K version need to be generated for an expected k in k-gnn?
Hi,
There are three outputs to the functions such as two_local
and connected_two_local
which are edge_index
, assignment_index
, and iso_type
from the according higher order graph.
Could you please explain what each are and what they indicate? I have already read your paper but I could not figure the implementation out regarding these features.
Thank you in advance.
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.