alelab-upenn / graph-neural-networks Goto Github PK
View Code? Open in Web Editor NEWLibrary to implement graph neural networks in PyTorch
License: GNU General Public License v3.0
Library to implement graph neural networks in PyTorch
License: GNU General Public License v3.0
Tested the install via pip
per #2 and worked fine. However, working through the tutorials and noticed:
alegnn/modules/architectures.py
where incorrect module namespaces are used in evalsNameError Traceback (most recent call last)
<ipython-input-45-e62203175260> in <module>
2
3 #\\\ Architecture
----> 4 thisArchit = archit.AggregationGNN(# Linear
5 hParamsAggGNN['F'],
6 hParamsAggGNN['K'],
~/src/pytorch-learn/ENV/lib/python3.9/site-packages/alegnn/modules/architectures.py in __init__(self, dimFeatures, nFilterTaps, bias, nonlinearity, poolingFunction, poolingSize, dimLayersMLP, GSO, order, maxN, nNodes, dimLayersAggMLP)
3031 # We need to be sure that the function 'perm' + self.reorder
3032 # is available in the Utils.graphTools module.
-> 3033 self.permFunction = eval('Utils.graphTools.perm' + order)
3034 else:
3035 self.permFunction = alegnn.utils.graphTools.permIdentity
~/src/pytorch-learn/ENV/lib/python3.9/site-packages/alegnn/modules/architectures.py in <module>
NameError: name 'Utils' is not defined
#######################################
/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in getattr(self, name)
1129 return modules[name]
1130 raise AttributeError("'{}' object has no attribute '{}'".format(
-> 1131 type(self).name, name))
1132
1133 def setattr(self, name: str, value: Union[Tensor, 'Module']) -> None:
AttributeError: 'ReLU' object has no attribute 'shape'
#######################################
Hi!
The error inmediately appears when I start training a GAT or GCAT model. Not happening with LocalGNN model, which I can train and test without invonvenients.
Do you have any idea of what is causing it and how can I fix it? I'm working with recommender systems, so GAT or GCAT models are interesting to experiment with.
Thanks!
Best regards,
Andrés
Was trying to run movieGNN.py. Got the error below:
Device selected: cpu
Loading data for split 1... OK
Setting up the graph... OK
Model initialization...
Initializing SelGNNdegG00... OK
Initializing SelGNNedsG00... OK
Initializing SelGNNsprG00... OK
Initializing SelGNNcrsG00... OK
Initializing SpctrlGNNG00... /Users/Nsherv/graph-neural-networks/Utils/graphML.py:1333: ComplexWarning: Casting complex values to real discards the imaginary part
Lambda[e,:], V[e,:,:] = np.linalg.eig(Snp[e,:,:])
OK
Model initialization... COMPLETE
Process finished with exit code 137 (interrupted by signal 9: SIGKILL)
when running through the tutorial.ipynb
configuring device='mps'
as follows
if useGPU and torch.cuda.is_available():
device = 'cuda:0'
torch.cuda.empty_cache()
if useGPU and torch.backends.mps.is_available():
device = 'mps'
else:
device = 'cpu'
# Notify:
print("Device selected: %s" % device)
the cell:
thisName = hParamsAggGNN['name']
#\\\ Architecture
thisArchit = archit.AggregationGNN(# Linear
hParamsAggGNN['F'],
hParamsAggGNN['K'],
hParamsAggGNN['bias'],
# Nonlinearity
hParamsAggGNN['sigma'],
# Pooling
hParamsAggGNN['rho'],
hParamsAggGNN['alpha'],
# MLP in the end
hParamsAggGNN['dimLayersMLP'],
# Structure
G.S/np.max(np.diag(G.E)), # Normalize the adjacency matrix
order = hParamsAggGNN['order'],
maxN = hParamsAggGNN['Nmax'],
nNodes = hParamsAggGNN['nNodes'])
#\\\ Optimizer
thisOptim = optim.Adam(thisArchit.parameters(), lr = learningRate, betas = (beta1,beta2))
#\\\ Model
AggGNN = model.Model(thisArchit,
lossFunction(),
thisOptim,
trainer,
evaluator,
device,
thisName,
saveDir)
#\\\ Add model to the dictionary
modelsGNN[thisName] = AggGNN
raises the error: TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.
I believe MPS (apple M1 GPU) is not currently compatible with float64 and every tensor needs to be converted to float32. I'm wondering if an precision option could be added to the setup?
When trying to pip install the package, I get the following error:
ERROR: Command errored out with exit status 1:
command: /home/user/anaconda3/envs/mine/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tm
p/pip-req-build-wl4f41q2/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-wl4f41q2/setup.py'"'"';f=getattr(tokenize, '"'"'
open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'
"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-re0b057i
cwd: /tmp/pip-req-build-wl4f41q2/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-wl4f41q2/setup.py", line 3, in <module>
with open("../README.md", "r", encoding="utf-8") as fh:
FileNotFoundError: [Errno 2] No such file or directory: '../README.md'
----------------------------------------
WARNING: Discarding file:///home/user/graph-neural-networks. Command errored out with exit status 1: python setup.py eg
g_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
This is caused by the line 3 of setup.py.
GatedGRNN does not send all the parameters to the correct device.
graph-neural-networks/alegnn/utils/graphML.py
Line 1292 in 26c4d02
import Utils.graphML as gml
should be
import alegnn.utils..graphML as gml
etc.
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.