Pytorch_geometric: Require for the support of pytorch 1.7 and cuda 11.0

Created on 31 Oct 2020  ·  3Comments  ·  Source: rusty1s/pytorch_geometric

The new GPU in our institute is using Cuda 11.0, so I have to use PyTorch 1.7 and Cuda 11.0. I can install PyTorch-geometric and its dependencies following the source installation method in the tutorial; however, I encountered the following problem when running my code:

RuntimeError:
Expected a default value of type Tensor (inferred) on parameter "tensor". Because "tensor" was not annotated with an explicit type it is assumed to be type 'Tensor'.:
File "/root/.pyenv/versions/anaconda3-2020.07/lib/python3.8/site-packages/torch_sparse/tensor.py", line 126
def type_as(self, tensor=torch.Tensor):
~~~~~~~~~
value = self.storage.value()
~
~~~~~
if value is None or tensor.dtype == value.dtype:
~~~~~~~~~~
return self
~
~~
return self.from_storage(self.storage.type_as(tensor))
~
~~~~~~~~~~~~~ <--- HERE

I suspect this is because the current implementation of torch_sparse does not support PyTorch 1.7.

I have tried to install PyTorch 1.6 and Cuda 10.2, and installed the corresponding PyTorch-geometric version, but I encountered another problem as follows:

/root/.pyenv/versions/anaconda3-2019.10/lib/python3.7/site-packages/torch/cuda/__init__.py:125: UserWarning:
A100-SXM4-40GB with CUDA capability sm_80 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_61 sm_70 sm_75 compute_37.

Can you kindly help to solve this problem? Many thanks!

Most helpful comment

Please change line 126 in /root/.pyenv/versions/anaconda3-2020.07/lib/python3.8/site-packages/torch_sparse/tensor.py from

def type_as(self, tensor=torch.Tensor):

to

def type_as(self, tensor: torch.Tensor):

This is already fixed in master, and I will push a new release soon.

All 3 comments

You could try to use PyTorch provided by Nvidia(https://ngc.nvidia.com/catalog/containers/nvidia:pytorch/tags), then build the dependence from the source.

pip install torch-scatter
pip install torch-sparse
pip install torch-cluster
pip install torch-spline-conv
pip install torch-geometric

Hope this will help. 😄

Please change line 126 in /root/.pyenv/versions/anaconda3-2020.07/lib/python3.8/site-packages/torch_sparse/tensor.py from

def type_as(self, tensor=torch.Tensor):

to

def type_as(self, tensor: torch.Tensor):

This is already fixed in master, and I will push a new release soon.

Okay, I will try, many thanks!

Was this page helpful?
0 / 5 - 0 ratings