divelab / DIG

A library for graph deep learning research
https://diveintographs.readthedocs.io/
GNU General Public License v3.0
1.82k stars 281 forks source link

running the code example in Tutorial for GNN Explainability; error: ModuleNotFoundError: No module named 'dig.xgraph.utils.compatibility' #169

Open Oliver-0423 opened 1 year ago

Oliver-0423 commented 1 year ago

torch 1.10.1 torch_geometric 2.1.0 dig 0.1.2

YANI-ALT commented 1 year ago

Hello,

Thank you for such a wonderful library ! I too am facing the same issue when trying to import from dig.xgraph.utils.compatibility Any way to fix this ?

Oliver-0423 commented 1 year ago

another bug: running: result = find_closest_node_result(explanation_results[prediction], max_nodes=max_nodes)

error: AttributeError: 'dict' object has no attribute 'coalition'

Has anyone run this tutorial successfully?

Oliver-0423 commented 1 year ago

@YANI-ALT download from git , don't use pip install dive-into-graphs,

Oliver-0423 commented 1 year ago

@YANI-ALT better don't use windows, This project is very Windows unfriendly

yhliu2022 commented 1 year ago

I tried to install through git: git clone https://github.com/divelab/DIG.git cd DIG pip install .

but got the following error:

Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [10 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\yhl20\AppData\Local\Temp\pip-install-69uiodic\pyscf_b8c62cba3e4e4704af415c5acfeb55a5\setup.py", line 206, in blas_path_guess = [search_lib_path('lib'+x+so_ext, blas_lib_dir) File "C:\Users\yhl20\AppData\Local\Temp\pip-install-69uiodic\pyscf_b8c62cba3e4e4704af415c5acfeb55a5\setup.py", line 206, in blas_path_guess = [search_lib_path('lib'+x+so_ext, blas_lib_dir) File "C:\Users\yhl20\AppData\Local\Temp\pip-install-69uiodic\pyscf_b8c62cba3e4e4704af415c5acfeb55a5\setup.py", line 148, in search_lib_path paths = os.environ.get(LD_LIBRARY_PATH, '').split(os.pathsep) NameError: name 'LD_LIBRARY_PATH' is not defined [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

timondesch commented 1 year ago

I had the same error importing compatible_state_dict from dig.xgraph.utils.compatibility. It seems to be a compatibility issue, and I fixed it by downgrading my python version to 3.7 (from 3.10.8).

However, I am still having the same error as @Oliver-0423 describes:

another bug: running: result = find_closest_node_result(explanation_results[prediction], max_nodes=max_nodes)

error: AttributeError: 'dict' object has no attribute 'coalition'

It seems to me that there are a few issues with this tutorial, starting with the fact that the version on readthedocs is not up to date with the latest one on github.

From the Github version, here are the problems I noted:

Additionally for the quantitative explanation part, the related_preds consist of {'masked', 'maskout', 'origin', 'sparsity'}, and I'm not sure how the fidelity metric is derived from those in the tutorial. I get the same value for the sparsity, but calculating the fidelity+ or fidelity- metrics (presented in https://arxiv.org/abs/2012.15445) gives me very different results from the .1384 of the tutorial.

I'm new to the library and unsure about my conclusions, would it be possible to have a confirmation from @Oceanusity, @CM-BF or maybe @mengliu1998 (sorry for the ping) ? If confirmed, I can fix those issues and submit a PR.

frankwxu commented 1 year ago

same problem.

CM-BF commented 1 year ago

This compatibility module is only available on dig-stable branch. For different dig, you may refer to the different tutorials. If you are unsure about the version you are using, I would recommend using the examples in /examples/xgraph/ to start. The examples and the code are one-to-one corresponding.

citceae commented 5 months ago

another bug: running: result = find_closest_node_result(explanation_results[prediction], max_nodes=max_nodes)

error: AttributeError: 'dict' object has no attribute 'coalition'

Has anyone run this tutorial successfully?

It can be repaired by adding the following code at the beginning of the function find_closest_node_result in .../dig/xgraph/method/subgraphx.py

if isinstance(results[0], dict):
        results = [MCTSNode(device='cpu').load_info(node_info) for node_info in results]

It looks like the example code mixes list of MCTSNode and list of dict.

ZhongLIFR commented 4 months ago

I also had the problem AttributeError: 'dict' object has no attribute 'coalition'