Issue
$ python main.py --hetero
Created directory results/ACMRaw_2020-01-13_01-20-26
Traceback (most recent call last):
File "main.py", line 101, in <module>
main(args)
File "main.py", line 30, in main
val_mask, test_mask = load_data(args['dataset'])
File "/home/cnudi1/wook/dgl/examples/pytorch/han/utils.py", line 225, in load_data
return load_acm_raw(remove_self_loop)
File "/home/cnudi1/wook/dgl/examples/pytorch/han/utils.py", line 189, in load_acm_raw
pa = dgl.bipartite(p_vs_a, 'paper', 'pa', 'author')
File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/convert.py", line 260, in bipartite
return create_from_scipy(data, utype, etype, vtype)
File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/convert.py", line 823, in create_from_scipy
indptr = utils.toindex(spmat.indptr)
File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/utils.py", line 242, in toindex
return data if isinstance(data, Index) else Index(data)
File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/utils.py", line 15, in __init__
self._initialize_data(data)
File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/utils.py", line 22, in _initialize_data
self._dispatch(data)
File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/utils.py", line 75, in _dispatch
self._user_tensor_data[F.cpu()] = F.zerocopy_from_numpy(self._pydata)
File "/home/cnudi1/.conda/envs/lcr_env/lib/python3.6/site-packages/dgl-0.4-py3.6-linux-ppc64le.egg/dgl/backend/pytorch/tensor.py", line 276, in zerocopy_from_numpy
return th.as_tensor(np_array)
AttributeError: module 'torch' has no attribute 'as_tensor'
I got an error when I try to run the code (https://github.com/dmlc/dgl/blob/master/examples/pytorch/han/main.py)
from the DGL (https://github.com/dmlc/dgl)
It requires CUDA and Pytorch so I managed to install it.
But I got an error and couldn't find the solution with Google/Stackoverflow search
My environment is
- Linux minsky 3.10.0-957.5.1.el7.ppc64le
- CentOS
- Python 3.6.9
- Conda 4.5.11
- CUDA 10.1
- NVCC 10.1
- Pytorch 0.4.0
- Torchvision 0.2.1
Pytorch works fine in Python
>>> import torch
>>> print (torch.__version__)
0.4.0
>>> import torchvision
>>> print (torchvision.__version__)
0.2.1
Please could you help me out?
* DGL is installed from the source code
** Pytorch is installed with conda from channel:engility(How to install pytorch on Power 8 or PPC64 machine?)
conda install -c engility pytorch
because other ways(default conda, pip, install from the source code) never works for ppc64le
Solution
tl;dr Upgrade to PyTorch 0.4.1
Notice that DGL requires PyTorch 0.4.1 and you are using PyTorch 0.4.0. If you take a closer look, you'll see that as_tensor
was proposed in 30 Apr 2018 and merged in 1 May 2018. You'll also see that PyTorch 0.4.0 was released before that on 24 Apr 2018, whereas PyTorch 0.4.1 was release after on 26 Jul 2018. In fact, if you take a look at the changelog of the 0.4.1 version, you'll notice a new operator being announced: torch.as_tensor
:)
Answered By - Berriel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.