Comments (14)
Changing your version of networkx into 2.4 may solve this problem.
from dig.
It's still without success for this gradcam.ipynb, I think it should be more code to be added, do you have any suggestion @CM-BF ?
from dig.
In the main branch for the demos on visualization example on GradCAM , it first call benchmark.kernel.pipeline. Then I search in the pipeline.py but there is no function being called for visualize_graph in the class ExplainerBase in explainers.py. Could you give me some enlightment, how this visualization for this demos work?
The other issue with the demos. As I try to run python -m benchmark.kernel.pipeline --task explain --model_name GCN_3l --dataset_name tox21 --target_idx 2 --explainer GradCAM --sparsity 0.5 --debug --vis --nolabel
. It gives me this
RuntimeError:
DEBUG: 11/04/2021 09:15:58 PM : Parse arguments.
INFO: -----------------------------------
Task: explain
Thu Nov 4 21:15:58 2021
INFO: Load Dataset tox21
DEBUG: 11/04/2021 09:15:58 PM : Data(x=[11, 9], edge_index=[2, 22], edge_attr=[22, 3], y=[1], smiles='CCCc1ccc(OC)cc1')
INFO: Loading model...
INFO: GCN_3l(
(conv1): GCNConv(9, 300)
(convs): ModuleList(
(0): GCNConv(300, 300)
(1): GCNConv(300, 300)
)
(relu1): ReLU()
(relus): ModuleList(
(0): ReLU()
(1): ReLU()
)
(readout): GlobalMeanPool()
(ffn): Sequential(
(0): Linear(in_features=300, out_features=300, bias=True)
(1): ReLU()
(2): Dropout(p=0.5, inplace=False)
(3): Linear(in_features=300, out_features=2, bias=True)
)
(dropout): Dropout(p=0.5, inplace=False)
)
INFO: Config the model used to be explained...
'data.DataLoader' is deprecated, use 'loader.DataLoader' instead
Traceback (most recent call last):
File "/home/bd738126/anaconda3/envs/xgraph/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/bd738126/anaconda3/envs/xgraph/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/rwthfs/rz/cluster/home/bd738126/Downloads/DIG/main/dig/xgraph/GradCAM/benchmark/kernel/pipeline.py", line 64, in
config_model(model, args['explain'], 'explain')
File "/rwthfs/rz/cluster/home/bd738126/Downloads/DIG/main/dig/xgraph/GradCAM/benchmark/models/model_manager.py", line 47, in config_model
model.load_state_dict(ckpt['state_dict'])
File "/home/bd738126/anaconda3/envs/xgraph/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1044, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for GCN_3l:
Missing key(s) in state_dict: "conv1.lin.weight", "convs.0.lin.weight", "convs.1.lin.weight".
Unexpected key(s) in state_dict: "conv1.weight", "convs.0.weight", "convs.1.weight".
Any help would be appreciated 😊
from dig.
Hi @boma-dirgantara,
For the second issue, you may refer to this issue for a solution. Thank you.
from dig.
Thanks @mengliu1998 for the respons,
I have already see the issue #54, but unfortunately the same error also accurs when I use torch_geometric==1.6.0 on a cuda10.2 system, that's ModuleNotFoundError: No module named 'torch_geometric.data.storage'. As I search on the torch_geometric, isn't torch_geometric.data.storage only on torch-geometric up version 2.0.0?
This is the list of my package:
Name Version Build Channel
_libgcc_mutex 0.1 main
_openmp_mutex 4.5 1_gnu
ase 3.22.0 pypi_0 pypi
backcall 0.2.0 pypi_0 pypi
blas 1.0 mkl
boost 1.74.0 py38hc10631b_3 conda-forge
boost-cpp 1.74.0 h9359b55_0 conda-forge
bzip2 1.0.8 h7f98852_4 conda-forge
ca-certificates 2021.10.8 ha878542_0 conda-forge
cairo 1.16.0 h3fc0475_1005 conda-forge
captum 0.2.0 pypi_0 pypi
certifi 2021.10.8 py38h578d9bd_1 conda-forge
charset-normalizer 2.0.7 pypi_0 pypi
cilog 1.2.2 pypi_0 pypi
cloudpickle 2.0.0 pypi_0 pypi
cudatoolkit 10.2.89 hfd86e86_1
cycler 0.11.0 pyhd8ed1ab_0 conda-forge
decorator 5.1.0 pypi_0 pypi
et-xmlfile 1.1.0 pypi_0 pypi
fontconfig 2.13.1 hba837de_1005 conda-forge
freetype 2.11.0 h70c0345_0
future 0.18.2 pypi_0 pypi
giflib 5.2.1 h7b6447c_0
glib 2.69.1 h5202010_0
googledrivedownloader 0.4 pypi_0 pypi
h5py 3.5.0 pypi_0 pypi
icu 67.1 he1b5a44_0 conda-forge
idna 3.3 pypi_0 pypi
intel-openmp 2021.4.0 h06a4308_3561
ipython 7.29.0 pypi_0 pypi
isodate 0.6.0 pypi_0 pypi
jedi 0.18.0 pypi_0 pypi
joblib 1.1.0 pypi_0 pypi
jpeg 9d h7f8727e_0
kiwisolver 1.3.2 pypi_0 pypi
lcms2 2.12 h3be6417_0
ld_impl_linux-64 2.35.1 h7274673_9
libffi 3.3 he6710b0_2
libgcc-ng 9.3.0 h5101ec6_17
libgomp 9.3.0 h5101ec6_17
libiconv 1.16 h516909a_0 conda-forge
libpng 1.6.37 hbc83047_0
libstdcxx-ng 9.3.0 hd4cf53a_17
libtiff 4.2.0 h85742a9_0
libuuid 2.32.1 h7f98852_1000 conda-forge
libwebp 1.2.0 h89dd481_0
libwebp-base 1.2.0 h27cfd23_0
libxcb 1.13 h7f98852_1003 conda-forge
libxml2 2.9.10 h68273f3_2 conda-forge
llvmlite 0.37.0 pypi_0 pypi
lz4-c 1.9.3 h295c915_1
matplotlib 3.4.3 pypi_0 pypi
matplotlib-base 3.3.4 py38h0efea84_0 conda-forge
matplotlib-inline 0.1.3 pypi_0 pypi
mkl 2021.4.0 h06a4308_640
mkl-service 2.4.0 py38h7f8727e_0
mkl_fft 1.3.1 py38hd3c417c_0
mkl_random 1.2.2 py38h51133e4_0
mypy-extensions 0.4.3 pypi_0 pypi
ncurses 6.3 heee7806_1
networkx 2.6.3 pypi_0 pypi
ninja 1.10.2 hff7bd54_1
numba 0.54.1 pypi_0 pypi
numpy 1.20.3 pypi_0 pypi
olefile 0.46 pyhd3eb1b0_0
openpyxl 3.0.9 pypi_0 pypi
openssl 1.1.1l h7f8727e_0
packaging 21.2 pypi_0 pypi
pandas 1.3.0 pypi_0 pypi
parso 0.8.2 pypi_0 pypi
pcre 8.45 h9c3ff4c_0 conda-forge
pexpect 4.8.0 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pillow 8.4.0 py38h5aabda8_0
pip 21.2.4 py38h06a4308_0
pixman 0.38.0 h516909a_1003 conda-forge
plyfile 0.7.4 pypi_0 pypi
prompt-toolkit 3.0.22 pypi_0 pypi
pthread-stubs 0.4 h36c2ea0_1001 conda-forge
ptyprocess 0.7.0 pypi_0 pypi
pycairo 1.20.1 py38hf61ee4a_0 conda-forge
pygments 2.10.0 pypi_0 pypi
pyparsing 2.4.7 pypi_0 pypi
python 3.8.12 h12debd9_0
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python-louvain 0.15 pypi_0 pypi
python_abi 3.8 2_cp38 conda-forge
pytorch 1.6.0 py3.8_cuda10.2.89_cudnn7.6.5_0 pytorch
pytz 2021.3 pyhd8ed1ab_0 conda-forge
pyyaml 6.0 pypi_0 pypi
rdflib 6.0.2 pypi_0 pypi
rdkit 2020.09.5 py38h2bca085_0 conda-forge
readline 8.1 h27cfd23_0
reportlab 3.5.68 py38hadf75a6_0 conda-forge
requests 2.26.0 pypi_0 pypi
scikit-learn 1.0.1 pypi_0 pypi
scipy 1.7.2 pypi_0 pypi
setuptools 58.0.4 py38h06a4308_0
shap 0.40.0 pypi_0 pypi
six 1.16.0 pyhd3eb1b0_0
slicer 0.0.7 pypi_0 pypi
sqlalchemy 1.3.23 py38h497a2fe_0 conda-forge
sqlite 3.36.0 hc218d9a_0
tabulate 0.8.9 pypi_0 pypi
threadpoolctl 3.0.0 pypi_0 pypi
tk 8.6.11 h1ccaba5_0
torch-cluster 1.5.9 pypi_0 pypi
torch-geometric 1.6.0 pypi_0 pypi
torch-scatter 2.0.6 pypi_0 pypi
torch-sparse 0.6.9 pypi_0 pypi
torch-spline-conv 1.2.1 pypi_0 pypi
torchvision 0.7.0 py38_cu102 pytorch
tornado 6.1 py38h497a2fe_1 conda-forge
tqdm 4.62.3 pypi_0 pypi
traitlets 5.1.1 pypi_0 pypi
typed-argument-parser 1.5.4 pypi_0 pypi
typing-extensions 3.10.0.2 pypi_0 pypi
typing-inspect 0.7.1 pypi_0 pypi
urllib3 1.26.7 pypi_0 pypi
wcwidth 0.2.5 pypi_0 pypi
wheel 0.37.0 pyhd3eb1b0_1
xorg-kbproto 1.0.7 h7f98852_1002 conda-forge
xorg-libice 1.0.10 h7f98852_0 conda-forge
xorg-libsm 1.2.3 hd9c2040_1000 conda-forge
xorg-libx11 1.7.2 h7f98852_0 conda-forge
xorg-libxau 1.0.9 h7f98852_0 conda-forge
xorg-libxdmcp 1.1.3 h7f98852_0 conda-forge
xorg-libxext 1.3.4 h7f98852_1 conda-forge
xorg-libxrender 0.9.10 h7f98852_1003 conda-forge
xorg-renderproto 0.11.1 h7f98852_1002 conda-forge
xorg-xextproto 7.3.0 h7f98852_1002 conda-forge
xorg-xproto 7.0.31 h7f98852_1007 conda-forge
xz 5.2.5 h7b6447c_0
yacs 0.1.8 pypi_0 pypi
zlib 1.2.11 h7b6447c_3
zstd 1.4.9 haebb681_0
from dig.
Hello, could you please provide the Traceback for the error ModuleNotFoundError: No module named 'torch_geometric.data.storage'.
?
from dig.
Yes, sure
DEBUG: 11/09/2021 06:16:36 PM : Parse arguments.
INFO: -----------------------------------
Task: explain
Tue Nov 9 18:16:36 2021
INFO: Load Dataset tox21
ERROR: 11/09/2021 06:16:36 PM - utils.py - line 87 : Traceback (most recent call last):
File "/home/bd738126/anaconda3/envs/xgraph/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/bd738126/anaconda3/envs/xgraph/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/rwthfs/rz/cluster/home/bd738126/Downloads/DIG/main/dig/xgraph/GradCAM/benchmark/kernel/pipeline.py", line 37, in
dataset = load_dataset(args['common'].dataset_name)
File "/rwthfs/rz/cluster/home/bd738126/Downloads/DIG/main/dig/xgraph/GradCAM/benchmark/data/dataset.py", line 45, in load_dataset
dataset = MoleculeNet(root=os.path.abspath(os.path.join(ROOT_DIR, '..', 'datasets')), name=name)
File "/home/bd738126/anaconda3/envs/xgraph/lib/python3.8/site-packages/torch_geometric/datasets/molecule_net.py", line 127, in init
self.data, self.slices = torch.load(self.processed_paths[0])
File "/home/bd738126/anaconda3/envs/xgraph/lib/python3.8/site-packages/torch/serialization.py", line 584, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "/home/bd738126/anaconda3/envs/xgraph/lib/python3.8/site-packages/torch/serialization.py", line 842, in _load
result = unpickler.load()
ModuleNotFoundError: No module named 'torch_geometric.data.storage'
from dig.
How about removing the processed data under the folder {dataset_name}/processed
?
from dig.
Yes it works now, thanks
could you maybe tell me how the visualization works? so that I can implement this on gradcam.ipynb
from dig.
It seems like your networkx is 2.6.3 through your package list. How about trying version 2.4?
from dig.
Yes, I have just change it into networkx==2.4 and for the visualization of gradcam in main branch works already. I just don't know how to visualize it on gradcam.ipynb. Is it true by adding this code, it will works? :
from dig.xgraph.method.base_explainer import ExplainerBase
explainer_base = ExplainerBase(model)
visualize_graph = explainer_base.visualize_graph(node_idx=5, edge_index=data.edge_index, edge_mask=masks[0], nolabel=True)
from dig.
@CM-BF Any opinion about the visualization code?
from dig.
You should call explainer.visualize_graph
.
I provide the following example for reference:
ax, G = explainer.visualize_graph(node_idx=0 if node_idx is None else node_idx, edge_index=data.edge_index,
edge_mask=masks[target_label],
y=data.x[:, 0] if node_idx is None else data.y, num_nodes=data.x.shape[0],
data=data)
plt.show()
node_idx is just for node classification.
y is used as the color reference. For node classification, it is the node's class. For a molecule graph, it is the atomic number.
We will update examples.
from dig.
Okay, many thanks for the hint @CM-BF, I will try again to understand more about the code and compare with the updated examples.
from dig.
Related Issues (20)
- TypeError: add_param_group() missing 1 required positional argument: 'param_group'
- Error on tutorial for graph generation HOT 2
- Codes and scripts for ProNet HOT 1
- Why it is allowed to have overlap between traning and valid & test sensitive labels in Graphair? HOT 1
- when running s-mixup in DIG,we found the diffrernt results with the paper published inICML and the difference is large ,why? HOT 7
- xgraph
- Question about spherenet HOT 1
- Questions about the ComENet HOT 5
- Adding a new node feature to a Spherenet model HOT 2
- Uploading my own dataset
- Code HOT 3
- Reconstruction loss hyperparameter HOT 1
- edge_mask=gnnexplainer_related_preds[1][prediction], NameError: name 'prediction' is not defined HOT 2
- TypeError: draw_networkx_nodes() got an unexpected keyword argument 'with_labels' HOT 4
- 'GNNExplainer' object has no attribute 'node_idx' with BA_shapes
- expired url
- Unable to install DIG on windows due to pyscf
- ProNet scripts
- Why the projector(fc1 and fc2) in graphfair don't have optimizer?How to optimize their parameters?
- Maybe ComENet is not structure invariant? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dig.