Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'GNNExplainer' object has no attribute 'node_idx' with BA_shapes #243

Open
scottdd204 opened this issue Apr 12, 2024 · 0 comments
Open

'GNNExplainer' object has no attribute 'node_idx' with BA_shapes #243

scottdd204 opened this issue Apr 12, 2024 · 0 comments

Comments

@scottdd204
Copy link

I have tried working back through the problem but more issues crop up, this is only the case with BA_shapes @Oceanusity

~/DIG$ DATASETS=ba_shapes

~/DIG$ HYDRA_FULL_ERROR=1 python -m benchmarks.xgraph.gnn_explainer datasets=$DATASETS explainers=gnn_explainer record_filename=/home/scott/DIG/benchmarks/xgraph/results/GNNExplainer
/home/scott/DIG/benchmarks/xgraph/gnn_explainer.py:18: UserWarning:
The version_base parameter is not specified.
Please specify a compatability version level, or None.
Will assume defaults for version 1.1
@hydra.main(config_path="config", config_name="config")
/home/scott/.local/lib/python3.8/site-packages/hydra/_internal/defaults_list.py:251: UserWarning: In 'config': Defaults list is missing _self_. See https://hydra.cc/docs/1.2/upgrades/1.0_to_1.1/default_composition_order for more information
warnings.warn(msg, UserWarning)
/home/scott/.local/lib/python3.8/site-packages/hydra/_internal/hydra.py:119: UserWarning: Future Hydra versions will no longer change working directory at job runtime by default.
See https://hydra.cc/docs/1.2/upgrades/1.1_to_1.2/changes_to_job_working_dir/ for more information.
ret = run_job(
models:
gnn_saving_dir: /home/scott/DIG/benchmarks/xgraph/checkpoints
gnn_name: gcn
param:
learning_rate: 0.05
weight_decay: 0.0005
milestones: None
gamma: None
batch_size: 1
num_epochs: 400
num_early_stop: 0
gnn_latent_dim:
- 20
- 20
- 20
gnn_dropout: 0.0
add_self_loop: false
gcn_adj_normalization: false
gnn_emb_normalization: false
graph_classification: false
node_classification: true
gnn_nonlinear: relu
readout: identity
fc_latent_dim: []
fc_dropout: 0.0
fc_nonlinear: relu
concate: false
datasets:
dataset_root: /home/scott/DIG/benchmarks/xgraph/datasets
dataset_name: ba_shapes
explainers:
explanation_result_dir: /home/scott/DIG/benchmarks/xgraph/results
sparsity: 0.5
param:
lr: 0.01
epochs: 100
coff_size: 0.1
coff_ent: 0.1
random_seed: 0
device_id: 0
record_filename: /home/scott/DIG/benchmarks/xgraph/result_jsons/ba_shapes.json

/home/scott/miniconda3/envs/DIG/lib/python3.8/site-packages/torch_geometric/data/in_memory_dataset.py:300: UserWarning: It is not recommended to directly access the internal storage format data of an 'InMemoryDataset'. If you are absolutely certain what you are doing, access the internal storage via InMemoryDataset._data instead to suppress this warning. Alternatively, you can access stacked individual attributes of every graph via dataset.{attr_name}.
warnings.warn(msg)
Error executing job with overrides: ['datasets=ba_shapes', 'explainers=gnn_explainer', 'record_filename=/home/scott/DIG/benchmarks/xgraph/results/GNNExplainer', 'explainers=gnn_explainer', 'datasets.dataset_root=/home/scott/DIG/benchmarks/xgraph/datasets', 'models.gnn_saving_dir=/home/scott/DIG/benchmarks/xgraph/checkpoints', 'explainers.explanation_result_dir=/home/scott/DIG/benchmarks/xgraph/results', 'record_filename=/home/scott/DIG/benchmarks/xgraph/result_jsons']
Traceback (most recent call last):
File "/home/scott/miniconda3/envs/DIG/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/scott/miniconda3/envs/DIG/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/scott/DIG/benchmarks/xgraph/gnn_explainer.py", line 216, in
pipeline()
File "/home/scott/.local/lib/python3.8/site-packages/hydra/main.py", line 94, in decorated_main
_run_hydra(
File "/home/scott/.local/lib/python3.8/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra
_run_app(
File "/home/scott/.local/lib/python3.8/site-packages/hydra/_internal/utils.py", line 457, in _run_app
run_and_report(
File "/home/scott/.local/lib/python3.8/site-packages/hydra/_internal/utils.py", line 223, in run_and_report
raise ex
File "/home/scott/.local/lib/python3.8/site-packages/hydra/_internal/utils.py", line 220, in run_and_report
return func()
File "/home/scott/.local/lib/python3.8/site-packages/hydra/_internal/utils.py", line 458, in
lambda: hydra.run(
File "/home/scott/.local/lib/python3.8/site-packages/hydra/_internal/hydra.py", line 132, in run
_ = ret.return_value
File "/home/scott/.local/lib/python3.8/site-packages/hydra/core/utils.py", line 260, in return_value
raise self._return_value
File "/home/scott/.local/lib/python3.8/site-packages/hydra/core/utils.py", line 186, in run_job
ret.return_value = task_function(task_cfg)
File "/home/scott/DIG/benchmarks/xgraph/gnn_explainer.py", line 138, in pipeline
gnn_explainer(data.x, data.edge_index,
File "/home/scott/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/scott/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/home/scott/DIG/dig/xgraph/method/gnnexplainer.py", line 159, in forward
edge_mask = self.gnn_explainer_alg(x, edge_index, ex_label).sigmoid()
File "/home/scott/DIG/dig/xgraph/method/gnnexplainer.py", line 96, in gnn_explainer_alg
loss = self.loss(raw_preds, ex_label)
File "/home/scott/DIG/dig/xgraph/method/gnnexplainer.py", line 58, in loss
loss = cross_entropy_with_logit(raw_preds[self.node_idx].reshape(1, -1), x_label)
File "/home/scott/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1688, in getattr
raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'")
AttributeError: 'GNNExplainer' object has no attribute 'node_idx'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant