pyg-team / pytorch_geometric Goto Github PK
View Code? Open in Web Editor NEWGraph Neural Network Library for PyTorch
Home Page: https://pyg.org
License: MIT License
Graph Neural Network Library for PyTorch
Home Page: https://pyg.org
License: MIT License
gcn.py isn't compatible with current version.
self.conv1 = SplineConv(n_in, n_hidden, dim=3, kernel_size=3, norm=False)
x = F.elu(self.norm(self.conv1(x, edge_index, pseudo), edge_index))
It runs perfectly well on my laptop (mac, CPU), but there is a segmentation fault on the line above when I switch to the server (linux-x86_64, gcc 4.9.0, python 2.7, cuda 8.0).
here is the test output:
================================================= test session starts =================================================
platform linux2 -- Python 2.7.5, pytest-3.8.2, py-1.6.0, pluggy-0.7.1
rootdir: /users/../libs/pytorch_spline_conv, inifile: setup.cfg
plugins: cov-2.6.0
collected 28 items
test/test_basis.py Segmentation fault (core dumped)
I follow the instructions to install. The process went well. But when import torch_geometric.transforms as T, I got the error as show below.
import spspmm_cuda
ImportError: /home/name/.local/lib/python2.7/site-packages/spspmm_cuda.so: undefined symbol: _ZN2at6detail20DynamicCUDAInterface20unchecked_set_deviceE
I use python2.7, cuda8.0, pytorch 0.4.1, Ubuntu 16.04.4. Both pip and Miniconda environment gets the same error.
Sorry for incomplete suggestion.
Is it possible to include gUnpool (graph un-pooling layer) described in graph U-Net paper (https://openreview.net/pdf?id=HJePRoAct7)
Hi Matthias,
Thanks for this great project! However, I have got an issue with graclus pooling. GPU memory increases after each pooling operation, while this part of memory is seldom released. As I have a large dataset, the training had to stop quite early because of insufficient memory.
I am not sure if there is memory leak in graclus.py? I am looking into this part of code now. Meanwhile, would you mind checking this as well?
Many thanks,
Shiyang
Hi guys, I'm new with pytorch!
I get this error when I trying to execute:
pip install --upgrade torch-scatter
and I do not know what to do anymore to fix this error :/
I think the method proposed in [1] would be a good addition to the library.
UserWarning:
!! WARNING !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your compiler (g++) may be ABI-incompatible with PyTorch!
Please use a compiler that is ABI-compatible with GCC 4.9 and above.
See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html.
See https://gist.github.com/goldsborough/d466f43e8ffc948ff92de7486c5216d6
for instructions on how to install GCC 4.9 or higher.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! WARNING !!
fatal error: 'forward_list' file not found
#include <forward_list>
^~~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
These are the errors I get trying to pip or manually install torch-spline-conv and torch-scatter.
I'm on a Mac OSX 10.12.6
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin16.7.0
Everything seems to be installed, no errors... I am using Ubuntu with anaconda python 3.7 and gcc 7.3.0
I tried to reinstall with different versions of cuda/pytorch but I am getting the same error when importing torch_scatter:
import torch_scatter
Traceback (most recent call last):
File "", line 1, in
File "/home/yemz/anaconda3/envs/geo/lib/python3.7/site-packages/torch_scatter/init.py", line 3, in
from .mul import scatter_mul
File "/home/yemz/anaconda3/envs/geo/lib/python3.7/site-packages/torch_scatter/mul.py", line 3, in
from torch_scatter.utils.ext import get_func
File "/home/yemz/anaconda3/envs/geo/lib/python3.7/site-packages/torch_scatter/utils/ext.py", line 2, in
import scatter_cpu
ImportError: /home/yemz/anaconda3/envs/geo/lib/python3.7/site-packages/scatter_cpu.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN2at5ErrorC1ENS_14SourceLocationESs
Can you give me a hand?
Thanks!
Thanks for sharing this nice code!
I think it is a very promising direction. I am wondering whether you ever tried to apply splineConv to cifar-10, like that on mnist? It would be great to know whether it is also applicable to more complicated dataset? if any, what is the bottleneck to apply it to more complex image dataset, like ImageNet?
thanks again for such a great work!
Jianwei
I'm using ubuntu 18.04 + cuda9.2.
Along all instruction I successfully updated all packages and installed pytorch_geometric. However, when comes to run all tests as well as the example cora.py. I got this error:
ImportError: libcusparse.so.9.2: cannot open shared object file: No such file or directory
Any ideas about this?
I did find the file inside /usr/local/cuda/lib64:
├── libcurand.so -> libcurand.so.9.2
├── libcurand.so.9.2 -> libcurand.so.9.2.148
├── libcurand.so.9.2.148
├── libcurand_static.a
├── libcusolver.so -> libcusolver.so.9.2
├── libcusolver.so.9.2 -> libcusolver.so.9.2.148
├── libcusolver.so.9.2.148
├── libcusolver_static.a
├── libcusparse.so -> libcusparse.so.9.2
├── libcusparse.so.9.2 -> libcusparse.so.9.2.148
├── libcusparse.so.9.2.148
├── libcusparse_static.a
├── libnppc.so -> libnppc.so.9.2
├── libnppc.so.9.2 -> libnppc.so.9.2.148
Thank you.
Hi, thanks for sharing the code. When I run the example code, why train and test score are all zero all the time?
Hi, there. Thank you so much for this amazing library. I am trying to run the infomax code. This is the output after running infomax.py:
Train deep graph infomax.
Traceback (most recent call last):
File "infomax.py", line 91, in
loss = train_infomax(epoch)
File "infomax.py", line 83, in train_infomax
loss = infomax(data.x, data.edge_index)
File "/home/n/Documents/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "infomax.py", line 56, in forward
positive = self.encoder(x, edge_index, corrupt=False)
File "/home/n/Documents/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "infomax.py", line 28, in forward
x = self.conv(x, edge_index)
File "/home/n/Documents/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/n/Documents/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch_geometric/nn/conv/gcn_conv.py", line 44, in forward
out = self.prop(out, edge_index, edge_attr)
File "/home/n/Documents/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/n/Documents/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch_geometric/nn/prop/gcn_prop.py", line 30, in forward
out = spmm(edge_index, edge_attr, x, num_nodes)
File "/home/n/Documents/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch_sparse/spmm.py", line 17, in spmm
matrix = matrix if matrix.dim() > 1 else matrix.unsqueeze(-1)
AttributeError: 'int' object has no attribute 'dim'
Implementation of the layers described in:
[1] https://people.csail.mit.edu/tommi/papers/Lei_etal_ICML2017.pdf
[2] https://arxiv.org/abs/1603.05629
Especially, Algorithm 2 in [2] seems to give very good accuracies on standard graph classification benchmark data sets.
Hi, thanks for your excellent work!
I am using Ubunt 16.04, cuda 9.2 and pytorch 0.4.1
When importing torch_geometric by:
from torch_geometric.nn import GCNConv
I met the following error:
File "/home/x/PycharmProjects/untitled/foo/simple_gcn.py", line 3, in <module>
from torch_geometric.nn import GCNConv
File "/home/x/anaconda3/lib/python3.6/site-packages/torch_geometric-0.3.1-py3.6.egg/torch_geometric/nn/__init__.py", line 1, in <module>
File "/home/x/anaconda3/lib/python3.6/site-packages/torch_geometric-0.3.1-py3.6.egg/torch_geometric/nn/conv/__init__.py", line 1, in <module>
File "/home/x/anaconda3/lib/python3.6/site-packages/torch_geometric-0.3.1-py3.6.egg/torch_geometric/nn/conv/spline_conv.py", line 3, in <module>
File "/home/x/anaconda3/lib/python3.6/site-packages/torch_spline_conv/__init__.py", line 1, in <module>
from .basis import SplineBasis
File "/home/x/anaconda3/lib/python3.6/site-packages/torch_spline_conv/basis.py", line 5, in <module>
import basis_cuda
ModuleNotFoundError: No module named 'basis_cuda'
Currently I can work with my data on CPU, but maybe using GPU may accelerate things up.
Could you give me some advice about this?
I just finished reading the SplineCNN paper. Can you suggest, what kind of coordinate normalization is better for 3D classification of objects using SplineCNN, when a 3D triangular mesh is given - the cartesian (where the distances from a vertex to all other points of the 3D mesh are normalized to [0,1]) or the local cartesian (when the distances are normalized by dividing by the maximum vertex-vertex distance in a 1-hop neighborhood - am I correct?) ? What can be the advantages and downsides of these approaches for 3D object classification? I think that there might be different behaviour when a CNN is trained on a fine-grained mesh, and then applied to a coarser triangular mesh, or vice versa. One of these normalization approaches might generalize better... What do you think?
Sorry for posting this as an "issue"
I have followed the instructions for installing pytorch_geometric. However, I'm receiving some errors while testing. I have searched a lot but I didn't find solutions. It seems that it is something related to the code. Here is what I'm getting.
`root@Linux-HUETOS:~/pytorch_geometric-master# nosetests
.......E..E..E..EEEE.................
======================================================================
ERROR: test_coalesce_gpu (torch_geometric.nn.functional.pool.coalesce_test.CoalesceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/pool/coalesce_test.py", line 60, in test_coalesce_gpu
index = coalesce(index)
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/pool/coalesce.py", line 15, in coalesce
_, perm = unique_by_key(e, perm)
File "/usr/local/lib/python2.7/dist-packages/torch_unique/functions/unique_by_key.py", line 30, in unique_by_key
func = getattr(ffi, 'uniqueByKey_cuda_{}'.format(typename))
AttributeError: 'module' object has no attribute 'uniqueByKey_cuda_Long'
======================================================================
ERROR: test_auto_backward (torch_geometric.nn.functional.pool.pool_test.PoolTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/pool/pool_test.py", line 86, in test_auto_backward
test = gradcheck(op, (input, ), eps=1e-6, atol=1e-4)
File "/home/eman/.local/lib/python2.7/site-packages/torch/autograd/gradcheck.py", line 162, in gradcheck
output = _differentiable_outputs(func(*inputs))
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/pool/pool_test.py", line 13, in max_pool_backward
return _max_pool(input, cluster)
TypeError: _max_pool() takes exactly 3 arguments (2 given)
======================================================================
ERROR: test_avg_forward_gpu (torch_geometric.nn.functional.pool.pool_test.PoolTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/pool/pool_test.py", line 117, in test_avg_forward_gpu
output, index, position = avg_pool(input, index, position, cluster)
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/pool/pool.py", line 77, in avg_pool
x = _avg_pool(input, cluster, size, weight_values)
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/pool/pool.py", line 62, in _avg_pool
x = scatter_mean(cluster, input, dim=0, fill_value=fill)
File "/usr/local/lib/python2.7/dist-packages/torch_scatter/functions/mean.py", line 124, in scatter_mean
return scatter_mean_(output, index, input, dim)
File "/usr/local/lib/python2.7/dist-packages/torch_scatter/functions/mean.py", line 74, in scatter_mean_
scatter(ScatterMean, 'mean', dim, init, index, input, count)
File "/usr/local/lib/python2.7/dist-packages/torch_scatter/functions/scatter.py", line 46, in scatter
return ffi_scatter(name, dim, *data)
File "/usr/local/lib/python2.7/dist-packages/torch_scatter/functions/ffi.py", line 31, in scatter
func = getattr(ffi, 'scatter_{}_{}{}'.format(name, cuda, typename))
AttributeError: 'module' object has no attribute 'scatter_mean_cuda_Float'
======================================================================
ERROR: test_max_forward_gpu (torch_geometric.nn.functional.pool.pool_test.PoolTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/pool/pool_test.py", line 100, in test_max_forward_gpu
output, index, position = max_pool(input, index, position, cluster)
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/pool/pool.py", line 45, in max_pool
x = _max_pool(input, cluster, size)
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/pool/pool.py", line 37, in _max_pool
x = scatter_max(cluster, input, dim=0, fill_value=fill)[0]
File "/usr/local/lib/python2.7/dist-packages/torch_scatter/functions/max.py", line 129, in scatter_max
return scatter_max_(output, index, input, dim)
File "/usr/local/lib/python2.7/dist-packages/torch_scatter/functions/max.py", line 78, in scatter_max_
return scatter(ScatterMax, 'max', dim, output, index, input, arg)
File "/usr/local/lib/python2.7/dist-packages/torch_scatter/functions/scatter.py", line 46, in scatter
return ffi_scatter(name, dim, *data)
File "/usr/local/lib/python2.7/dist-packages/torch_scatter/functions/ffi.py", line 31, in scatter
func = getattr(ffi, 'scatter_{}_{}{}'.format(name, cuda, typename))
AttributeError: 'module' object has no attribute 'scatter_max_cuda_Float'
======================================================================
ERROR: Failure: ImportError (cannot import name voxel_max_pool)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/usr/local/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/local/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/pool/voxel_pool_test.py", line 7, in <module>
from .voxel_pool import voxel_max_pool
ImportError: cannot import name voxel_max_pool
======================================================================
ERROR: test_backward (torch_geometric.nn.functional.spline_conv.spline_conv_test.SplineConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/spline_conv/spline_conv_test.py", line 139, in test_backward
K, True,dtype='double')
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/spline_conv/spline_conv_gpu.py", line 185, in get_weighting_backward_kernel
K=K)
File "cupy/util.pyx", line 39, in cupy.util.memoize.decorator.ret
File "/home/eman/pytorch_geometric-master/torch_geometric/utils/cuda.py", line 37, in load_kernel
kernel_code = cupy.cuda.compile_with_cache(code)
File "/usr/local/lib/python2.7/dist-packages/cupy/cuda/compiler.py", line 152, in compile_with_cache
ptx = compile_using_nvrtc(source, options, arch)
File "/usr/local/lib/python2.7/dist-packages/cupy/cuda/compiler.py", line 70, in compile_using_nvrtc
ptx = prog.compile(options)
File "/usr/local/lib/python2.7/dist-packages/cupy/cuda/compiler.py", line 233, in compile
raise CompileException(log, self.src, self.name, options)
CompileException: /tmp/tmph73gef/kern.cu(44): error: no instance of overloaded function "atomicAdd" matches the argument list
argument types are: (double *, double)
/tmp/tmph73gef/kern.cu(50): error: no instance of overloaded function "atomicAdd" matches the argument list
argument types are: (double *, double)
2 errors detected in the compilation of "/tmp/tmph73gef/kern.cu".
-------------------- >> begin captured stdout << ---------------------
0.8099 0.1667
0.6158 0.8041
0.8828 0.6689
0.7352 0.4808
[torch.cuda.DoubleTensor of size 4x2 (GPU 0)]
--------------------- >> end captured stdout << ----------------------
======================================================================
ERROR: test_forward (torch_geometric.nn.modules.graph_conv_test.GraphConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/modules/graph_conv_test.py", line 31, in test_forward
out = conv(adj, features)
File "/home/eman/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 325, in __call__
result = self.forward(*input, **kwargs)
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/modules/graph_conv.py", line 43, in forward
return graph_conv(x, edge_index, edge_attr, self.weight, self.bias)
File "/home/eman/pytorch_geometric-master/torch_geometric/nn/functional/graph_conv.py", line 28, in graph_conv
row, col = edge_index
ValueError: too many values to unpack
----------------------------------------------------------------------
Ran 37 tests in 2.858s
FAILED (errors=7)
`
Hi,
If I click on [source] near Data docs than redirected page is not found.
Maybe there is an issue with documentation generation with Sphinx when it can not properly import the current package.
It has no problem when I run other pytorch program on GPU, but use SplineConv, it reports error.
When I run example faust.py, it occurs such error:
THCudaCheck FAIL file=aten/THC/generic/THCBasis.cu line=9 error=8 : invalid device function
Traceback (most recent call last):
File "./faust.py", line 99, in
train(epoch)
File "./faust.py", line 84, in train
F.nll_loss(model(data.to(device)), target).backward()
File "/home/xionglei/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "./faust.py", line 57, in forward
x = F.elu(norm(self.conv1(x, edge_index, pseudo), edge_index))
File "/home/xionglei/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "/home/xionglei/anaconda3/lib/python3.6/site-packages/torch_geometric/nn/conv/spline_conv.py", line 83, in forward
self.norm, self.root, self.bias)
File "/home/xionglei/anaconda3/lib/python3.6/site-packages/torch_spline_conv/conv.py", line 61, in apply
data = SplineBasis.apply(pseudo, kernel_size, is_open_spline, degree)
File "/home/xionglei/anaconda3/lib/python3.6/site-packages/torch_spline_conv/basis.py", line 28, in forward
return fw(degree, pseudo, kernel_size, is_open_spline)
File "/home/xionglei/anaconda3/lib/python3.6/site-packages/torch_spline_conv/basis.py", line 11, in fw
fw_basis(degree, basis, weight_index, pseudo, kernel_size, is_open_spline)
File "/home/xionglei/anaconda3/lib/python3.6/site-packages/torch_spline_conv/utils/ffi.py", line 22, in fw_basis
func(basis, weight_index, pseudo, kernel_size, is_open_spline)
File "/home/xionglei/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/init.py", line 197, in safe_call
result = torch._C._safe_call(*args, **kwargs)
torch.FatalError: cuda runtime error (8) : invalid device function at aten/THC/generic/THCBasis.cu:9
First of all, kudos for the great library!
I have a question regarding the forward pass of the GCN layer. Before commit 06f4a4d the order of the preprocessing operations was
I had been experimenting with an older version of the library (the one on PIP actually) that used this order and I was having a hard time getting good performance with my model, and then I noticed that such order was the opposite of how it was proposed it in the original paper and implemented in the original GCN repository.
I was about to raise an issue but then I noticed that commit 06f4a4d reversed the order, so I pulled the changes and my results are much more different now.
Was there any particular reason for this change? Also, I see that the GCNProp class now has an additional improved
argument, what is its purpose?
Thanks!
Hi,
You did excellent job indeed, thanks for the project!
I'm wondering if there is a simple way to create a dataset on-fly. I already have a set of graphs in memory, so i'd like to create Dataset object directly from Data objects. Dumping and restoring the graphs in a recomended way is rather hard in my case, so i cannot use the approach suggested in docs.
Thanks
Implementation of the GraphSage layer.
Hi,
I have succesfully installed the dependencies cffi
, torch-unique
, ...
But when I run the Cora example python cora.py
I get the following error:
Traceback (most recent call last):
File "cora.py", line 5, in <module>
from torch_geometric.datasets import Planetoid
File "/opt/conda/lib/python3.6/site-packages/torch_geometric/datasets/__init__.py", line 1, in <module>
from .tu_dataset import TUDataset
File "/opt/conda/lib/python3.6/site-packages/torch_geometric/datasets/tu_dataset.py", line 5, in <module>
from torch_geometric.data import InMemoryDataset, download_url, extract_zip
File "/opt/conda/lib/python3.6/site-packages/torch_geometric/data/__init__.py", line 3, in <module>
from .data import Data
File "/opt/conda/lib/python3.6/site-packages/torch_geometric/data/data.py", line 2, in <module>
from torch_geometric.utils import (is_coalesced, contains_isolated_nodes,
File "/opt/conda/lib/python3.6/site-packages/torch_geometric/utils/__init__.py", line 4, in <module>
from .coalesce import is_coalesced, coalesce
File "/opt/conda/lib/python3.6/site-packages/torch_geometric/utils/coalesce.py", line 2, in <module>
from torch_unique import unique
File "/opt/conda/lib/python3.6/site-packages/torch_unique/__init__.py", line 1, in <module>
from .unique import unique
File "/opt/conda/lib/python3.6/site-packages/torch_unique/unique.py", line 5, in <module>
import unique_cuda
ModuleNotFoundError: No module named 'unique_cuda'
Do you know where the issue could be?
Thanks!
The k-GNN seems to be missing [1].
The GIN layer has been changed [1]. The implementation should also be adapted.
[1] https://openreview.net/forum?id=ryGs6iA5Km¬eId=ryGs6iA5Km
I miss the following pooling layers:
(1) SortPool,
(2) Janossy Pooling [1].
Hi Matthias,
Thanks for the great library! However, I'm facing some problems when trying to implement my own models using voxel grid clustering technique, followed by max_pool_x layer based on the mnist_voxel_grid.py example.
Here's one of the model architectures I tried:
`
class Net(torch.nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = SplineConv(1, 32, dim=3, kernel_size=2)
self.fc1 = torch.nn.Linear(4 * 32, 2)
def forward(self, data):
print(data)
data.x = F.elu(self.conv1(data.x, data.edge_index, data.edge_attr.float()))
cluster = voxel_grid(data.pos, data.batch, size=15)
x = max_pool_x(cluster, data.x, data.batch, size=4)
x = x.view(-1, self.fc1.weight.size(1))
x = F.elu(self.fc1(x))
return F.log_softmax(x, dim=1)`
And the traceback of the error:
Traceback (most recent call last):
File "/media/bawaw/Alpha/Projects/thesis2/Balder/geometric_dl/models/example_model.py", line 80, in
train(epoch)
File "/media/bawaw/Alpha/Projects/thesis2/Balder/geometric_dl/models/example_model.py", line 62, in train
F.nll_loss(model(data), data.y.long()).backward()
File "/home/bawaw/.conda/envs/gdl/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/media/bawaw/Alpha/Projects/thesis2/Balder/geometric_dl/models/example_model.py", line 38, in forward
x = max_pool_x(cluster, data.x, data.batch, size=4)
File "/home/bawaw/.conda/envs/gdl/lib/python3.7/site-packages/torch_geometric/nn/pool/max_pool.py", line 17, in max_pool_x
return _max_pool_x(cluster, x, (batch.max().item() + 1) * size)
File "/home/bawaw/.conda/envs/gdl/lib/python3.7/site-packages/torch_geometric/nn/pool/max_pool.py", line 11, in _max_pool_x
x[x == fill] = 0
RuntimeError: copy_if failed to synchronize: an illegal memory access was encountered
Kind regards,
Balder
I proceeded with the installation instructions. And I have Cuda available on my machine.
However, when I run python cora.py
, I get the message
File "/home/anaconda/envs/pytorch/lib/python3.6/site-packages/torch_scatter/utils/ext.py", line 5, in
import scatter_cuda
ModuleNotFoundError: No module named 'scatter_cuda'
I tried to clone the scatter
module from Github separately, and then run python setup.py install
on it, with same results.
I can find the scatter_cuda.py
and scatter_cpu.py
files inside the "egg" named torch_scatter-1.0.4-py3.6-linux-x86_64.egg
, and I also see the corresponding .so
files inside that egg. But no such files inside the torch_scatter
folder.
Where can I find a reference or an example for the MetaLayer?
In particular, I need to understand the parameters of forward
and the signature of the three methods node_model, edge_model, global_model
.
If someone posts a working example I can write some doc from it 😉
Hey,
I struggle a bit with building this project and the dependencies. I have a working example, but this requires some conda-hacks (sideloading a pytorch build against cuda-9.2) and gpu for graclus is not working there.
I tried several combinations of pytorch / cuda / gcc / python versions but cannot really see the pattern.
Some are working for pytorch_scatter others for pytorch_spline_conv or pytorch_cluster.
Is there any working configuration that is consistent across the full project and its siblings?
As an example: pytorch 0.4.0 (compiled against nvcc/cuda-8) with python 3.6 and a nvcc-8 and gcc-8 compiler.
It would be great if you could add this additional information (cuda, gcc versions) to the README.md.
Thanks a lot
Matthias
Note: The important thing is that gcc and cuda versions match pytorch (and python) in order to be binary compatible (ABI) with the C-extensions.
Hello,
Shouldn't the code for Data.is_directed
line be:
return not self.is_undirected()
Given that is_undirected
is not a property:
def is_undirected(self):
return is_undirected(self.edge_index, self.num_nodes)
def is_directed(self):
return not self.is_undirected
I tried to test splinecnn on my data but I'm receiving some errors:
Traceback (most recent call last):
File "test_coress.py", line 115, in <module>
data = transforms.FaceToEdge()(data)
File "build/bdist.linux-x86_64/egg/torch_geometric/transforms/face_to_edge.py", line 10, in __call__
File "build/bdist.linux-x86_64/egg/torch_geometric/utils/undirected.py", line 17, in to_undirected
File "build/bdist.linux-x86_64/egg/torch_geometric/utils/coalesce.py", line 21, in coalesce
ValueError: too many values to unpack
Here is my code, where I was reading the data and processing them:
vertices, faces, normals, nothin = read_mesh(data_path+dirs[data_size])
vertices = vertices.astype(np.float)
faces = faces.astype(np.int32)
vertices = torch.tensor(vertices, dtype=torch.float)
faces = torch.tensor(faces.T, dtype=torch.long)
data = Data(pos=vertices)
data.face = faces
**data = transforms.FaceToEdge()(data) #This is the line that is causing the error**
data.face = None
data.x = torch.ones((data.num_nodes, 1))
data = transforms.Cartesian()(data)
test_loader = DataLoader(data, batch_size=1)
can you please help with this issue ?
When I run python setup.py test
, I get figures like that:
----------- coverage: platform linux, python 3.6.5-final-0 -----------
Name Stmts Miss Cover
(tested items are enumerated)
TOTAL 3029 1247 59%
For example, I got these figures for Pooling layers:
torch_geometric/nn/pool/avg_pool.py 27 20 26%
torch_geometric/nn/pool/consecutive.py 6 0 100%
torch_geometric/nn/pool/global_pool.py 11 7 36%
torch_geometric/nn/pool/graclus.py 4 2 50%
torch_geometric/nn/pool/max_pool.py 26 19 27%
torch_geometric/nn/pool/pool.py 13 7 46%
torch_geometric/nn/pool/set2set.py 35 29 17%
torch_geometric/nn/pool/sort_pool.py 17 14 18%
torch_geometric/nn/pool/topk_pool.py 58 18 69%
torch_geometric/nn/pool/voxel_grid.py 17 13 24%
I think it's normal but it's just interesting how you measure the coverage)
AttributeError Traceback (most recent call last)
in ()
54
55 for epoch in range(1, 201):
---> 56 train()
57 log = 'Epoch: {:03d}, Train: {:.4f}, Test: {:.4f}'
58 print(log.format(epoch, *test()))
in train()
39 model.train()
40 optimizer.zero_grad()
---> 41 F.nll_loss(model()[data.train_mask], data.y[data.train_mask]).backward()
42 optimizer.step()
43
/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
489 result = self._slow_forward(*input, **kwargs)
490 else:
--> 491 result = self.forward(*input, **kwargs)
492 for hook in self._forward_hooks.values():
493 hook_result = hook(self, input, result)
in forward(self)
25 x, edge_index, edge_attr = data.x, data.edge_index, data.edge_attr
26 x = F.dropout(x, training=self.training)
---> 27 x = F.elu(self.conv1(x, edge_index, edge_attr))
28 x = F.dropout(x, training=self.training)
29 x = self.conv2(x, edge_index, edge_attr)
/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
489 result = self._slow_forward(*input, **kwargs)
490 else:
--> 491 result = self.forward(*input, **kwargs)
492 for hook in self._forward_hooks.values():
493 hook_result = hook(self, input, result)
/usr/local/lib/python3.5/dist-packages/torch_geometric/nn/conv/spline_conv.py in forward(self, x, edge_index, pseudo)
81 self._buffers['kernel_size'],
82 self._buffers['is_open_spline'], self.degree,
---> 83 self.norm, self.root, self.bias)
84
85 def repr(self):
/usr/local/lib/python3.5/dist-packages/torch_spline_conv/conv.py in apply(src, edge_index, pseudo, weight, kernel_size, is_open_spline, degree, norm, root_weight, bias)
53
54 src = src.unsqueeze(-1) if src.dim() == 1 else src
---> 55 pseudo = pseudo.unsqueeze(-1) if pseudo.dim() == 1 else pseudo
56
57 row, col = edge_index
AttributeError: 'NoneType' object has no attribute 'dim
When changing SplineConv to GCNConv everything works.
num_nods should be num_nodes
thanks for the code!
It's a brilliant work! But I have a data formation problem of heterogenous graph.
I'm not sure if pytorch_geometric can support heterogenous graph data.
Hi, I have been using the MNIST example and received the following error when I use CUDA,
Traceback (most recent call last):
File "MNIST.py", line 7, in
from torch_geometric.datasets import MNISTSuperpixels
File "/home/Drive2/shrey/shrey/venv2/local/lib/python2.7/site-packages/torch_geometric/datasets/init.py", line 1, in
from .tu_dataset import TUDataset
File "/home/Drive2/shrey/shrey/venv2/local/lib/python2.7/site-packages/torch_geometric/datasets/tu_dataset.py", line 5, in
from torch_geometric.data import InMemoryDataset, download_url, extract_zip
File "/home/Drive2/shrey/shrey/venv2/local/lib/python2.7/site-packages/torch_geometric/data/init.py", line 3, in
from .data import Data
File "/home/Drive2/shrey/shrey/venv2/local/lib/python2.7/site-packages/torch_geometric/data/data.py", line 2, in
from torch_geometric.utils import (contains_isolated_nodes,
File "/home/Drive2/shrey/shrey/venv2/local/lib/python2.7/site-packages/torch_geometric/utils/init.py", line 3, in
from .undirected import is_undirected, to_undirected
File "/home/Drive2/shrey/shrey/venv2/local/lib/python2.7/site-packages/torch_geometric/utils/undirected.py", line 2, in
from torch_sparse import coalesce
File "/home/Drive2/shrey/shrey/venv2/local/lib/python2.7/site-packages/torch_sparse/init.py", line 4, in
from .spspmm import spspmm
File "/home/Drive2/shrey/shrey/venv2/local/lib/python2.7/site-packages/torch_sparse/spspmm.py", line 7, in
import spspmm_cuda
ImportError: /home/Drive2/shrey/shrey/venv2/local/lib/python2.7/site-packages/spspmm_cuda.so: undefined symbol: cusparseDcsrgemm
Although when I set os.environ["CUDA_VISIBLE_DEVICES"]="" the problem disappears. Since the CPU implementation is too slow, can you suggest how to solve this issue?
I am using virtualenv and Pytorch 0.4.1
Thanks
Hi,
When I run infomax.py example I have the following error:
Train deep graph infomax.
Traceback (most recent call last):
File "infomax.py", line 91, in <module>
loss = train_infomax(epoch)
File "infomax.py", line 83, in train_infomax
loss = infomax(data.x, data.edge_index)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "infomax.py", line 56, in forward
positive = self.encoder(x, edge_index, corrupt=False)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "infomax.py", line 28, in forward
x = self.conv(x, edge_index)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/torch_geometric/nn/conv/gcn_conv.py", line 44, in forward
out = self.prop(out, edge_index, edge_attr)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/torch_geometric/nn/prop/gcn_prop.py", line 30, in forward
out = spmm(edge_index, edge_attr, x, num_nodes)
File "build/bdist.linux-x86_64/egg/torch_sparse/spmm.py", line 17, in spmm
AttributeError: 'int' object has no attribute 'dim'
Equation 1 shows e_ij = a(W*h_i,W*h_j)
In code you have the inputs being multiplied as X*W.
When I import convspline, I get the error
ModuleNotFoundError Traceback (most recent call last)
in ()
----> 1 from torch_geometric.nn import SplineConv
/usr/local/anaconda36/lib/python3.6/site-packages/torch_geometric-0.3.1-py3.6.egg/torch_geometric/nn/init.py in ()
----> 1 from .conv import * # noqa
2 from .prop import * # noqa
3 from .pool import * # noqa
4 from .dense import * # noqa
5 from .meta import MetaLayer
/usr/local/anaconda36/lib/python3.6/site-packages/torch_geometric-0.3.1-py3.6.egg/torch_geometric/nn/conv/init.py in ()
----> 1 from .graph_conv import GraphConv
2 from .spline_conv import SplineConv
3 from .gcn_conv import GCNConv
4 from .cheb_conv import ChebConv
5 from .nn_conv import NNConv
/usr/local/anaconda36/lib/python3.6/site-packages/torch_geometric-0.3.1-py3.6.egg/torch_geometric/nn/conv/graph_conv.py in ()
1 import torch
2 from torch.nn import Parameter
----> 3 from torch_scatter import scatter_add
4 from torch_geometric.utils import degree
5
ModuleNotFoundError: No module named 'torch_scatter'
Hi!
Thanks for this awesome tool! I am having a great time writing my custom datataset and loader for a problem at hand but just stumbled upon something that was messing my visualizations up!
Say I have graphs with x=[3,24], y=[1], pos=[2,24] and edge_index=[2,66] (in both directions so undirected). When I try to batch them in say, batches of 3 or 4 my edge indices get increased by 3 for each graph in the batch!
E.g.: if the original edges are [ [0, 1, 1, 2], [1, 0, 2, 1] ] then for the first graph in the batch they are OK but for the next batch they get increased by 3 as follows [ [3, 4, 4, 5], [4, 3, 5, 4] ]. And that messes up my visualizations since I take edge indices to find node positions.
Question is... is that intended and needed for any kind of operation I am missing when using batches? Is it a bug? Maybe I am missing something in my code but can't find it.
So far the solution is as easy as doing edge_indices - 3*i being i the graph in the batch index but...
Thank you!
Hi everyone!
I feel like, for those of us working closer to the field of Computer Graphics, it would be cool if this library also implemented the "EdgeConv" operation from this paper:
So far compilation of torch_scatter gives an error:
torch_scatter/src/generic/cpu.c: In function ‘scatter_mul_Float’:
/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THTensorDimApply.h:46:47: error: dereferencing pointer to incomplete type ‘THTensor {aka struct THTensor}’
if( (DIMENSION < 0) || (DIMENSION >= TENSOR1->_dim()) ) \
Hi,
Do you guys have any idea on how to implement an inner product decoder for architectures such as VGAE (Eq. 2) using mini-batches in torch_geometric
?
Thank you!
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.