THUMNLab / AutoGL

An autoML framework & toolkit for machine learning on graphs.
http://mn.cs.tsinghua.edu.cn/AutoGL/
Apache License 2.0
1.09k stars 119 forks source link

[BUG] AttributeError: 'DGLHeteroGraph' object has no attribute 'size' #96

Closed defineZYP closed 1 year ago

defineZYP commented 2 years ago

Describe the bug When running /autogl/test/nas/node_classification.py with AUTOGL_BACKEND=dgl, I got the following error.

Traceback (most recent call last):
  File "node_classification.py", line 116, in <module>
    model = algo.search(space, dataset, esti)
  File "/villa/zhangyp/anaconda3/envs/graproj/lib/python3.7/site-packages/autogl-0.3.0rc0-py3.7.egg/autogl/module/nas/algorithm/random_search.py", line 69, in search
    metric, loss, hardware_metric = self._infer(mask="val")
  File "/villa/zhangyp/anaconda3/envs/graproj/lib/python3.7/site-packages/autogl-0.3.0rc0-py3.7.egg/autogl/module/nas/algorithm/random_search.py", line 86, in _infer
    metric, loss = self.estimator.infer(self.arch._model, self.dataset, mask=mask)
  File "/villa/zhangyp/anaconda3/envs/graproj/lib/python3.7/site-packages/autogl-0.3.0rc0-py3.7.egg/autogl/module/nas/estimator/one_shot.py", line 35, in infer
    pred = model(dset)[mask]
  File "/villa/zhangyp/anaconda3/envs/graproj/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/villa/zhangyp/anaconda3/envs/graproj/lib/python3.7/site-packages/autogl-0.3.0rc0-py3.7.egg/autogl/module/nas/space/autoattend.py", line 202, in forward
    stem_out = bk_gconv(op, data, drop(input))
  File "/villa/zhangyp/anaconda3/envs/graproj/lib/python3.7/site-packages/autogl-0.3.0rc0-py3.7.egg/autogl/module/nas/backend.py", line 16, in bk_gconv
    return op(data,feat)
  File "/villa/zhangyp/anaconda3/envs/graproj/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/villa/zhangyp/anaconda3/envs/graproj/lib/python3.7/site-packages/torch_geometric/nn/conv/arma_conv.py", line 110, in forward
    edge_index, edge_weight, x.size(self.node_dim),
AttributeError: 'DGLHeteroGraph' object has no attribute 'size'

It happens in 'random + autoattend' stage、 'rl + autoattend' stage and 'darts + graphnas' stage.

To Reproduce Steps to reproduce the behavior:

  1. Go to '/AutoGL/autogl/test/nas/'
  2. export AUTOGL_BACKEND=dgl
  3. python node_classification.py
  4. See error

Environment (please complete the following information):

Additional Info As I can run this file with AUTOGL_BACKEND=pyg correctly, it may be caused by the mixed use of pyg method and dgl dataset.

general502570 commented 1 year ago

Sorry for late response. Now AutoAttend only supports pyg backend, we have raised an error now. Besides, we find darts + graphnas setting is ok, please check.