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

Receiving a IndexError when executing example.sh #41

Open
ChunhuaLab opened this issue Aug 14, 2023 · 1 comment
Open

Receiving a IndexError when executing example.sh #41

ChunhuaLab opened this issue Aug 14, 2023 · 1 comment

Comments

@ChunhuaLab
Copy link

I was trying to run the file example.sh. The first command runs fine, but it throws an exception on the second one:

$ python -m train --bmname=ENZYMES --assign-ratio=0.1 --hidden-dim=30 --output-dim=30 --cuda=1 --num-classes=6 --method=soft-assign

The output is as follows. Any idea what is going on? Given that I haven't changed anything, maybe the version of packages are different?

CUDA 1 Using node labels Num training graphs: 540 ; Num validation graphs: 60 Number of graphs: 600 Number of edges: 37282 Max, avg, std of graph size: 125 , 32.46 , 14.87 Method: soft-assign /home/sunxiaohan/paper2/diffpool-master/encoders.py:71: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_. m.weight.data = init.xavier_uniform(m.weight.data, gain=nn.init.calculate_gain('relu')) /home/sunxiaohan/paper2/diffpool-master/encoders.py:73: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_. m.bias.data = init.constant(m.bias.data, 0.0) /home/sunxiaohan/paper2/diffpool-master/encoders.py:293: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_ . m.weight.data = init.xavier_uniform(m.weight.data, gain=nn.init.calculate_gain('relu')) /home/sunxiaohan/paper2/diffpool-master/encoders.py:295: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_. m.bias.data = init.constant(m.bias.data, 0.0) Epoch: 0 Traceback (most recent call last): File "/home/sunxiaohan/anaconda3/envs/pep/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/sunxiaohan/anaconda3/envs/pep/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/sunxiaohan/paper2/diffpool-master/train.py", line 652, in <module> main() File "/home/sunxiaohan/paper2/diffpool-master/train.py", line 640, in main benchmark_task_val(prog_args, writer=writer) File "/home/sunxiaohan/paper2/diffpool-master/train.py", line 519, in benchmark_task_val _, val_accs = train(train_dataset, model, args, val_dataset=val_dataset, test_dataset=None, File "/home/sunxiaohan/paper2/diffpool-master/train.py", line 199, in train for batch_idx, data in enumerate(dataset): File "/home/sunxiaohan/anaconda3/envs/pep/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 652, in __next__ data = self._next_data() File "/home/sunxiaohan/anaconda3/envs/pep/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1347, in _next_data return self._process_data(data) File "/home/sunxiaohan/anaconda3/envs/pep/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1373, in _process_data data.reraise() File "/home/sunxiaohan/anaconda3/envs/pep/lib/python3.8/site-packages/torch/_utils.py", line 461, in reraise raise exception IndexError: Caught IndexError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/sunxiaohan/anaconda3/envs/pep/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop data = fetcher.fetch(index) File "/home/sunxiaohan/anaconda3/envs/pep/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/sunxiaohan/anaconda3/envs/pep/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/sunxiaohan/paper2/diffpool-master/graph_sampler.py", line 101, in __getitem__ num_nodes = adj.shape[0] IndexError: tuple index out of range

@chumingqian
Copy link

Hi, @ChunhuaLab :
I faced the same problem, then i used this, and it's worked;

        for G in G_list:
            #adj = np.array(nx.to_numpy_matrix(G))
            adj = np.array(nx.to_numpy_array(G))

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

2 participants