BUPT-GAMMA / OpenHGNN

This is an open-source toolkit for Heterogeneous Graph Neural Network(OpenHGNN) based on DGL.
Apache License 2.0
848 stars 142 forks source link

Error when running GTN&fastGTN #101

Closed huihuijiangqiang closed 2 years ago

huihuijiangqiang commented 2 years ago

Thank you very much for being able to provide this tool. I get an error when I run fastGTN using:

python main.py -m fastGTN -t node_classification -d acm4GTN -g 0 --use_best_config

The error is as follows:

Traceback (most recent call last): File "D:/github/OpenHGNN/main.py", line 30, in OpenHGNN(args=config) File "D:\github\OpenHGNN\openhgnn\start.py", line 19, in OpenHGNN result = flow.train() File "D:\github\OpenHGNN\openhgnn\trainerflow\node_classification.py", line 112, in train train_loss = self._full_train_step() File "D:\github\OpenHGNN\openhgnn\trainerflow\node_classification.py", line 152, in _full_train_step logits = self.model(self.hg, h_dict)[self.category] File "D:\Program Files (x86)\anaconda\envs\OpenHGNN\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl return forward_call(*input, *kwargs) File "D:\github\OpenHGNN\openhgnn\models\fastGTN.py", line 119, in forward hat_A = self.layersi File "D:\Program Files (x86)\anaconda\envs\OpenHGNN\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl return forward_call(input, *kwargs) File "D:\github\OpenHGNN\openhgnn\models\fastGTN.py", line 180, in forward sum_g = dgl.adj_sum_graph(A, 'w_sum') File "D:\Program Files (x86)\anaconda\envs\OpenHGNN\lib\site-packages\dgl\transforms\functional.py", line 2766, in adj_sum_graph C_gidx, C_weights = F.csrsum(gidxs, weights) File "D:\Program Files (x86)\anaconda\envs\OpenHGNN\lib\site-packages\dgl\backend\pytorch\sparse.py", line 817, in csrsum nrows, ncols, C_indptr, C_indices, C_eids, C_weights = CSRSum.apply(gidxs, weights) File "D:\Program Files (x86)\anaconda\envs\OpenHGNN\lib\site-packages\dgl\backend\pytorch\sparse.py", line 668, in forward gidxC, C_weights = _csrsum(gidxs, weights) File "D:\Program Files (x86)\anaconda\envs\OpenHGNN\lib\site-packages\dgl\sparse.py", line 776, in _csrsum C, C_weights = _CAPI_DGLCSRSum(As, [F.to_dgl_nd(w) for w in A_weights]) File "D:\Program Files (x86)\anaconda\envs\OpenHGNN\lib\site-packages\dgl_ffi_ctypes\function.py", line 188, in call check_call(_LIB.DGLFuncCall( File "D:\Program Files (x86)\anaconda\envs\OpenHGNN\lib\site-packages\dgl_ffi\base.py", line 65, in check_call raise DGLError(py_str(_LIB.DGLGetLastError())) dgl._ffi.base.DGLError: [15:31:21] C:\Users\Administrator\dgl-0.5\src\array\kernel.cc:471: Check failed: A[i].indptr->dtype == idtype (int64 vs. int32) : The ID types of all graphs must be equal.

I use the following software versions:

python = 3.8 cudatoolkit = 11.3.1 torch = 1.11.0+cu113 dgl-cu113 = 0.8.1 & 0.8.0

Then I ran the same version of the software on my ubuntu server with no errors.

Theheavens commented 2 years ago

We need help from DGL. @BarclayII

Zhanghyi commented 2 years ago

I have fixed this bug. It is because the default dtype is different on windows and ubuntu. You can remove data cache and then rerun the command. rm -rf ./openhgnn/dataset/acm4GTN rm -rf ~/.dgl/acm4GTN-as-nodepred python main.py -m fastGTN -t node_classification -d acm4GTN -g 0 --use_best_config

huihuijiangqiang commented 2 years ago

Okay, thank you very much.