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

error in HetGNN_sampler.py #64

Closed
Kingrd97 opened this issue Jan 4, 2022 · 10 comments
Closed

error in HetGNN_sampler.py #64

Kingrd97 opened this issue Jan 4, 2022 · 10 comments

Comments

@Kingrd97
Copy link

Kingrd97 commented Jan 4, 2022

line 168, in assign_features_to_blocks
assign_simple_node_features(blocks[0].srcdata, g, ntypes)
AttributeError: 'dict' object has no attribute 'srcdata'

@Kingrd97
Copy link
Author

Kingrd97 commented Jan 4, 2022

seems the academic4HetGNN dataset and hetgnn_sampler.py does not match

@Theheavens
Copy link
Member

Could you show more information, about errors and which experiments you run?

@Kingrd97
Copy link
Author

Kingrd97 commented Jan 5, 2022

The environment is installed according to the steps in README,CPU version of Pytorch & DGL

python main.py -m HetGNN -t node_classification -d academic4HetGNN -g -1

Traceback (most recent call last):
File "main.py", line 28, in
OpenHGNN(args=config)
File "/home/openhgnn/OpenHGNN/openhgnn/start.py", line 19, in OpenHGNN
result = flow.train()
File "/home/openhgnn/OpenHGNN/openhgnn/trainerflow/hetgnn_trainer.py", line 60, in train
loss = self._mini_train_step()
File "/home/openhgnn/OpenHGNN/openhgnn/trainerflow/hetgnn_trainer.py", line 86, in _mini_train_step
positive_graph, negative_graph, blocks = next(self.dataloader_it)
File "/home/openhgnn/anaconda3/envs/OpenHGNN/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 517, in next
data = self._next_data()
File "/home/openhgnn/anaconda3/envs/OpenHGNN/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1199, in _next_data
return self._process_data(data)
File "/home/openhgnn/anaconda3/envs/OpenHGNN/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1225, in _process_data
data.reraise()
File "/home/openhgnn/anaconda3/envs/OpenHGNN/lib/python3.7/site-packages/torch/_utils.py", line 429, in reraise
raise self.exc_type(msg)
AttributeError: Caught AttributeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/openhgnn/anaconda3/envs/OpenHGNN/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop
data = fetcher.fetch(index)
File "/home/openhgnn/anaconda3/envs/OpenHGNN/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 35, in fetch
return self.collate_fn(data)
File "/home/openhgnn/OpenHGNN/openhgnn/sampler/HetGNN_sampler.py", line 186, in collate_train
assign_features_to_blocks(blocks, self.g, self.g.ntypes)
File "/home/openhgnn/OpenHGNN/openhgnn/sampler/HetGNN_sampler.py", line 168, in assign_features_to_blocks
assign_simple_node_features(blocks[0].srcdata, g, ntypes)
AttributeError: 'dict' object has no attribute 'srcdata'

@Theheavens
Copy link
Member

I'm not sure that whether you use the latest codes. You can try to clone the openhgnn again.

@Kingrd97
Copy link
Author

Kingrd97 commented Jan 6, 2022

I've pulled on the main branch. It's the latest

@Theheavens
Copy link
Member

Does this error still exist? We have tested it without any errors.

@Kingrd97
Copy link
Author

Kingrd97 commented Jan 6, 2022

Yes, similar error occurs when runing "python main.py -m HeCo -d acm4HeCo -t node_classification -g -1".
Other models seems work well

File "/home/openhgnn/OpenHGNN/openhgnn/models/HeCo.py", line 58, in build_model_from_args
if args.meta_paths is None:
AttributeError: 'Config' object has no attribute 'meta_paths'

after I fixed it, there are still some problems following

File "/home/openhgnn/OpenHGNN/openhgnn/trainerflow/HeCo_trainer.py", line 48, in preprocess
self.preprocess_feature()
AttributeError: 'HeCoTrainer' object has no attribute 'preprocess_feature'

This func hasn't been realized yet?

@Theheavens
Copy link
Member

Sorry, it's a bug. I fixed it right now.

@Kingrd97
Copy link
Author

Kingrd97 commented Jan 9, 2022

Hope you can check the data of HetGNN. There is always AttributeError with dataloader no matter which version of torch is used

@Theheavens
Copy link
Member

We check the AttributeError you mentioned. It is an error raised by the API modification of DGL with the nightly build version.
We will check the new API and fix the bug. Before that, we recommend that uninstall the dgl of nightly build version and install the stable version.
Run this to install:
conda install -c dglteam dgl-cuda10.1 or pip install dgl-cu101 -f https://data.dgl.ai/wheels/repo.html.

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